diff --git a/external/cecil b/external/cecil index 2cd569a98964..1840b7410d37 160000 --- a/external/cecil +++ b/external/cecil @@ -1 +1 @@ -Subproject commit 2cd569a98964629b8fa88284a8b5af8077d5f9de +Subproject commit 1840b7410d37a613e684b6f9650e39e2d4950bbb diff --git a/test/Mono.Linker.Tests.Cases/Attributes/GenericAttributes.cs b/test/Mono.Linker.Tests.Cases/Attributes/GenericAttributes.cs new file mode 100644 index 000000000000..430fbc71417d --- /dev/null +++ b/test/Mono.Linker.Tests.Cases/Attributes/GenericAttributes.cs @@ -0,0 +1,69 @@ +using System; +using Mono.Linker.Tests.Cases.Expectations.Assertions; +using Mono.Linker.Tests.Cases.Expectations.Metadata; + +namespace Mono.Linker.Tests.Cases.Attributes +{ + class GenericAttributes + { + static void Main () + { + new WithGenericAttribute_OfString (); + new WithGenericAttribute_OfInt (); + new WithConstrainedGenericAttribute (); + } + + [Kept] + [KeptAttributeAttribute (typeof (GenericAttribute))] + [KeptMember (".ctor()")] + [GenericAttribute("t", F = "f", P = "p")] + class WithGenericAttribute_OfString { + } + + [Kept] + [KeptAttributeAttribute (typeof (GenericAttribute))] + [KeptMember (".ctor()")] + [GenericAttribute(1, F = 2, P = 3)] + class WithGenericAttribute_OfInt { + } + + [Kept] + [KeptAttributeAttribute (typeof (ConstrainedGenericAttribute))] + [KeptMember (".ctor()")] + [ConstrainedGenericAttribute()] + class WithConstrainedGenericAttribute { + } + + [KeptBaseType (typeof (Attribute))] + class GenericAttribute : Attribute { + [Kept] + public GenericAttribute(T t) {} + + [Kept] + public T F; + + [Kept] + [KeptBackingField] + public T P { + get; + [Kept] + set; + } + } + + [Kept] + class ConstraintType { + } + + [KeptBaseType (typeof (ConstraintType))] + class DerivedFromConstraintType : ConstraintType { + } + + [KeptBaseType (typeof (Attribute))] + class ConstrainedGenericAttribute : Attribute + where T : ConstraintType { + [Kept] + public ConstrainedGenericAttribute() {} + } + } +} \ No newline at end of file