From 3f62216c85c5d8b7f5be078d289928d078462715 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Sun, 3 Oct 2021 18:29:43 +0200 Subject: [PATCH] Fix simple type patterns. --- .../TestCases/Pretty/PatternMatching.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/PatternMatching.cs b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/PatternMatching.cs index 173e038bd..dbfec51eb 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/PatternMatching.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/PatternMatching.cs @@ -105,6 +105,10 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty } } +#if ROSLYN3 || OPT + // Roslyn 2.x generates a complex infeasible path in debug builds, which RemoveInfeasiblePathTransform + // currently cannot handle. Because this would increase the complexity of that transform, we ignore + // this case. public void TypePatternValueTypesWithShortcircuitOr2(object x) { if (F() || !(x is int value)) @@ -116,6 +120,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty Console.WriteLine(value); } } +#endif public void TypePatternGenerics(object x) { @@ -196,7 +201,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty public static void NotTypePatternVariableUsedOutsideTrueBranch(object x) { - var text = x as string; + string text = x as string; if (text != null && text.Length > 5) { Console.WriteLine("pattern matches");