454cdc53f8b500b52da83eb6f1d07b5795694ff5
[platform/upstream/coreclr.git] /
1 // Licensed to the .NET Foundation under one or more agreements.
2 // The .NET Foundation licenses this file to you under the MIT license.
3 // See the LICENSE file in the project root for more information.
4
5 .assembly extern mscorlib{}
6 .assembly extern types{}
7
8 .assembly Method_ClassConstraint_Neg {}
9
10
11
12 .class public auto ansi beforefieldinit B
13          extends [mscorlib]System.Object
14 {
15
16     // Generic method with class() constraint
17     .method public hidebysig instance void 
18             method1<class T>() cil managed
19     {
20       .maxstack  8
21       ret
22     }
23
24     .method public hidebysig specialname rtspecialname 
25             instance void  .ctor() cil managed
26     {
27       .maxstack  8
28       ldarg.0
29       call       instance void [mscorlib]System.Object::.ctor()
30       ret
31     } 
32
33
34 .class public auto ansi beforefieldinit M_ClassConstraint 
35          extends [mscorlib]System.Object
36 {
37
38   // NEGATIVE TEST
39   // generic argument is a struct
40   .method public hidebysig static void Test3() cil managed
41   {
42     .maxstack  1
43     
44     newobj instance void class B::.ctor()
45     call instance void class B::method1<valuetype [types]NonGenStruct>()
46     ret
47   }
48
49
50   // NEGATIVE TEST
51   // generic argument is an enum with no default ctor
52   .method public hidebysig static void Test8() cil managed
53   {
54     .maxstack  1
55
56     newobj instance void class B::.ctor()
57     call instance void class B::method1<valuetype [types]Enum1>()
58     ret
59   }
60
61 }
62
63 .class public auto ansi beforefieldinit M_ClassConstraintGenTypes 
64          extends [mscorlib]System.Object
65 {
66
67   // NEGATIVE TEST
68   // generic argument is a struct 
69   .method public hidebysig static void Test3() cil managed
70   {
71     .maxstack  1
72    
73     newobj instance void class B::.ctor()
74     call instance void class B::method1<valuetype [types]GenStruct<int32>>()
75
76     ret
77   }
78
79   // NEGATIVE TEST
80   // generic argument is NUllable<T>
81   .method public hidebysig static void Test6() cil managed
82   {
83     .maxstack  1
84
85     newobj instance void class B::.ctor()
86     call instance void class B::method1<valuetype [mscorlib]System.'Nullable`1'<int32>>()
87
88     ret
89   }
90
91 }
92
93