Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/linker.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'test/Mono.Linker.Tests.Cases/Reflection/NestedTypeUsedViaReflection.cs')
-rw-r--r--test/Mono.Linker.Tests.Cases/Reflection/NestedTypeUsedViaReflection.cs21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/Mono.Linker.Tests.Cases/Reflection/NestedTypeUsedViaReflection.cs b/test/Mono.Linker.Tests.Cases/Reflection/NestedTypeUsedViaReflection.cs
index cda87ee85..2700a8793 100644
--- a/test/Mono.Linker.Tests.Cases/Reflection/NestedTypeUsedViaReflection.cs
+++ b/test/Mono.Linker.Tests.Cases/Reflection/NestedTypeUsedViaReflection.cs
@@ -16,6 +16,7 @@ namespace Mono.Linker.Tests.Cases.Reflection
TestPrivateByName ();
TestByBindingFlags ();
TestByUnknownBindingFlags (BindingFlags.Public);
+ TestByUnknownBindingFlagsAndName (BindingFlags.Public, "DoesntMatter");
TestNonExistingName ();
TestNullType ();
TestIgnoreCaseBindingFlags ();
@@ -81,6 +82,16 @@ namespace Mono.Linker.Tests.Cases.Reflection
}
[Kept]
+ [RecognizedReflectionAccessPattern (
+ typeof (Type), nameof (Type.GetNestedType), new Type[] { typeof (string), typeof (BindingFlags) },
+ typeof (UnknownBindingFlagsAndName.PublicNestedType), null, (Type[]) null)]
+ static void TestByUnknownBindingFlagsAndName (BindingFlags bindingFlags, string name)
+ {
+ // Since the binding flags and name are not known linker should mark all nested types on the type
+ _ = typeof (UnknownBindingFlagsAndName).GetNestedType (name, bindingFlags);
+ }
+
+ [Kept]
static void TestNonExistingName ()
{
_ = typeof (NestedTypeUsedViaReflection).GetNestedType ("NonExisting");
@@ -125,6 +136,16 @@ namespace Mono.Linker.Tests.Cases.Reflection
}
[Kept]
+ private class UnknownBindingFlagsAndName
+ {
+ [Kept]
+ public static class PublicNestedType { }
+
+ [Kept]
+ private static class PrivateNestedType { }
+ }
+
+ [Kept]
private class IgnoreCaseClass
{
[Kept]