1 // Test runtime custom modifier behavior.
3 // Roslyn expects custom modifiers to append together when a generic type is
6 // For example, if a method has the signature
7 // .method public hidebysig virtual instance void Method (!0 modopt(Foo))
8 // and the type is instantiated with int32 modopt (Bar)
9 // the result should be a method with a signature
10 // .method public hidebysig virtual instance void Method (int32 modopt(Foo) modopt(Bar))
12 .assembly extern mscorlib { }
13 .assembly 'custom-modifiers-append.1' { }
17 .method public hidebysig specialname rtspecialname instance void .ctor()
20 call instance void object::.ctor()
27 .method public hidebysig specialname rtspecialname instance void .ctor()
30 call instance void object::.ctor()
36 .class public BaseClass`1<T1> extends [mscorlib]System.Object
38 .method public hidebysig specialname rtspecialname instance void .ctor()
41 call instance void object::.ctor()
45 .method public newslot virtual instance int32 TestMethod(!T1 modopt(Foo))
47 ldstr "In BaseClass::TestMethod (T1 modopt(Foo))"
48 call void class [mscorlib]System.Console::WriteLine(string)
53 .method public newslot virtual instance int32 TestMethod(!T1)
55 ldstr "In BaseClass::TestMethod (T1)"
56 call void class [mscorlib]System.Console::WriteLine(string)
62 .class public MidClass extends class BaseClass`1<int32 modopt(Bar)>
64 .method public hidebysig specialname rtspecialname instance void .ctor()
67 call instance void class BaseClass`1<int32 modopt(Bar)>::.ctor()
71 .method public hidebysig virtual instance int32 TestMethod(int32 modopt(Bar))
73 ldstr "In MidClass::TestMethod (int32 modopt(Bar))"
74 call void class [mscorlib]System.Console::WriteLine(string)
80 .class public LeafClass extends class MidClass
82 .method public hidebysig specialname rtspecialname instance void .ctor()
85 call instance void class MidClass::.ctor()
89 .method public hidebysig virtual instance int32 TestMethod(int32 modopt(Bar) modopt(Foo))
91 ldstr "In LeafClass::TestMethod (int32 modopt(Bar) modopt(Foo))"
92 call void class [mscorlib]System.Console::WriteLine(string)
98 .class public MainClass
100 .method public static hidebysig int32 Main()
103 .locals init (class BaseClass`1<int32> c)
105 call void class [mscorlib]System.Console::WriteLine(string)
106 newobj instance void class MidClass::.ctor()
110 // expect the call to BaseClass::TestMethod (T1 modopt(Foo))
111 callvirt instance int32 class BaseClass`1<int32>::TestMethod(!0 modopt(Foo))
119 newobj instance void class MidClass::.ctor()
123 // expect the call to MidClass::TestMethod (int32 modopt(Bar))
124 callvirt instance int32 class BaseClass`1<int32>::TestMethod(!0)
132 newobj instance void class LeafClass::.ctor()
136 // expect the call to LeafClass::TestMethod (int32 modopt(Bar) modopt(Foo))
137 callvirt instance int32 class BaseClass`1<int32>::TestMethod(!0 modopt(Foo))