Browse Source

Fix DecompilerSettings.PatternMatching should only be active in case >= CS70.

pull/2461/head
Siegfried Pammer 4 years ago
parent
commit
cd787c5549
  1. 2
      ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs
  2. 6
      ICSharpCode.Decompiler.Tests/TestCases/Pretty/ShortCircuit.cs
  3. 3
      ICSharpCode.Decompiler/DecompilerSettings.cs

2
ICSharpCode.Decompiler.Tests/PrettyTestRunner.cs

@ -486,7 +486,7 @@ namespace ICSharpCode.Decompiler.Tests @@ -486,7 +486,7 @@ namespace ICSharpCode.Decompiler.Tests
[Test]
public void Issue1080([ValueSource(nameof(roslynOnlyOptions))] CompilerOptions cscOptions)
{
RunForLibrary(cscOptions: cscOptions);
RunForLibrary(cscOptions: cscOptions, decompilerSettings: new DecompilerSettings(CSharp.LanguageVersion.CSharp6));
}
[Test]

6
ICSharpCode.Decompiler.Tests/TestCases/Pretty/ShortCircuit.cs

@ -320,15 +320,9 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty @@ -320,15 +320,9 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty
if (!F(1))
{
}
if (F(2) && F(3))
{
}
if (F(4) || F(5))
{
}
if (F(0) && F(1) && !F(2) && (F(3) || F(4)))
{
}
E();
}
#endif

3
ICSharpCode.Decompiler/DecompilerSettings.cs

@ -104,6 +104,7 @@ namespace ICSharpCode.Decompiler @@ -104,6 +104,7 @@ namespace ICSharpCode.Decompiler
discards = false;
localFunctions = false;
deconstruction = false;
patternMatching = false;
}
if (languageVersion < CSharp.LanguageVersion.CSharp7_2)
{
@ -157,7 +158,7 @@ namespace ICSharpCode.Decompiler @@ -157,7 +158,7 @@ namespace ICSharpCode.Decompiler
return CSharp.LanguageVersion.CSharp7_2;
// C# 7.1 missing
if (outVariables || throwExpressions || tupleTypes || tupleConversions
|| discards || localFunctions)
|| discards || localFunctions || deconstruction || patternMatching)
return CSharp.LanguageVersion.CSharp7;
if (awaitInCatchFinally || useExpressionBodyForCalculatedGetterOnlyProperties || nullPropagation
|| stringInterpolation || dictionaryInitializers || extensionMethodsInCollectionInitializers

Loading…
Cancel
Save