From fafb6cf6a385a8c753faa174b9ab7c3600a9d494 Mon Sep 17 00:00:00 2001 From: Marek Safar Date: Sat, 8 May 2021 08:26:38 +0200 Subject: Trim parameter names metadata when they are not needed. (#1988) Co-authored-by: Vitek Karas --- .../DataFlow/GenericParameterDataFlow.cs | 18 +++++++++--------- .../DataFlow/MethodParametersDataFlow.cs | 1 + 2 files changed, 10 insertions(+), 9 deletions(-) (limited to 'test/Mono.Linker.Tests.Cases/DataFlow') diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/GenericParameterDataFlow.cs b/test/Mono.Linker.Tests.Cases/DataFlow/GenericParameterDataFlow.cs index b56225c9b..3889225a2 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/GenericParameterDataFlow.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/GenericParameterDataFlow.cs @@ -468,7 +468,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow typeof (T).RequiresNone (); } - [UnrecognizedReflectionAccessPattern (typeof (GenericParameterDataFlow), nameof (MethodRequiresPublicMethods) + "()::T", messageCode: "IL2091")] + [UnrecognizedReflectionAccessPattern (typeof (GenericParameterDataFlow), nameof (MethodRequiresPublicMethods) + "<#1>()::T", messageCode: "IL2091")] static void MethodRequiresPublicFieldsPassThrough< [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicFields)] T> () { @@ -477,8 +477,8 @@ namespace Mono.Linker.Tests.Cases.DataFlow MethodRequiresNothing (); } - [UnrecognizedReflectionAccessPattern (typeof (GenericParameterDataFlow), nameof (MethodRequiresPublicFields) + "()::T", messageCode: "IL2091")] - [UnrecognizedReflectionAccessPattern (typeof (GenericParameterDataFlow), nameof (MethodRequiresPublicMethods) + "()::T", messageCode: "IL2091")] + [UnrecognizedReflectionAccessPattern (typeof (GenericParameterDataFlow), nameof (MethodRequiresPublicFields) + "<#1>()::T", messageCode: "IL2091")] + [UnrecognizedReflectionAccessPattern (typeof (GenericParameterDataFlow), nameof (MethodRequiresPublicMethods) + "<#1>()::T", messageCode: "IL2091")] static void MethodRequiresNothingPassThrough () { MethodRequiresPublicFields (); @@ -550,7 +550,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow class TypeWithInstantiatedGenericMethodViaGenericParameter<[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicFields)] TOuter> : BaseTypeWithGenericMethod, IInterfaceWithGenericMethod { - [UnrecognizedReflectionAccessPattern (typeof (BaseTypeWithGenericMethod), nameof (BaseTypeWithGenericMethod.StaticRequiresPublicMethods) + "()::T", + [UnrecognizedReflectionAccessPattern (typeof (BaseTypeWithGenericMethod), nameof (BaseTypeWithGenericMethod.StaticRequiresPublicMethods) + "<#1>()::T", messageCode: "IL2091", message: new string[] { "TInner", "Mono.Linker.Tests.Cases.DataFlow.GenericParameterDataFlow.TypeWithInstantiatedGenericMethodViaGenericParameter.StaticRequiresPublicFields()", @@ -562,7 +562,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow StaticRequiresPublicMethods (); } - [UnrecognizedReflectionAccessPattern (typeof (BaseTypeWithGenericMethod), nameof (BaseTypeWithGenericMethod.StaticRequiresPublicMethods) + "()::T", + [UnrecognizedReflectionAccessPattern (typeof (BaseTypeWithGenericMethod), nameof (BaseTypeWithGenericMethod.StaticRequiresPublicMethods) + "<#1>()::T", messageCode: "IL2091", message: new string[] { "TOuter", "Mono.Linker.Tests.Cases.DataFlow.GenericParameterDataFlow.TypeWithInstantiatedGenericMethodViaGenericParameter", @@ -580,7 +580,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow StaticRequiresMultipleGenericParams (); } - [UnrecognizedReflectionAccessPattern (typeof (BaseTypeWithGenericMethod), nameof (BaseTypeWithGenericMethod.StaticRequiresMultipleGenericParams) + "()::TMethods", + [UnrecognizedReflectionAccessPattern (typeof (BaseTypeWithGenericMethod), nameof (BaseTypeWithGenericMethod.StaticRequiresMultipleGenericParams) + "<#2>()::TMethods", messageCode: "IL2091", message: new string[] { "TOuter", "Mono.Linker.Tests.Cases.DataFlow.GenericParameterDataFlow.TypeWithInstantiatedGenericMethodViaGenericParameter", @@ -591,7 +591,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow StaticRequiresMultipleGenericParams (); } - [UnrecognizedReflectionAccessPattern (typeof (BaseTypeWithGenericMethod), nameof (BaseTypeWithGenericMethod.InstanceRequiresPublicMethods) + "()::T", + [UnrecognizedReflectionAccessPattern (typeof (BaseTypeWithGenericMethod), nameof (BaseTypeWithGenericMethod.InstanceRequiresPublicMethods) + "<#1>()::T", messageCode: "IL2091", message: new string[] { "TInner", "Mono.Linker.Tests.Cases.DataFlow.GenericParameterDataFlow.TypeWithInstantiatedGenericMethodViaGenericParameter.InstanceRequiresPublicFields()", @@ -603,7 +603,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow InstanceRequiresPublicMethods (); } - [UnrecognizedReflectionAccessPattern (typeof (BaseTypeWithGenericMethod), nameof (BaseTypeWithGenericMethod.InstanceRequiresPublicMethods) + "()::T", + [UnrecognizedReflectionAccessPattern (typeof (BaseTypeWithGenericMethod), nameof (BaseTypeWithGenericMethod.InstanceRequiresPublicMethods) + "<#1>()::T", messageCode: "IL2091", message: new string[] { "TOuter", "Mono.Linker.Tests.Cases.DataFlow.GenericParameterDataFlow.TypeWithInstantiatedGenericMethodViaGenericParameter", @@ -639,7 +639,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow typeof (T).RequiresPublicMethods (); } - [UnrecognizedReflectionAccessPattern (typeof (IInterfaceWithGenericMethod), nameof (IInterfaceWithGenericMethod.InterfaceRequiresPublicMethods) + "()::T", + [UnrecognizedReflectionAccessPattern (typeof (IInterfaceWithGenericMethod), nameof (IInterfaceWithGenericMethod.InterfaceRequiresPublicMethods) + "<#1>()::T", messageCode: "IL2091", message: new string[] { "TOuter", "Mono.Linker.Tests.Cases.DataFlow.GenericParameterDataFlow.TypeWithInstantiatedGenericMethodViaGenericParameter", diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/MethodParametersDataFlow.cs b/test/Mono.Linker.Tests.Cases/DataFlow/MethodParametersDataFlow.cs index fe11b6b03..01047bc7a 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/MethodParametersDataFlow.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/MethodParametersDataFlow.cs @@ -14,6 +14,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow // Note: this test's goal is to validate that the product correctly reports unrecognized patterns // - so the main validation is done by the UnrecognizedReflectionAccessPattern attributes. [SkipKeptItemsValidation] + [SetupLinkerArgument ("--keep-metadata", "parametername")] public class MethodParametersDataFlow { public static void Main () -- cgit v1.2.3