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.
5 .assembly extern mscorlib { }
6 .assembly constrained2 { }
8 .class interface private abstract auto ansi IAdder`1<T>
10 .method public hidebysig newslot abstract virtual instance int32 Add(int32)
14 .method public hidebysig newslot virtual instance int32 PlusPlus()
16 ldstr "IAdder`1<T>:PlusPlus"
17 call void [mscorlib]System.Console::WriteLine(string)
21 callvirt instance int32 class IAdder`1<!0>::Add(int32)
26 .class value Adder`1<T> implements class IAdder`1<!T>, class IAdder`1<class [mscorlib]System.String>
28 .field private int32 _field
30 .method public hidebysig newslot virtual instance int32 Add(int32) cil managed
34 ldfld int32 valuetype Adder`1<!T>::_field
37 stfld int32 valuetype Adder`1<!T>::_field
39 ldfld int32 valuetype Adder`1<!T>::_field
43 .method private hidebysig newslot virtual instance int32 'IAdder<System.String>.PlusPlus'()
45 .override method instance int32 class IAdder`1<class [mscorlib]System.String>::PlusPlus()
47 ldstr "Adder`1<T>:'IAdder<System.String>.PlusPlus'"
48 call void [mscorlib]System.Console::WriteLine(string)
52 call instance int32 valuetype Adder`1<!T>::Add(int32)
57 .method public hidebysig static int32 Check<(class IAdder`1<!!U>, class IAdder`1<string>) T,U>(!!T t)
59 // The constrained calls below may or may not box for a valuetype T
60 // depending on whether IAdder`1<!!U>::PlusPlus() ends up calling
61 // the default implementation of the interface method.
65 callvirt instance int32 class IAdder`1<string>::PlusPlus()
68 callvirt instance int32 class IAdder`1<string>::PlusPlus()
73 callvirt instance int32 class IAdder`1<!!U>::PlusPlus()
76 callvirt instance int32 class IAdder`1<!!U>::PlusPlus()
84 .method public hidebysig static int32 Main()
89 valuetype Adder`1<object>,
93 // This will end up calling the implementation of IAdder<string>.PlusPlus
94 // provided by the Adder valuetype.
95 // The sum returned by the Check method will be 2+4+6+8 = 20.
97 call int32 Check<valuetype Adder`1<object>,string>(!!0)
107 // This will end up calling the implementation of IAdder<object>.PlusPlus
108 // provided by the default interface method.
109 // The sum returned by the Check method will be 1+1+2+4 = 8.
111 // This requires a runtime that can generate boxing stubs. We will support
112 // both the case when this is not supported, and when it's implemented.
119 initobj valuetype Adder`1<object>
121 call int32 Check<valuetype Adder`1<object>,object>(!!0)
124 ldstr "Runtime supports lookups with runtime determined boxing"
125 call void [mscorlib]System.Console::WriteLine(string)
127 leave AfterBoxingCall
129 catch [mscorlib]System.Exception
132 leave AfterFailedBoxingCall
135 AfterFailedBoxingCall:
136 ldstr "Runtime does not support lookups with runtime determined boxing"
137 call void [mscorlib]System.Console::WriteLine(string)