Skip to content
This repository was archived by the owner on Sep 25, 2026. It is now read-only.
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
2 changes: 1 addition & 1 deletion external/cecil
Submodule cecil updated from 2cd569 to 1840b7
69 changes: 69 additions & 0 deletions test/Mono.Linker.Tests.Cases/Attributes/GenericAttributes.cs
Original file line number Diff line number Diff line change
@@ -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<string>))]
[KeptMember (".ctor()")]
[GenericAttribute<string>("t", F = "f", P = "p")]
class WithGenericAttribute_OfString {
}

[Kept]
[KeptAttributeAttribute (typeof (GenericAttribute<int>))]
[KeptMember (".ctor()")]
[GenericAttribute<int>(1, F = 2, P = 3)]
class WithGenericAttribute_OfInt {
}

[Kept]
[KeptAttributeAttribute (typeof (ConstrainedGenericAttribute<DerivedFromConstraintType>))]
[KeptMember (".ctor()")]
[ConstrainedGenericAttribute<DerivedFromConstraintType>()]
class WithConstrainedGenericAttribute {
}

[KeptBaseType (typeof (Attribute))]
class GenericAttribute<T> : 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<T> : Attribute
where T : ConstraintType {
[Kept]
public ConstrainedGenericAttribute() {}
}
}
}