Browse Source

Fix #2545: LINQ expression has a question operator on the source collection

pull/2549/head
Siegfried Pammer 4 years ago
parent
commit
4b6fd7aee6
  1. 7
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/QueryExpressions.cs
  2. 2
      ICSharpCode.Decompiler/CSharp/Transforms/IntroduceQueryExpressions.cs

7
ICSharpCode.Decompiler.Tests/TestCases/Pretty/QueryExpressions.cs

@ -204,6 +204,13 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -204,6 +204,13 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
select (x);
}
#if CS60
private List<string> Issue2545(List<string> arglist)
{
return arglist?.OrderByDescending((string f) => f.Length).ThenBy((string f) => f.ToLower()).ToList();
}
#endif
public static IEnumerable<char> Issue1310a(bool test)
{
#if ROSLYN && OPT

2
ICSharpCode.Decompiler/CSharp/Transforms/IntroduceQueryExpressions.cs

@ -361,7 +361,7 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms @@ -361,7 +361,7 @@ namespace ICSharpCode.Decompiler.CSharp.Transforms
return false;
if (mre.MemberName == "OrderBy" || mre.MemberName == "OrderByDescending")
return true;
return !IsNullConditional(mre.Target);
else if (mre.MemberName == "ThenBy" || mre.MemberName == "ThenByDescending")
return ValidateThenByChain(mre.Target as InvocationExpression, expectedParameterName);
else

Loading…
Cancel
Save