diff options
author | Vitek Karas <10670590+vitek-karas@users.noreply.github.com> | 2021-12-08 17:19:15 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-08 17:19:15 +0300 |
commit | 6a787f26be8c95a6c742d628acf0c0678d8122e3 (patch) | |
tree | 2a619a109e4e672485036ca6c77959c03e8c53c0 /test/Mono.Linker.Tests.Cases/DataFlow | |
parent | 6880454ee1a29cb9e8239cb28d352228712661ee (diff) |
Add test for wrong warning in MakeGenericType annotation mismatch (#2429)
Test for #2428
Diffstat (limited to 'test/Mono.Linker.Tests.Cases/DataFlow')
-rw-r--r-- | test/Mono.Linker.Tests.Cases/DataFlow/GenericParameterDataFlow.cs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/GenericParameterDataFlow.cs b/test/Mono.Linker.Tests.Cases/DataFlow/GenericParameterDataFlow.cs index a765e85aa..1e2313f2a 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/GenericParameterDataFlow.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/GenericParameterDataFlow.cs @@ -764,7 +764,9 @@ namespace Mono.Linker.Tests.Cases.DataFlow TestWithRequirements (); TestWithRequirementsFromParam (null); + TestWithRequirementsFromParamWithMismatch (null); TestWithRequirementsFromGenericParam<TestType> (); + TestWithRequirementsFromGenericParamWithMismatch<TestType> (); TestWithNoRequirements (); TestWithNoRequirementsFromParam (null); @@ -843,6 +845,15 @@ namespace Mono.Linker.Tests.Cases.DataFlow typeof (GenericWithPublicFieldsArgument<>).MakeGenericType (type); } + // https://github.com/dotnet/linker/issues/2428 + // [ExpectedWarning ("IL2071", "'T'")] + [ExpectedWarning ("IL2070", "'this'")] + static void TestWithRequirementsFromParamWithMismatch ( + [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)] Type type) + { + typeof (GenericWithPublicFieldsArgument<>).MakeGenericType (type); + } + [RecognizedReflectionAccessPattern] static void TestWithRequirementsFromGenericParam< [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicFields)] T> () @@ -850,6 +861,15 @@ namespace Mono.Linker.Tests.Cases.DataFlow typeof (GenericWithPublicFieldsArgument<>).MakeGenericType (typeof (T)); } + // https://github.com/dotnet/linker/issues/2428 + // [ExpectedWarning ("IL2091", "'T'")] + [ExpectedWarning ("IL2090", "'this'")] // Note that this actually produces a warning which should not be possible to produce right now + static void TestWithRequirementsFromGenericParamWithMismatch< + [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)] TInput> () + { + typeof (GenericWithPublicFieldsArgument<>).MakeGenericType (typeof (TInput)); + } + class GenericWithPublicFieldsArgument<[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicFields)] T> { } |