diff options
author | Sven Boemer <sbomer@gmail.com> | 2022-01-15 01:38:10 +0300 |
---|---|---|
committer | Sven Boemer <sbomer@gmail.com> | 2022-01-15 01:47:50 +0300 |
commit | dc9f7dabf21b2c8410878beefea4e967b695a4c7 (patch) | |
tree | 6c7c7fbbe6841979d17d52faf4a5ca1161172c16 /test/Mono.Linker.Tests.Cases | |
parent | 2ed68104b3ea87ae269d9651842305cead762946 (diff) |
Fix expected warnings for tests
Some of the tests were updated to expectd no extra unmatched warnings
in one branch, and had UnrecognizedReflectionAccessPattern replaced by
ExpectedWarning in another branch. These needed to be updated to have
multiple ExpectedWarnings attributes when multiple warnings are being
produced.
Diffstat (limited to 'test/Mono.Linker.Tests.Cases')
5 files changed, 68 insertions, 6 deletions
diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/GenericParameterDataFlow.cs b/test/Mono.Linker.Tests.Cases/DataFlow/GenericParameterDataFlow.cs index 668259001..f94b62a0c 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/GenericParameterDataFlow.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/GenericParameterDataFlow.cs @@ -360,7 +360,8 @@ namespace Mono.Linker.Tests.Cases.DataFlow public void PublicMethodsMethodParameter (TypeRequiresPublicMethods<TOuter> param) { } public TypeRequiresPublicFields<TOuter> PublicFieldsMethodReturnValue () { return null; } - [ExpectedWarning ("IL2091", nameof (TypeRequiresPublicMethods<TOuter>))] + [ExpectedWarning ("IL2091", nameof (TypeRequiresPublicMethods<TOuter>))] // Return value + [ExpectedWarning ("IL2091", nameof (TypeRequiresPublicMethods<TOuter>))] // Compiler generated local variable public TypeRequiresPublicMethods<TOuter> PublicMethodsMethodReturnValue () { return null; } public void PublicFieldsMethodLocalVariable () diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/LocalDataFlow.cs b/test/Mono.Linker.Tests.Cases/DataFlow/LocalDataFlow.cs index 75f162786..1a6f6d5bb 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/LocalDataFlow.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/LocalDataFlow.cs @@ -233,6 +233,12 @@ namespace Mono.Linker.Tests.Cases.DataFlow ProducedBy = ProducedBy.Trimmer)] [ExpectedWarning ("IL2072", nameof (DataFlowStringExtensions) + "." + nameof (DataFlowStringExtensions.RequiresPublicMethods) + "(String)", ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2072", nameof (DataFlowStringExtensions) + "." + nameof (DataFlowStringExtensions.RequiresPublicMethods) + "(String)", + ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2072", nameof (DataFlowStringExtensions) + "." + nameof (DataFlowStringExtensions.RequiresPublicConstructors) + "(String)", + ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2072", nameof (DataFlowStringExtensions) + "." + nameof (DataFlowStringExtensions.RequiresPublicConstructors) + "(String)", + ProducedBy = ProducedBy.Trimmer)] [ExpectedWarning ("IL2072", nameof (DataFlowStringExtensions) + "." + nameof (DataFlowStringExtensions.RequiresPublicConstructors) + "(String)", ProducedBy = ProducedBy.Trimmer)] public static void TestBranchSwitch () diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/MemberTypes.cs b/test/Mono.Linker.Tests.Cases/DataFlow/MemberTypes.cs index f71f65b81..94b565d39 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/MemberTypes.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/MemberTypes.cs @@ -15,10 +15,63 @@ namespace Mono.Linker.Tests.Cases.DataFlow [ExpectedNoWarnings] public class MemberTypes { - // Some of the types below declare delegates and will mark all members on them, this includes the Delegate .ctor(object, string) which has RUC - [ExpectedWarning ("IL2026", nameof (System.Delegate), ProducedBy = ProducedBy.Trimmer)] - // Some of the types below declare delegates and will mark all members on them, this includes the Delegate .ctor(Type, string) which has DAM annotations - [ExpectedWarning ("IL2111", nameof (System.Delegate), ProducedBy = ProducedBy.Trimmer)] + // Some of the types below declare delegates and will mark all members on them, this includes the Delegate .ctor(object, string) which has RUC and other members + [ExpectedWarning ("IL2026", nameof (Delegate) + ".Delegate", ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2026", nameof (Delegate) + ".Delegate", ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2026", nameof (Delegate) + ".Delegate", ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2026", nameof (Delegate) + ".Delegate", ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2026", nameof (Delegate) + ".Delegate", ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2026", nameof (Delegate.CreateDelegate), ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2026", nameof (Delegate.CreateDelegate), ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2026", nameof (Delegate.CreateDelegate), ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2026", nameof (Delegate.CreateDelegate), ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2026", nameof (Delegate.CreateDelegate), ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2026", nameof (Delegate.CreateDelegate), ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2026", nameof (Delegate.CreateDelegate), ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2026", nameof (Delegate.CreateDelegate), ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2026", nameof (Delegate.CreateDelegate), ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2026", nameof (Delegate.CreateDelegate), ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2026", nameof (Delegate.CreateDelegate), ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2026", nameof (Delegate.CreateDelegate), ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2026", nameof (Delegate.CreateDelegate), ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2026", nameof (Delegate.CreateDelegate), ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2026", nameof (Delegate.CreateDelegate), ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2026", nameof (MulticastDelegate) + ".MulticastDelegate", ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2026", nameof (MulticastDelegate) + ".MulticastDelegate", ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2026", nameof (MulticastDelegate) + ".MulticastDelegate", ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2026", nameof (MulticastDelegate) + ".MulticastDelegate", ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2026", nameof (MulticastDelegate) + ".MulticastDelegate", ProducedBy = ProducedBy.Trimmer)] + // Some of the types below declare delegates and will mark all members on them, this includes the Delegate .ctor(Type, string) which has DAM annotations and other members + [ExpectedWarning ("IL2111", nameof (Delegate) + ".Delegate", ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2111", nameof (Delegate) + ".Delegate", ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2111", nameof (Delegate) + ".Delegate", ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2111", nameof (Delegate) + ".Delegate", ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2111", nameof (Delegate) + ".Delegate", ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2111", nameof (Delegate.CreateDelegate), ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2111", nameof (Delegate.CreateDelegate), ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2111", nameof (Delegate.CreateDelegate), ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2111", nameof (Delegate.CreateDelegate), ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2111", nameof (Delegate.CreateDelegate), ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2111", nameof (Delegate.CreateDelegate), ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2111", nameof (Delegate.CreateDelegate), ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2111", nameof (Delegate.CreateDelegate), ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2111", nameof (Delegate.CreateDelegate), ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2111", nameof (Delegate.CreateDelegate), ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2111", nameof (Delegate.CreateDelegate), ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2111", nameof (Delegate.CreateDelegate), ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2111", nameof (Delegate.CreateDelegate), ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2111", nameof (Delegate.CreateDelegate), ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2111", nameof (Delegate.CreateDelegate), ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2111", nameof (MulticastDelegate) + ".MulticastDelegate", ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2111", nameof (MulticastDelegate) + ".MulticastDelegate", ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2111", nameof (MulticastDelegate) + ".MulticastDelegate", ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2111", nameof (MulticastDelegate) + ".MulticastDelegate", ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2111", nameof (MulticastDelegate) + ".MulticastDelegate", ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2111", nameof (Delegate) + ".BindToMethodName", ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2111", nameof (Delegate) + ".BindToMethodName", ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2111", nameof (Delegate) + ".BindToMethodName", ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2111", nameof (Delegate) + ".BindToMethodName", ProducedBy = ProducedBy.Trimmer)] + [ExpectedWarning ("IL2111", nameof (Delegate) + ".BindToMethodName", ProducedBy = ProducedBy.Trimmer)] public static void Main () { RequirePublicParameterlessConstructor (typeof (PublicParameterlessConstructorType)); diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/UnresolvedMembers.cs b/test/Mono.Linker.Tests.Cases/DataFlow/UnresolvedMembers.cs index 13d964157..de6707416 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/UnresolvedMembers.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/UnresolvedMembers.cs @@ -43,7 +43,8 @@ namespace Mono.Linker.Tests.Cases.DataFlow { } [Kept] - [ExpectedWarning ("IL2066", "TypeWithUnresolvedGenericArgument")] + [ExpectedWarning ("IL2066", "TypeWithUnresolvedGenericArgument")] // Local variable type + [ExpectedWarning ("IL2066", "TypeWithUnresolvedGenericArgument")] // Called method declaring type [ExpectedWarning ("IL2066", nameof (MethodWithUnresolvedGenericArgument))] static void UnresolvedGenericArgument () { diff --git a/test/Mono.Linker.Tests.Cases/Reflection/ActivatorCreateInstance.cs b/test/Mono.Linker.Tests.Cases/Reflection/ActivatorCreateInstance.cs index 91ff5abb9..fb8314f9b 100644 --- a/test/Mono.Linker.Tests.Cases/Reflection/ActivatorCreateInstance.cs +++ b/test/Mono.Linker.Tests.Cases/Reflection/ActivatorCreateInstance.cs @@ -462,6 +462,7 @@ namespace Mono.Linker.Tests.Cases.Reflection [Kept] [ExpectedWarning ("IL2091", nameof (Activator), nameof (Activator.CreateInstance) + "<T>")] + [ExpectedWarning ("IL2091", nameof (Activator), nameof (Activator.CreateInstance) + "<T>")] // Warnings are currently duplicated in NETCORE (annotation and intrinsics) - but they're not identical in this case. // See https://github.com/dotnet/linker/issues/1483 private static void TestCreateInstanceOfTWithNoConstraint<T> () |