diff options
author | Vitek Karas <10670590+vitek-karas@users.noreply.github.com> | 2022-08-04 17:53:52 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-04 17:53:52 +0300 |
commit | 99f923341813d4f28eeb09191622cd2cc0b8a32d (patch) | |
tree | fd58503c034cef55bcdb10ceafe45fb3cd9acc86 /test | |
parent | 0d139ecad14861b7fbfa31fa4ec73f5f00750dde (diff) |
Adds a test with two annotated out params for the same method. (#2875)
Test for https://github.com/dotnet/linker/issues/2874.
Diffstat (limited to 'test')
-rw-r--r-- | test/Mono.Linker.Tests.Cases/DataFlow/ByRefDataflow.cs | 37 | ||||
-rw-r--r-- | test/Mono.Linker.Tests.Cases/DataFlow/MethodByRefParameterDataFlow.cs | 2 |
2 files changed, 39 insertions, 0 deletions
diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/ByRefDataflow.cs b/test/Mono.Linker.Tests.Cases/DataFlow/ByRefDataflow.cs index 72fcf8236..f5df5af81 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/ByRefDataflow.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/ByRefDataflow.cs @@ -34,6 +34,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow PassRefToParameter (null); PointerDereference.Test (); + MultipleOutRefsToField.Test (); } [Kept] @@ -150,5 +151,41 @@ namespace Mono.Linker.Tests.Cases.DataFlow 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); + } + } } } diff --git a/test/Mono.Linker.Tests.Cases/DataFlow/MethodByRefParameterDataFlow.cs b/test/Mono.Linker.Tests.Cases/DataFlow/MethodByRefParameterDataFlow.cs index 08e251d3f..27dda5a8c 100644 --- a/test/Mono.Linker.Tests.Cases/DataFlow/MethodByRefParameterDataFlow.cs +++ b/test/Mono.Linker.Tests.Cases/DataFlow/MethodByRefParameterDataFlow.cs @@ -190,6 +190,7 @@ namespace Mono.Linker.Tests.Cases.DataFlow { } + #region InheritsFromType class InheritsFromType : Type { public void MethodWithRefAndImplicitThis ([DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicMethods)] ref Type type1, @@ -368,5 +369,6 @@ namespace Mono.Linker.Tests.Cases.DataFlow throw new NotImplementedException (); } } + #endregion } } |