diff options
Diffstat (limited to 'test/Mono.Linker.Tests.Cases/DataFlow/MethodReturnParameterDataFlow.cs')
-rw-r--r-- | test/Mono.Linker.Tests.Cases/DataFlow/MethodReturnParameterDataFlow.cs | 26 |
1 files changed, 8 insertions, 18 deletions
diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/MethodReturnParameterDataFlow.cs b/test/Mono.Linker.Tests.Cases/DataFlow/MethodReturnParameterDataFlow.cs index e5721b35d..1a2ee9aa3 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/MethodReturnParameterDataFlow.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/MethodReturnParameterDataFlow.cs @@ -12,7 +12,7 @@ using Mono.Linker.Tests.Cases.Expectations.Metadata; 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. + // - so the main validation is done by the ExpectedWarning attributes. [SkipKeptItemsValidation] [ExpectedNoWarnings] public class MethodReturnParameterDataFlow @@ -46,8 +46,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow return typeof (TestType); } - [UnrecognizedReflectionAccessPattern (typeof (MethodReturnParameterDataFlow), nameof (ReturnPublicParameterlessConstructor), - new Type[] { typeof (Type), typeof (Type), typeof (Type) }, returnType: typeof (Type), messageCode: "IL2068")] + [ExpectedWarning ("IL2068", nameof (ReturnPublicParameterlessConstructor))] [return: DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type ReturnPublicParameterlessConstructor ( [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] @@ -71,41 +70,35 @@ namespace Mono.Linker.Tests.Cases.DataFlow } } - [UnrecognizedReflectionAccessPattern (typeof (MethodReturnParameterDataFlow), nameof (ReturnPublicParameterlessConstructorFromUnknownType), - new Type[] { typeof (Type) }, returnType: typeof (Type), messageCode: "IL2068")] + [ExpectedWarning ("IL2068", nameof (ReturnPublicParameterlessConstructorFromUnknownType))] [return: DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type ReturnPublicParameterlessConstructorFromUnknownType (Type unknownType) { return unknownType; } - [RecognizedReflectionAccessPattern] [return: DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type ReturnPublicParameterlessConstructorFromConstant () { return typeof (TestType); } - [RecognizedReflectionAccessPattern] [return: DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type ReturnPublicParameterlessConstructorFromNull () { return null; } - [RecognizedReflectionAccessPattern] Type ReturnTypeWithNoRequirements () { return null; } // Validate error message when insufficiently annotated value is returned from a method - [UnrecognizedReflectionAccessPattern (typeof (MethodReturnParameterDataFlow), nameof (ReturnPublicConstructorsFailure), - new Type[] { typeof (Type) }, returnType: typeof (Type), - messageCode: "IL2068", message: new string[] { + [ExpectedWarning ("IL2068", "publicParameterlessConstructorType", "MethodReturnParameterDataFlow.ReturnPublicConstructorsFailure", - "MethodReturnParameterDataFlow.ReturnPublicConstructorsFailure" })] + "MethodReturnParameterDataFlow.ReturnPublicConstructorsFailure")] [return: DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicConstructors)] Type ReturnPublicConstructorsFailure ( [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] @@ -114,8 +107,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow return publicParameterlessConstructorType; } - [UnrecognizedReflectionAccessPattern (typeof (MethodReturnParameterDataFlow), nameof (ReturnNonPublicConstructorsFailure), - new Type[] { typeof (Type) }, returnType: typeof (Type), messageCode: "IL2068")] + [ExpectedWarning ("IL2068", nameof (ReturnNonPublicConstructorsFailure))] [return: DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.NonPublicConstructors)] Type ReturnNonPublicConstructorsFailure ( [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] @@ -171,11 +163,9 @@ namespace Mono.Linker.Tests.Cases.DataFlow t.RequiresNone (); } - [UnrecognizedReflectionAccessPattern (typeof (MethodReturnParameterDataFlow), nameof (PropagateReturnToReturn), new Type[] { typeof (int) }, returnType: typeof (Type), - messageCode: "IL2073", message: new string[] { + [ExpectedWarning ("IL2073", nameof (ReturnTypeWithNoRequirements), - nameof (PropagateReturnToReturn) - })] + nameof (PropagateReturnToReturn))] [return: DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)] Type PropagateReturnToReturn (int n) { |