From 1a3e70b60a488c33417f840863fa141edf0c7906 Mon Sep 17 00:00:00 2001 From: Siegfried Pammer Date: Mon, 24 Aug 2020 08:29:18 +0200 Subject: [PATCH] Fix warnings in test cases --- ICSharpCode.Decompiler.Tests/TestCases/Correctness/Switch.cs | 2 ++ .../TestCases/Pretty/LocalFunctions.cs | 4 ++++ .../TestCases/Pretty/VariableNaming.cs | 2 ++ 3 files changed, 8 insertions(+) diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Correctness/Switch.cs b/ICSharpCode.Decompiler.Tests/TestCases/Correctness/Switch.cs index f28e691cf..bb63a2096 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/Correctness/Switch.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/Correctness/Switch.cs @@ -169,7 +169,9 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Correctness case false: return bool.FalseString; default: +#pragma warning disable CS0162 return null; +#pragma warning restore CS0162 } } diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/LocalFunctions.cs b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/LocalFunctions.cs index c38a81c17..ff0ee4f62 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/LocalFunctions.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/LocalFunctions.cs @@ -33,6 +33,7 @@ namespace LocalFunctions { public int MixedLocalFunction() where T2 : ICloneable, IConvertible { +#pragma warning disable CS0219 T2 t2 = default(T2); object z = this; for (int j = 0; j < 10; j++) { @@ -107,6 +108,7 @@ namespace LocalFunctions return k; } } +#pragma warning restore CS0219 } public int MixedLocalFunction2Delegate() where T2 : ICloneable, IConvertible @@ -199,6 +201,7 @@ namespace LocalFunctions public static void Test_CaptureT() { +#pragma warning disable CS0219 T2 t2 = default(T2); Method1(); void Method1() @@ -214,6 +217,7 @@ namespace LocalFunctions t3 = default(T3); } } +#pragma warning restore CS0219 } public void TestGenericArgs() where T2 : List diff --git a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/VariableNaming.cs b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/VariableNaming.cs index 80b453a73..051d10cdc 100644 --- a/ICSharpCode.Decompiler.Tests/TestCases/Pretty/VariableNaming.cs +++ b/ICSharpCode.Decompiler.Tests/TestCases/Pretty/VariableNaming.cs @@ -47,6 +47,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty private void Issue1881() { +#pragma warning disable CS0219 MyEnum enumLocal1 = MyEnum.VALUE1; MyEnum enumLocal2 = (MyEnum)0; enumLocal2 = MyEnum.VALUE1; @@ -56,6 +57,7 @@ namespace ICSharpCode.Decompiler.Tests.TestCases.Pretty ValueType enumLocal5 = MyEnum.VALUE1; ValueType enumLocal6 = (MyEnum)0; enumLocal6 = MyEnum.VALUE2; +#pragma warning restore CS0219 } #endif }