Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds a test with two annotated out params for the same method. #2875

Merged
merged 3 commits into from
Aug 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions test/Mono.Linker.Tests.Cases/DataFlow/ByRefDataflow.cs
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
}
}