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-02 19:35:04 +0300
committerGitHub <noreply@github.com>2022-08-02 19:35:04 +0300
commit64455a592fddc0d3c8f6cbbd0c3367f4f0084780 (patch)
tree977777563f6f9037194081e54f00b54e9946100b
parent04290eb19589a3cc351d72b77e1557b065917fd9 (diff)
Redundant suppressions support for suppressions on events and properties (#2925) (#2940)
-rw-r--r--src/linker/Linker.Steps/CheckSuppressionsStep.cs3
-rw-r--r--test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsInMembersAndTypes.cs42
2 files changed, 42 insertions, 3 deletions
diff --git a/src/linker/Linker.Steps/CheckSuppressionsStep.cs b/src/linker/Linker.Steps/CheckSuppressionsStep.cs
index e9d63a395..611acb94a 100644
--- a/src/linker/Linker.Steps/CheckSuppressionsStep.cs
+++ b/src/linker/Linker.Steps/CheckSuppressionsStep.cs
@@ -12,7 +12,8 @@ namespace Mono.Linker.Steps
return SubStepTargets.Type |
SubStepTargets.Field |
SubStepTargets.Method |
- SubStepTargets.Property;
+ SubStepTargets.Property |
+ SubStepTargets.Event;
}
}
diff --git a/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsInMembersAndTypes.cs b/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsInMembersAndTypes.cs
index 74ed1c16d..6488cdacb 100644
--- a/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsInMembersAndTypes.cs
+++ b/test/Mono.Linker.Tests.Cases/Warnings/WarningSuppression/DetectRedundantSuppressionsInMembersAndTypes.cs
@@ -19,7 +19,9 @@ namespace Mono.Linker.Tests.Cases.Warnings.WarningSuppression
RedundantSuppressionOnType.Test ();
RedundantSuppressionOnMethod.Test ();
RedundantSuppressionOnNestedType.Test ();
+ RedundantSuppressionOnPropertyGet.Test ();
RedundantSuppressionOnProperty.Test ();
+ RedundantSuppressionOnEventAdd.Test ();
RedundantSuppressionOnEvent.Test ();
MultipleRedundantSuppressions.Test ();
RedundantAndUsedSuppressions.Test ();
@@ -78,7 +80,7 @@ namespace Mono.Linker.Tests.Cases.Warnings.WarningSuppression
}
}
- public class RedundantSuppressionOnProperty
+ public class RedundantSuppressionOnPropertyGet
{
public static void Test ()
{
@@ -94,7 +96,23 @@ namespace Mono.Linker.Tests.Cases.Warnings.WarningSuppression
}
}
- public class RedundantSuppressionOnEvent
+ public class RedundantSuppressionOnProperty
+ {
+ public static void Test ()
+ {
+ var property = TrimmerCompatibleProperty;
+ }
+
+ [ExpectedWarning ("IL2121", "IL2071", ProducedBy = ProducedBy.Trimmer)]
+ [UnconditionalSuppressMessage ("Test", "IL2071")]
+ public static string TrimmerCompatibleProperty {
+ get {
+ return TrimmerCompatibleMethod ();
+ }
+ }
+ }
+
+ public class RedundantSuppressionOnEventAdd
{
public static void Test ()
{
@@ -114,6 +132,26 @@ namespace Mono.Linker.Tests.Cases.Warnings.WarningSuppression
}
}
+ public class RedundantSuppressionOnEvent
+ {
+ public static void Test ()
+ {
+ Event += EventSubscriber;
+ }
+
+ static void EventSubscriber (object sender, EventArgs e)
+ {
+
+ }
+
+ [ExpectedWarning ("IL2121", "IL2072", ProducedBy = ProducedBy.Trimmer)]
+ [UnconditionalSuppressMessage ("Test", "IL2072")]
+ static event EventHandler<EventArgs> Event {
+ add { TrimmerCompatibleMethod (); }
+ remove { }
+ }
+ }
+
[ExpectedWarning ("IL2121", "IL2072", ProducedBy = ProducedBy.Trimmer)]
[UnconditionalSuppressMessage ("Test", "IL2072")]
[ExpectedWarning ("IL2121", "IL2071", ProducedBy = ProducedBy.Trimmer)]