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
path: root/test
diff options
context:
space:
mode:
authorVitek Karas <10670590+vitek-karas@users.noreply.github.com>2022-08-04 17:53:52 +0300
committerGitHub <noreply@github.com>2022-08-04 17:53:52 +0300
commit99f923341813d4f28eeb09191622cd2cc0b8a32d (patch)
treefd58503c034cef55bcdb10ceafe45fb3cd9acc86 /test
parent0d139ecad14861b7fbfa31fa4ec73f5f00750dde (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.cs37
-rw-r--r--test/Mono.Linker.Tests.Cases/DataFlow/MethodByRefParameterDataFlow.cs2
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
}
}