Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/linker.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremi Kurdek <59935235+jkurdek@users.noreply.github.com>2022-08-09 14:26:21 +0300
committerGitHub <noreply@github.com>2022-08-09 14:26:21 +0300
commita0a2dc8ff0367c1acabb4c373f71c9ef1a6b6121 (patch)
treeaedf9188ec96ec7ada27be4ff304cb481a8869f2
parentb6920a953e03ed6e01c159730c699bf228615f4d (diff)
Fixed IL2121 single warn issue (#2953)
-rw-r--r--src/ILLink.Shared/DiagnosticId.cs2
-rw-r--r--test/ILLink.RoslynAnalyzer.Tests/generated/ILLink.RoslynAnalyzer.Tests.Generator/ILLink.RoslynAnalyzer.Tests.TestCaseGenerator/Warnings.WarningSuppressionTests.g.cs6
-rw-r--r--test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsSingleWarn.cs29
3 files changed, 36 insertions, 1 deletions
diff --git a/src/ILLink.Shared/DiagnosticId.cs b/src/ILLink.Shared/DiagnosticId.cs
index bcc967af1..2f5787070 100644
--- a/src/ILLink.Shared/DiagnosticId.cs
+++ b/src/ILLink.Shared/DiagnosticId.cs
@@ -222,7 +222,7 @@ namespace ILLink.Shared
2103 => MessageSubCategory.TrimAnalysis,
2106 => MessageSubCategory.TrimAnalysis,
2107 => MessageSubCategory.TrimAnalysis,
- >= 2109 and <= 2120 => MessageSubCategory.TrimAnalysis,
+ >= 2109 and <= 2121 => MessageSubCategory.TrimAnalysis,
>= 3050 and <= 3052 => MessageSubCategory.AotAnalysis,
>= 3054 and <= 3055 => MessageSubCategory.AotAnalysis,
_ => MessageSubCategory.None,
diff --git a/test/ILLink.RoslynAnalyzer.Tests/generated/ILLink.RoslynAnalyzer.Tests.Generator/ILLink.RoslynAnalyzer.Tests.TestCaseGenerator/Warnings.WarningSuppressionTests.g.cs b/test/ILLink.RoslynAnalyzer.Tests/generated/ILLink.RoslynAnalyzer.Tests.Generator/ILLink.RoslynAnalyzer.Tests.TestCaseGenerator/Warnings.WarningSuppressionTests.g.cs
index 62b51050b..116fd8239 100644
--- a/test/ILLink.RoslynAnalyzer.Tests/generated/ILLink.RoslynAnalyzer.Tests.Generator/ILLink.RoslynAnalyzer.Tests.TestCaseGenerator/Warnings.WarningSuppressionTests.g.cs
+++ b/test/ILLink.RoslynAnalyzer.Tests/generated/ILLink.RoslynAnalyzer.Tests.Generator/ILLink.RoslynAnalyzer.Tests.TestCaseGenerator/Warnings.WarningSuppressionTests.g.cs
@@ -56,6 +56,12 @@ namespace ILLink.RoslynAnalyzer.Tests.Warnings
}
[Fact]
+ public Task DetectRedundantSuppressionsSingleWarn ()
+ {
+ return RunTest (allowMissingWarnings: true);
+ }
+
+ [Fact]
public Task SuppressWarningsInAssembly ()
{
return RunTest (allowMissingWarnings: true);
diff --git a/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsSingleWarn.cs b/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsSingleWarn.cs
new file mode 100644
index 000000000..4ba1a6149
--- /dev/null
+++ b/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsSingleWarn.cs
@@ -0,0 +1,29 @@
+// Copyright (c) .NET Foundation and contributors. All rights reserved.
+// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+
+using System;
+using System.Diagnostics.CodeAnalysis;
+using Mono.Linker.Tests.Cases.Expectations.Assertions;
+using Mono.Linker.Tests.Cases.Expectations.Metadata;
+
+
+namespace Mono.Linker.Tests.Cases.Warnings.WarningSuppression
+{
+ [SkipKeptItemsValidation]
+ [SetupLinkerArgument ("--singlewarn")]
+ [LogContains ("warning IL2104: Assembly 'test' produced trim warnings")]
+ [LogDoesNotContain ("IL2121")]
+ class DetectRedundantSuppressionsSingleWarn
+ {
+ public static void Main ()
+ {
+ TrimmerCompatibleMethod ();
+ }
+
+ [UnconditionalSuppressMessage ("test", "IL2072")]
+ public static string TrimmerCompatibleMethod ()
+ {
+ return "test";
+ }
+ }
+}