diff --git a/ICSharpCode.Decompiler.Tests/Helpers/Tester.cs b/ICSharpCode.Decompiler.Tests/Helpers/Tester.cs index b864ce078..a342dbb0b 100644 --- a/ICSharpCode.Decompiler.Tests/Helpers/Tester.cs +++ b/ICSharpCode.Decompiler.Tests/Helpers/Tester.cs @@ -552,10 +552,6 @@ namespace ICSharpCode.Decompiler.Tests.Helpers // Never use file-scoped namespaces FileScopedNamespaces = false }; - if (!cscOptions.HasFlag(CompilerOptions.NullableEnable)) - { - settings.NullableReferenceTypes = false; - } return settings; } else diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/NullableRefTypes.cs b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/NullableRefTypes.cs index b23a67a8d..49d191b08 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/NullableRefTypes.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/NullableRefTypes.cs @@ -39,7 +39,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty public int GetLength2(string[]? arr) { - return field_nullable_string!.Length + arr!.Length; + return field_nullable_string.Length + arr.Length; } public int? GetLength3(string[]? arr) @@ -59,7 +59,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty public void CallByRef(ref string a, ref string? b) { ByRef(ref a).ToString(); - ByRef(ref b)!.ToString(); + ByRef(ref b).ToString(); } public void Constraints() where C : class where CN : class? where NN : notnull where S : struct where D : IDisposable where DN : IDisposable? where NND : notnull, IDisposable diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/QueryExpressions.cs b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/QueryExpressions.cs index f334ce24c..591fe4fc3 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/QueryExpressions.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/QueryExpressions.cs @@ -20,11 +20,6 @@ using System; using System.Collections.Generic; using System.Linq; using System.Reflection; -#if ROSLYN4 && !NET40 -// This is needed because there are some nullability attributes on compiler-generated lambdas, -// which are removed after IntroduceUsingDeclarations ran. -using System.Runtime.CompilerServices; -#endif namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty { diff --git a/ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs b/ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs index 65f32fea7..23454d8cd 100644 --- a/ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs +++ b/ICSharpCode.Decompiler/CSharp/ExpressionBuilder.cs @@ -2581,6 +2581,8 @@ namespace ICSharpCode.Decompiler.CSharp private TranslatedExpression EnsureTargetNotNullable(TranslatedExpression expr, ILInstruction inst) { + /* + // TODO Improve nullability support so that we do not sprinkle ! operators everywhere. // inst is the instruction that got translated into expr. if (expr.Type.Nullability == Nullability.Nullable) { @@ -2598,6 +2600,7 @@ namespace ICSharpCode.Decompiler.CSharp .WithRR(new ResolveResult(expr.Type.ChangeNullability(Nullability.Oblivious))) .WithoutILInstruction(); } + */ return expr; }