diff options
Diffstat (limited to 'test/Mono.Linker.Tests.Cases/DataFlow')
-rw-r--r-- | test/Mono.Linker.Tests.Cases/DataFlow/GenericParameterDataFlow.cs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/GenericParameterDataFlow.cs b/test/Mono.Linker.Tests.Cases/DataFlow/GenericParameterDataFlow.cs index 7872462f7..08bb958cd 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/GenericParameterDataFlow.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/GenericParameterDataFlow.cs @@ -882,12 +882,14 @@ namespace Mono.Linker.Tests.Cases.DataFlow { TestNullMethod (); TestUnknownInput (null); + TestUnknownMethodButNoTypeArguments (null); TestWithNoArguments (); TestWithRequirements (); TestWithRequirementsFromParam (null); TestWithRequirementsFromGenericParam<TestType> (); TestWithRequirementsViaRuntimeMethod (); + TestWithRequirementsButNoTypeArguments (); TestWithNoRequirements (); TestWithNoRequirementsFromParam (null); @@ -914,6 +916,14 @@ namespace Mono.Linker.Tests.Cases.DataFlow mi.MakeGenericMethod (typeof (TestType)); } + [UnrecognizedReflectionAccessPattern (typeof (MethodInfo), nameof (MethodInfo.MakeGenericMethod), new Type[] { typeof (Type[]) }, + messageCode: "IL2060")] + static void TestUnknownMethodButNoTypeArguments (MethodInfo mi) + { + // Thechnically linker could figure this out, but it's not worth the complexity - such call will always fail at runtime. + mi.MakeGenericMethod (Type.EmptyTypes); + } + [RecognizedReflectionAccessPattern] static void TestWithNoArguments () { @@ -957,6 +967,15 @@ namespace Mono.Linker.Tests.Cases.DataFlow .MakeGenericMethod (typeof (TestType)); } + [UnrecognizedReflectionAccessPattern (typeof (MethodInfo), nameof (MethodInfo.MakeGenericMethod), new Type[] { typeof (Type[]) }, + messageCode: "IL2060")] + static void TestWithRequirementsButNoTypeArguments () + { + // Linker could figure out that this is not a problem, but it's not worth the complexity, since this will always throw at runtime + typeof (MakeGenericMethod).GetMethod (nameof (GenericWithRequirements), BindingFlags.Static) + .MakeGenericMethod (Type.EmptyTypes); + } + public static void GenericWithRequirements<[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicFields)] T> () { } |