Skip to content

Commit

Permalink
Adds a test with two annotated out params for the same method. (dotne…
Browse files Browse the repository at this point in the history
  • Loading branch information
vitek-karas committed Aug 4, 2022
1 parent 0e402c8 commit 833d2ea
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public static void Main ()
PassRefToParameter (null);

PointerDereference.Test ();
MultipleOutRefsToField.Test ();
}

[Kept]
Expand Down Expand Up @@ -150,5 +151,41 @@ public static void Test ()
LocalStackAllocDeref (null);
}
}

[Kept]
class MultipleOutRefsToField
{
[Kept]
[KeptAttributeAttribute (typeof (DynamicallyAccessedMembersAttribute))]
[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)]
static Type _publicMethodsField;

[Kept]
[KeptAttributeAttribute (typeof (DynamicallyAccessedMembersAttribute))]
[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicProperties)]
static Type _publicPropertiesField;

[Kept]
static void TwoOutRefs (
[KeptAttributeAttribute (typeof (DynamicallyAccessedMembersAttribute))]
[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)]
out Type publicMethods,
[KeptAttributeAttribute (typeof (DynamicallyAccessedMembersAttribute))]
[DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicProperties)]
out Type publicProperties)
{
publicMethods = null;
publicProperties = null;
}

[Kept]
// https://github.com/dotnet/linker/issues/2874
[ExpectedWarning ("IL2069", ProducedBy = ProducedBy.Trimmer)]
[ExpectedWarning ("IL2069", ProducedBy = ProducedBy.Trimmer)]
public static void Test ()
{
TwoOutRefs (out _publicMethodsField, out _publicPropertiesField);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ class TestType
{
}

#region InheritsFromType
class InheritsFromType : Type
{
public void MethodWithRefAndImplicitThis ([DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)] ref Type type1,
Expand Down Expand Up @@ -368,5 +369,6 @@ protected override bool IsPrimitiveImpl ()
throw new NotImplementedException ();
}
}
#endregion
}
}

0 comments on commit 833d2ea

Please sign in to comment.