diff options
author | Jackson Schuster <36744439+jtschuster@users.noreply.github.com> | 2022-06-15 16:17:30 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-15 16:17:30 +0300 |
commit | 2abcee1070e38d2994a25777023dfa61615ea498 (patch) | |
tree | d4316af2ccd36afbde89685f0d455527d7b4dd47 /test | |
parent | e6685e5f59b0380a0806d09bdf8aa308b71f5b6f (diff) |
Adjust ref param kind check for IL offset (#2838)
Diffstat (limited to 'test')
-rw-r--r-- | test/Mono.Linker.Tests.Cases/DataFlow/MethodByRefParameterDataFlow.cs | 193 |
1 files changed, 193 insertions, 0 deletions
diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/MethodByRefParameterDataFlow.cs b/test/Mono.Linker.Tests.Cases/DataFlow/MethodByRefParameterDataFlow.cs index 2b2726541..08e251d3f 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/MethodByRefParameterDataFlow.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/MethodByRefParameterDataFlow.cs @@ -3,6 +3,8 @@ using System; using System.Diagnostics.CodeAnalysis; +using System.Globalization; +using System.Reflection; using Mono.Linker.Tests.Cases.Expectations.Assertions; using Mono.Linker.Tests.Cases.Expectations.Helpers; using Mono.Linker.Tests.Cases.Expectations.Metadata; @@ -34,6 +36,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow TestAssigningToRefParameter (nullType3, ref nullType3); Type nullType4 = null; TestAssigningToRefParameter_Mismatch (nullType4, ref nullType4); + TestPassingRefsWithImplicitThis (); } [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)] @@ -169,11 +172,201 @@ namespace Mono.Linker.Tests.Cases.DataFlow return false; } + static void TestPassingRefsWithImplicitThis () + { + var x = new InheritsFromType (); + var param1 = typeof (int); + var param2 = typeof (string); + x.MethodWithRefAndImplicitThis (ref param1, in param2, out var param3); + param1.RequiresPublicMethods (); + param2.RequiresAll (); + param3.RequiresPublicFields (); + } + [return: DynamicallyAccessedMembersAttribute (DynamicallyAccessedMemberTypes.PublicFields)] static Type GetTypeWithFields () => null; class TestType { } + + class InheritsFromType : Type + { + public void MethodWithRefAndImplicitThis ([DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)] ref Type type1, + in Type type2, + [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicFields)] out Type type3) + { + type3 = typeof (int); + } + public override Assembly Assembly => throw new NotImplementedException (); + + public override string AssemblyQualifiedName => throw new NotImplementedException (); + + public override Type BaseType => throw new NotImplementedException (); + + public override string FullName => throw new NotImplementedException (); + + public override Guid GUID => throw new NotImplementedException (); + + public override Module Module => throw new NotImplementedException (); + + public override string Namespace => throw new NotImplementedException (); + + public override Type UnderlyingSystemType => throw new NotImplementedException (); + + public override string Name => throw new NotImplementedException (); + + [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)] + public override ConstructorInfo[] GetConstructors (BindingFlags bindingAttr) + { + throw new NotImplementedException (); + } + + public override object[] GetCustomAttributes (bool inherit) + { + throw new NotImplementedException (); + } + + public override object[] GetCustomAttributes (Type attributeType, bool inherit) + { + throw new NotImplementedException (); + } + + public override Type GetElementType () + { + throw new NotImplementedException (); + } + + [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicEvents | DynamicallyAccessedMemberTypes.NonPublicEvents)] + public override EventInfo GetEvent (string name, BindingFlags bindingAttr) + { + throw new NotImplementedException (); + } + + [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicEvents | DynamicallyAccessedMemberTypes.NonPublicEvents)] + public override EventInfo[] GetEvents (BindingFlags bindingAttr) + { + throw new NotImplementedException (); + } + + [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] + public override FieldInfo GetField (string name, BindingFlags bindingAttr) + { + throw new NotImplementedException (); + } + + [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields)] + public override FieldInfo[] GetFields (BindingFlags bindingAttr) + { + throw new NotImplementedException (); + } + + [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.Interfaces)] + [return: DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.Interfaces)] + public override Type GetInterface (string name, bool ignoreCase) + { + throw new NotImplementedException (); + } + + [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.Interfaces)] + public override Type[] GetInterfaces () + { + throw new NotImplementedException (); + } + + [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors | DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods | DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.NonPublicFields | DynamicallyAccessedMemberTypes.PublicNestedTypes | DynamicallyAccessedMemberTypes.NonPublicNestedTypes | DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties | DynamicallyAccessedMemberTypes.PublicEvents | DynamicallyAccessedMemberTypes.NonPublicEvents)] + public override MemberInfo[] GetMembers (BindingFlags bindingAttr) + { + throw new NotImplementedException (); + } + + [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] + public override MethodInfo[] GetMethods (BindingFlags bindingAttr) + { + throw new NotImplementedException (); + } + + [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.NonPublicNestedTypes | DynamicallyAccessedMemberTypes.PublicNestedTypes)] + public override Type GetNestedType (string name, BindingFlags bindingAttr) + { + throw new NotImplementedException (); + } + + [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.NonPublicNestedTypes | DynamicallyAccessedMemberTypes.PublicNestedTypes)] + public override Type[] GetNestedTypes (BindingFlags bindingAttr) + { + throw new NotImplementedException (); + } + + [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.NonPublicProperties | DynamicallyAccessedMemberTypes.PublicProperties)] + public override PropertyInfo[] GetProperties (BindingFlags bindingAttr) + { + throw new NotImplementedException (); + } + + [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.All)] + public override object InvokeMember (string name, BindingFlags invokeAttr, Binder binder, object target, object[] args, ParameterModifier[] modifiers, CultureInfo culture, string[] namedParameters) + { + throw new NotImplementedException (); + } + + public override bool IsDefined (Type attributeType, bool inherit) + { + throw new NotImplementedException (); + } + + protected override TypeAttributes GetAttributeFlagsImpl () + { + throw new NotImplementedException (); + } + + [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)] + protected override ConstructorInfo GetConstructorImpl (BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) + { + throw new NotImplementedException (); + } + + [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods | DynamicallyAccessedMemberTypes.NonPublicMethods)] + protected override MethodInfo GetMethodImpl (string name, BindingFlags bindingAttr, Binder binder, CallingConventions callConvention, Type[] types, ParameterModifier[] modifiers) + { + throw new NotImplementedException (); + } + + [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicProperties | DynamicallyAccessedMemberTypes.NonPublicProperties)] + protected override PropertyInfo GetPropertyImpl (string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers) + { + throw new NotImplementedException (); + } + + protected override bool HasElementTypeImpl () + { + throw new NotImplementedException (); + } + + protected override bool IsArrayImpl () + { + throw new NotImplementedException (); + } + + protected override bool IsByRefImpl () + { + throw new NotImplementedException (); + } + + protected override bool IsCOMObjectImpl () + { + throw new NotImplementedException (); + } + + protected override bool IsPointerImpl () + { + throw new NotImplementedException (); + } + + protected override bool IsPrimitiveImpl () + { + throw new NotImplementedException (); + } + } } } |