-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Add generic attribute tests * Update cecil
- Loading branch information
Showing
2 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
Submodule cecil
updated
from 2cd569 to 1840b7
69 changes: 69 additions & 0 deletions
69
test/Mono.Linker.Tests.Cases/Attributes/GenericAttributes.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() {} | ||
} | ||
} | ||
} |