diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/NullableRefTypes.cs b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/NullableRefTypes.cs index fa6d934c5..b629a2e7e 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/NullableRefTypes.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/NullableRefTypes.cs @@ -3,6 +3,7 @@ using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; +using System.Linq; namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty { @@ -207,4 +208,21 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty return default; } } + + public class T09_Linq + { + public IEnumerable QueryWithNonNullableReferenceTypes(IEnumerable strings) + { + return from s in strings + where s.Length > 0 + select s.ToUpper(); + } + + public IEnumerable QueryWithNullableReferenceTypes(IEnumerable strings) + { + return from s in strings + where s != null + select s.ToUpper(); + } + } } diff --git a/ICSharpCode.Decompiler/Semantics/LambdaResolveResult.cs b/ICSharpCode.Decompiler/Semantics/LambdaResolveResult.cs index 4bc1269e1..fd09a4875 100644 --- a/ICSharpCode.Decompiler/Semantics/LambdaResolveResult.cs +++ b/ICSharpCode.Decompiler/Semantics/LambdaResolveResult.cs @@ -165,7 +165,7 @@ namespace ICSharpCode.Decompiler.Semantics return Conversion.None; for (int i = 0; i < parameterTypes.Length; ++i) { - if (parameterTypes[i].Equals(this.Parameters[i].Type)) + if (NormalizeTypeVisitor.IgnoreNullability.EquivalentTypes(parameterTypes[i], this.Parameters[i].Type)) { continue; }