diff options
author | Marek Safar <marek.safar@gmail.com> | 2019-09-20 17:51:44 +0300 |
---|---|---|
committer | Marek Safar <marek.safar@gmail.com> | 2019-09-23 20:23:03 +0300 |
commit | c0b569a81e7e98113c5e52722ecd417e1b916f78 (patch) | |
tree | 6fb9fe4b5b05a6f0f4ee5a1efa90baf4272e7143 /test | |
parent | b1f6390fb9d83d2d6caa151ef9ffa26503770cf2 (diff) |
Update CustomAttributes scope also for assemblies which are copied
only in case any of their dependencies was removed
Follow up fix for #737
Diffstat (limited to 'test')
-rw-r--r-- | test/Mono.Linker.Tests.Cases/TypeForwarding/AttributeArgumentForwardedWithCopyAction.cs | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/test/Mono.Linker.Tests.Cases/TypeForwarding/AttributeArgumentForwardedWithCopyAction.cs b/test/Mono.Linker.Tests.Cases/TypeForwarding/AttributeArgumentForwardedWithCopyAction.cs new file mode 100644 index 000000000..6ee82d650 --- /dev/null +++ b/test/Mono.Linker.Tests.Cases/TypeForwarding/AttributeArgumentForwardedWithCopyAction.cs @@ -0,0 +1,98 @@ +using System; +using Mono.Linker.Tests.Cases.Expectations.Assertions; +using Mono.Linker.Tests.Cases.Expectations.Metadata; +using Mono.Linker.Tests.Cases.TypeForwarding.Dependencies; + +namespace Mono.Linker.Tests.Cases.TypeForwarding +{ + // Actions: + // link - Forwarder.dll and Implementation.dll + // copy - this (test.dll) assembly + + [SetupLinkerUserAction ("link")] + [SetupLinkerAction ("copy", "test")] + [KeepTypeForwarderOnlyAssemblies ("false")] + + [SetupCompileBefore ("Forwarder.dll", new[] { "Dependencies/ReferenceImplementationLibrary.cs" }, defines: new[] { "INCLUDE_REFERENCE_IMPL" })] + + // After compiling the test case we then replace the reference impl with implementation + type forwarder + [SetupCompileAfter ("Implementation.dll", new[] { "Dependencies/ImplementationLibrary.cs" })] + [SetupCompileAfter ("Forwarder.dll", new[] { "Dependencies/ForwarderLibrary.cs" }, references: new[] { "Implementation.dll" })] + + [RemovedAssembly ("Forwarder.dll")] + [KeptMemberInAssembly ("Implementation.dll", typeof (ImplementationLibrary))] + static class AttributeArgumentForwardedWithCopyAction + { + static void Main() + { + Test_1 (); + } + + [Kept] + [KeptAttributeAttribute (typeof (TestType2Attribute))] + [TestType2 (typeof (ImplementationLibrary))] + public static void Test_1 () + { + } + + [Kept] + [KeptAttributeAttribute (typeof (TestType2Attribute))] + [TestType2 (typeof (ImplementationLibrary[,][]))] + public static void Test_1b () + { + } + + [Kept] + [KeptAttributeAttribute (typeof (TestType2Attribute))] + [TestType2 (typeof (ImplementationLibrary [,] []))] + public static void Test_1c () + { + } + + [Kept] + [KeptAttributeAttribute (typeof (TestType2Attribute))] + [TestType2 (TestProperty = new object [] { typeof (ImplementationLibrary) })] + public static void Test_2 () + { + } + + [Kept] + [KeptAttributeAttribute (typeof (TestType2Attribute))] + [TestType2 (TestField = typeof (SomeGenericType2<ImplementationLibrary[]>))] + public static void Test_3 () + { + } + + + [Kept] + [KeptAttributeAttribute (typeof (TestType2Attribute))] + [TestType2 (TestField = typeof (SomeGenericType2<>))] + public static void Test_3a () + { + } + } + + [KeptBaseType (typeof (Attribute))] + public class TestType2Attribute : Attribute { + [Kept] + public TestType2Attribute () + { + } + + [Kept] + public TestType2Attribute (Type arg) + { + } + + [KeptBackingField] + [Kept] + public object TestProperty { [Kept] get; [Kept] set; } + + [Kept] + public object TestField; + } + + [Kept] + static class SomeGenericType2<T> { + } +} |