+2008-04-10 Mark Probst <mark.probst@gmail.com>
+
+ * generic-box.2.cs, generic-boxing.2.il, generic-delegate.2.cs,
+ generic-ldobj.2.il, generic-ldtoken.2.il,
+ generic-ldtoken-field.2.il, generic-ldtoken-method.2.il,
+ generic-mkrefany.2.il, generic-sizeof.2.cs, generic-tailcall.2.il,
+ generic-unbox.2.cs, generic-unboxing.2.il, generic-virtual.2.cs,
+ generics-sharing.2.cs: New test cases for generic sharing.
+
+ * Makefile.am: Added tests.
+
2008-03-31 Mark Probst <mark.probst@gmail.com>
* Makefile.am: Re-enabled CoreCLR security tests. Fixes #362626.
shared-generic-synchronized.2.cs \
generic-inlining.2.cs \
generic-initobj.2.cs \
- generic-box.2.cs \
+ generic-delegate.2.cs \
+ generic-sizeof.2.cs \
+ generic-virtual.2.cs \
recursive-generics.2.cs \
bug-80392.2.cs \
dynamic-method-access.2.cs \
resolve_method_bug.2.il \
resolve_field_bug.2.il \
resolve_type_bug.2.il \
- generics-sharing-other-exc.2.il
+ generics-sharing-other-exc.2.il \
+ generic-sizeof.2.il \
+ generic-ldobj.2.il \
+ generic-mkrefany.2.il \
+ generic-ldtoken.2.il \
+ generic-ldtoken-method.2.il \
+ generic-ldtoken-field.2.il \
+ generic-tailcall.2.il
# bug-318677.il
$(RUNTIME21) --security=core-clr-test coreclr-security.exe
endif
+generic-unboxing.2.dll : generic-unboxing.2.il
+ $(ILASM) /dll /output:generic-unboxing.2.dll $(srcdir)/generic-unboxing.2.il
+
+generic-boxing.2.dll : generic-boxing.2.il generic-unboxing.2.dll
+ $(ILASM) /dll /output:generic-boxing.2.dll $(srcdir)/generic-boxing.2.il
+
+generic-unbox.2.exe : generic-unbox.2.cs generic-unboxing.2.dll
+ $(MCS) -r:generic-unboxing.2.dll $(srcdir)/generic-unbox.2.cs
+
+generic-box.2.exe : generic-box.2.cs generic-unboxing.2.dll generic-boxing.2.dll
+ $(MCS) -r:generic-unboxing.2.dll,generic-boxing.2.dll $(srcdir)/generic-box.2.cs
+
test-generic-sharing : generics-sharing.2.exe shared-generic-methods.2.exe \
shared-generic-synchronized.2.exe generic-initobj.2.exe \
- generics-sharing-other-exc.2.exe generic-box.2.exe
- $(RUNTIME) -O=gshared generics-sharing.2.exe
- $(RUNTIME) -O=gshared,-inline shared-generic-methods.2.exe
- $(RUNTIME) -O=gshared shared-generic-synchronized.2.exe
- $(RUNTIME) -O=gshared,-inline generic-initobj.2.exe
- $(RUNTIME) -O=gshared,-inline generic-box.2.exe
- $(RUNTIME) -O=gshared,-inline generics-sharing-other-exc.2.exe
+ generics-sharing-other-exc.2.exe generic-box.2.exe \
+ generic-unbox.2.exe generic-delegate.2.exe generic-sizeof.2.exe \
+ generic-ldobj.2.exe generic-mkrefany.2.exe \
+ generic-ldtoken.2.exe \
+ generic-ldtoken-method.2.exe generic-ldtoken-field.2.exe \
+ generic-virtual.2.exe generic-tailcall.2.exe
+ $(RUNTIME) -O=gshared,-inline generics-sharing.2.exe
+ $(RUNTIME) -O=gshared,-inline shared-generic-methods.2.exe
+ $(RUNTIME) -O=gshared,-inline shared-generic-synchronized.2.exe
+ $(RUNTIME) -O=gshared,-inline generic-initobj.2.exe
+ $(RUNTIME) -O=gshared,-inline generic-box.2.exe
+ $(RUNTIME) -O=gshared,-inline generics-sharing-other-exc.2.exe
+ $(RUNTIME) -O=gshared,-inline generic-unbox.2.exe
+ $(RUNTIME) -O=gshared,-inline generic-delegate.2.exe
+ $(RUNTIME) -O=gshared,-inline generic-sizeof.2.exe
+ $(RUNTIME) -O=gshared,-inline generic-ldobj.2.exe
+ $(RUNTIME) -O=gshared,-inline generic-mkrefany.2.exe
+ $(RUNTIME) -O=gshared,-inline generic-ldtoken.2.exe
+ $(RUNTIME) -O=gshared,-inline generic-ldtoken-method.2.exe
+ $(RUNTIME) -O=gshared,-inline generic-ldtoken-field.2.exe
+ $(RUNTIME) -O=gshared,-inline generic-virtual.2.exe
+ $(RUNTIME) -O=gshared,-inline generic-tailcall.2.exe
EXTRA_DIST += async-exceptions.cs
async-exceptions.exe : async-exceptions.cs
using System.Collections.Generic;
+using UnboxTest;
+using BoxTest;
public class ClassA {}
return 1;
*/
+ UnboxerStruct<ClassA> us;
+ Boxer<ClassA> b = new Boxer<ClassA> ();
+
+ us.field = 123;
+
+ if (((UnboxerStruct<ClassA>?)b.boxNullable (us)).Value.field != 123)
+ return 1;
+ if (b.boxNullable (null) != null)
+ return 1;
+
return 0;
}
}
--- /dev/null
+.assembly extern mscorlib
+{
+ .ver 2:0:0:0
+ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
+}
+.assembly extern 'generic-unboxing.2'
+{
+ .ver 0:0:0:0
+}
+.assembly 'generic-boxing.2'
+{
+ .custom instance void class [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::'.ctor'() = (
+ 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
+ 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
+
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.module 'generic-boxing.2.dll' // GUID = {9C29868F-7AD1-40CC-BBDC-DF985AB656FC}
+
+
+.namespace BoxTest
+{
+ .class public auto ansi beforefieldinit Boxer`1<T>
+ extends [mscorlib]System.Object
+ {
+
+ // method line 1
+ .method public hidebysig specialname rtspecialname
+ instance default void '.ctor' () cil managed
+ {
+ // Method begins at RVA 0x20ec
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void object::'.ctor'()
+ IL_0006: ret
+ } // end of method Boxer`1::.ctor
+
+ // method line 2
+ .method public hidebysig
+ instance default object boxNullable (valuetype [mscorlib]System.Nullable`1<valuetype ['generic-unboxing.2']UnboxTest.UnboxerStruct`1<!T>> us) cil managed
+ {
+ // Method begins at RVA 0x20f4
+ // Code size 15 (0xf)
+ .maxstack 8
+ IL_0000: ldarg.1
+ // IL_0004: call instance !0 valuetype [mscorlib]System.Nullable`1<valuetype ['generic-unboxing.2']UnboxTest.UnboxerStruct`1<!T>>::get_Value()
+ IL_0009: box valuetype [mscorlib]System.Nullable`1<valuetype ['generic-unboxing.2']UnboxTest.UnboxerStruct`1<!T>>
+ IL_000e: ret
+ } // end of method Boxer`1::boxNullable
+
+ } // end of class BoxTest.Boxer`1
+}
+
--- /dev/null
+public class ClassA {}
+
+public delegate int IntDelegate (int x);
+public delegate T[] TDelegate<T> ();
+
+public class Gen<T> {
+ public int intFunction (int x) {
+ return x + 1;
+ }
+
+ public IntDelegate getIntDelegate () {
+ return intFunction;
+ }
+
+ public virtual int virtIntFunction (int x) {
+ return x + 2;
+ }
+
+ public IntDelegate getVirtIntDelegate () {
+ return virtIntFunction;
+ }
+
+ public T[] tFunction () {
+ return new T[3];
+ }
+
+ public TDelegate<T> getTDelegate () {
+ return tFunction;
+ }
+
+ public static T[] staticTFunction () {
+ return new T[3];
+ }
+
+ public TDelegate<T> getStaticTDelegate () {
+ return staticTFunction;
+ }
+}
+
+public class main {
+ public static int Main () {
+ Gen<ClassA> ga = new Gen<ClassA> ();
+ IntDelegate id = ga.getIntDelegate ();
+ TDelegate<ClassA> tda = ga.getTDelegate ();
+ IntDelegate vid = ga.getVirtIntDelegate ();
+ TDelegate<ClassA> stda = ga.getStaticTDelegate ();
+
+ if (id (123) != 124)
+ return 1;
+ if (tda ().GetType () != typeof (ClassA[]))
+ return 1;
+ if (vid (123) != 125)
+ return 1;
+ if (stda ().GetType () != typeof (ClassA[]))
+ return 1;
+ return 0;
+ }
+}
--- /dev/null
+.assembly extern mscorlib
+{
+ .ver 2:0:0:0
+ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
+}
+.assembly 'generic-mkrefany.2'
+{
+ .custom instance void class [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::'.ctor'() = (
+ 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
+ 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
+
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.module 'generic-mkrefany.2.exe' // GUID = {51FFBB77-6AFB-435E-B206-16DB5C8A3730}
+
+
+ .class public auto ansi beforefieldinit ClassA
+ extends [mscorlib]System.Object
+ {
+
+ // method line 1
+ .method public hidebysig specialname rtspecialname
+ instance default void '.ctor' () cil managed
+ {
+ // Method begins at RVA 0x20ec
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void object::'.ctor'()
+ IL_0006: ret
+ } // end of method ClassA::.ctor
+
+ } // end of class ClassA
+
+ .class public sequential ansi sealed beforefieldinit GenStruct`1<T>
+ extends [mscorlib]System.ValueType
+ {
+ .field public int32 field1
+ .field public !0 field2
+
+ } // end of class GenStruct`1
+
+ .class public auto ansi beforefieldinit Gen`1<T>
+ extends [mscorlib]System.Object
+ {
+
+ // method line 2
+ .method public hidebysig specialname rtspecialname
+ instance default void '.ctor' () cil managed
+ {
+ // Method begins at RVA 0x20f4
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void object::'.ctor'()
+ IL_0006: ret
+ } // end of method Gen`1::.ctor
+
+ // method line 3
+ .method public hidebysig
+ instance default !T ident (!T t) cil managed
+ {
+ // Method begins at RVA 0x20fc
+ // Code size 4 (0x4)
+ .maxstack 1
+ .locals init (
+ !T V_0)
+ IL_0000: ldarg.1
+ IL_0001: stloc.0
+ ldloca 0
+ ldobj !0
+ IL_0003: ret
+ } // end of method Gen`1::ident
+
+ // method line 4
+ .method public hidebysig
+ instance default valuetype GenStruct`1<!T> structIdent (valuetype GenStruct`1<!T> gst) cil managed
+ {
+ // Method begins at RVA 0x210c
+ // Code size 4 (0x4)
+ .maxstack 1
+ .locals init (
+ valuetype GenStruct`1<!T> V_0)
+ IL_0000: ldarg.1
+ IL_0001: stloc.0
+ ldloca 0
+ ldobj valuetype GenStruct`1<!0>
+ IL_0003: ret
+ } // end of method Gen`1::structIdent
+
+ } // end of class Gen`1
+
+ .class public auto ansi beforefieldinit main
+ extends [mscorlib]System.Object
+ {
+
+ // method line 5
+ .method public hidebysig specialname rtspecialname
+ instance default void '.ctor' () cil managed
+ {
+ // Method begins at RVA 0x211c
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void object::'.ctor'()
+ IL_0006: ret
+ } // end of method main::.ctor
+
+ // method line 6
+ .method public static hidebysig
+ default int32 Main () cil managed
+ {
+ // Method begins at RVA 0x2124
+ .entrypoint
+ // Code size 94 (0x5e)
+ .maxstack 8
+ .locals init (
+ class ClassA V_0,
+ valuetype GenStruct`1<class ClassA> V_1,
+ class Gen`1<class ClassA> V_2,
+ valuetype GenStruct`1<class ClassA> V_3)
+ IL_0000: newobj instance void class ClassA::'.ctor'()
+ IL_0005: stloc.0
+ IL_0006: ldloca.s 1
+ IL_0008: ldc.i4.s 0x7b
+ IL_000a: stfld int32 valuetype GenStruct`1<class ClassA>::field1
+ IL_000f: ldloca.s 1
+ IL_0011: ldloc.0
+ IL_0012: stfld !0 valuetype GenStruct`1<class ClassA>::field2
+ IL_0017: newobj instance void class Gen`1<class ClassA>::'.ctor'()
+ IL_001c: stloc.2
+ IL_001d: ldloc.2
+ IL_001e: ldloc.0
+ IL_001f: callvirt instance !0 class Gen`1<class ClassA>::ident(!0)
+ IL_0024: ldloc.0
+ IL_0025: beq IL_002c
+
+ IL_002a: ldc.i4.1
+ IL_002b: ret
+ IL_002c: ldloc.2
+ IL_002d: ldloc.1
+ IL_002e: callvirt instance valuetype GenStruct`1<!0> class Gen`1<class ClassA>::structIdent(valuetype GenStruct`1<!0>)
+ IL_0033: stloc.3
+ IL_0034: ldloca.s 3
+ IL_0036: ldfld int32 valuetype GenStruct`1<class ClassA>::field1
+ IL_003b: ldloca.s 1
+ IL_003d: ldfld int32 valuetype GenStruct`1<class ClassA>::field1
+ IL_0042: bne.un IL_005a
+
+ IL_0047: ldloca.s 3
+ IL_0049: ldfld !0 valuetype GenStruct`1<class ClassA>::field2
+ IL_004e: ldloca.s 1
+ IL_0050: ldfld !0 valuetype GenStruct`1<class ClassA>::field2
+ IL_0055: beq IL_005c
+
+ IL_005a: ldc.i4.1
+ IL_005b: ret
+ IL_005c: ldc.i4.0
+ IL_005d: ret
+ } // end of method main::Main
+
+ } // end of class main
+
--- /dev/null
+.assembly extern mscorlib
+{
+ .ver 2:0:0:0
+ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
+}
+.assembly 'generic-ldtoken.2'
+{
+ .custom instance void class [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::'.ctor'() = (
+ 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
+ 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
+
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.module 'generic-ldtoken.2.exe' // GUID = {816E886F-1485-43E8-AC46-501D301BC67A}
+
+
+ .class public auto ansi beforefieldinit ClassA
+ extends [mscorlib]System.Object
+ {
+
+ // method line 1
+ .method public hidebysig specialname rtspecialname
+ instance default void '.ctor' () cil managed
+ {
+ // Method begins at RVA 0x20ec
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void object::'.ctor'()
+ IL_0006: ret
+ } // end of method ClassA::.ctor
+
+ } // end of class ClassA
+
+ .class public auto ansi beforefieldinit Gen`1<T>
+ extends [mscorlib]System.Object
+ {
+
+ .field public static int32 myField
+
+ // method line 2
+ .method public hidebysig specialname rtspecialname
+ instance default void '.ctor' () cil managed
+ {
+ // Method begins at RVA 0x20f4
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void object::'.ctor'()
+ IL_0006: ret
+ } // end of method Gen`1::.ctor
+
+ .method public hidebysig instance default int32 checkEqual () cil managed
+ {
+ ldtoken field int32 class Gen`1<!T>::myField
+ call [mscorlib]System.Reflection.FieldInfo [mscorlib]System.Reflection.FieldInfo::GetFieldFromHandle ([mscorlib]System.RuntimeFieldHandle)
+ ldtoken field int32 class Gen`1<class ClassA>::myField
+ call [mscorlib]System.Reflection.FieldInfo [mscorlib]System.Reflection.FieldInfo::GetFieldFromHandle ([mscorlib]System.RuntimeFieldHandle)
+ ceq
+ ret
+ }
+
+ } // end of class Gen`1
+
+ .class public auto ansi beforefieldinit main
+ extends [mscorlib]System.Object
+ {
+
+ // method line 5
+ .method public hidebysig specialname rtspecialname
+ instance default void '.ctor' () cil managed
+ {
+ // Method begins at RVA 0x2114
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void object::'.ctor'()
+ IL_0006: ret
+ } // end of method main::.ctor
+
+ // method line 6
+ .method public static hidebysig
+ default int32 Main () cil managed
+ {
+ // Method begins at RVA 0x211c
+ .entrypoint
+ // Code size 54 (0x36)
+ .maxstack 9
+ .locals init (
+ class Gen`1<class ClassA> V_0)
+ ldc.i4.1
+ IL_0000: newobj instance void class Gen`1<class ClassA>::'.ctor'()
+ callvirt instance int32 class Gen`1<class ClassA>::checkEqual()
+ sub
+ IL_0035: ret
+ } // end of method main::Main
+
+ } // end of class main
+
--- /dev/null
+.assembly extern mscorlib
+{
+ .ver 2:0:0:0
+ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
+}
+.assembly 'generic-ldtoken.2'
+{
+ .custom instance void class [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::'.ctor'() = (
+ 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
+ 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
+
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.module 'generic-ldtoken.2.exe' // GUID = {816E886F-1485-43E8-AC46-501D301BC67A}
+
+
+ .class public auto ansi beforefieldinit ClassA
+ extends [mscorlib]System.Object
+ {
+
+ // method line 1
+ .method public hidebysig specialname rtspecialname
+ instance default void '.ctor' () cil managed
+ {
+ // Method begins at RVA 0x20ec
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void object::'.ctor'()
+ IL_0006: ret
+ } // end of method ClassA::.ctor
+
+ } // end of class ClassA
+
+ .class public auto ansi beforefieldinit Gen`1<T>
+ extends [mscorlib]System.Object
+ {
+
+ // method line 2
+ .method public hidebysig specialname rtspecialname
+ instance default void '.ctor' () cil managed
+ {
+ // Method begins at RVA 0x20f4
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void object::'.ctor'()
+ IL_0006: ret
+ } // end of method Gen`1::.ctor
+
+ .method public hidebysig instance default int32 checkEqual () cil managed
+ {
+ ldtoken method instance int32 class Gen`1<!T>::checkEqual()
+ call [mscorlib]System.Reflection.MethodBase [mscorlib]System.Reflection.MethodBase::GetMethodFromHandle ([mscorlib]System.RuntimeMethodHandle)
+ ldtoken method instance int32 class Gen`1<class ClassA>::checkEqual ()
+ call [mscorlib]System.Reflection.MethodBase [mscorlib]System.Reflection.MethodBase::GetMethodFromHandle ([mscorlib]System.RuntimeMethodHandle)
+ // call instance int32 [mscorlib]System.RuntimeMethodHandle::Equals ([mscorlib]System.RuntimeMethodHandle)
+ ceq
+ ret
+ }
+
+ } // end of class Gen`1
+
+ .class public auto ansi beforefieldinit main
+ extends [mscorlib]System.Object
+ {
+
+ // method line 5
+ .method public hidebysig specialname rtspecialname
+ instance default void '.ctor' () cil managed
+ {
+ // Method begins at RVA 0x2114
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void object::'.ctor'()
+ IL_0006: ret
+ } // end of method main::.ctor
+
+ // method line 6
+ .method public static hidebysig
+ default int32 Main () cil managed
+ {
+ // Method begins at RVA 0x211c
+ .entrypoint
+ // Code size 54 (0x36)
+ .maxstack 9
+ .locals init (
+ class Gen`1<class ClassA> V_0)
+ ldc.i4.1
+ IL_0000: newobj instance void class Gen`1<class ClassA>::'.ctor'()
+ callvirt instance int32 class Gen`1<class ClassA>::checkEqual()
+ sub
+ IL_0035: ret
+ } // end of method main::Main
+
+ } // end of class main
+
--- /dev/null
+.assembly extern mscorlib
+{
+ .ver 2:0:0:0
+ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
+}
+.assembly 'generic-ldtoken.2'
+{
+ .custom instance void class [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::'.ctor'() = (
+ 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
+ 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
+
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.module 'generic-ldtoken.2.exe' // GUID = {816E886F-1485-43E8-AC46-501D301BC67A}
+
+
+ .class public auto ansi beforefieldinit ClassA
+ extends [mscorlib]System.Object
+ {
+
+ // method line 1
+ .method public hidebysig specialname rtspecialname
+ instance default void '.ctor' () cil managed
+ {
+ // Method begins at RVA 0x20ec
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void object::'.ctor'()
+ IL_0006: ret
+ } // end of method ClassA::.ctor
+
+ } // end of class ClassA
+
+ .class public auto ansi beforefieldinit Gen`1<T>
+ extends [mscorlib]System.Object
+ {
+
+ // method line 2
+ .method public hidebysig specialname rtspecialname
+ instance default void '.ctor' () cil managed
+ {
+ // Method begins at RVA 0x20f4
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void object::'.ctor'()
+ IL_0006: ret
+ } // end of method Gen`1::.ctor
+
+ // method line 3
+ .method public hidebysig
+ instance default class [mscorlib]System.Type typeOfT () cil managed
+ {
+ // Method begins at RVA 0x20fc
+ // Code size 11 (0xb)
+ .maxstack 8
+ IL_0000: ldtoken !T
+ nop
+ IL_0005: call class [mscorlib]System.Type class [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
+ IL_000a: ret
+ } // end of method Gen`1::typeOfT
+
+ // method line 4
+ .method public hidebysig
+ instance default class [mscorlib]System.Type typeOfGenT () cil managed
+ {
+ // Method begins at RVA 0x2108
+ // Code size 11 (0xb)
+ .maxstack 8
+ IL_0000: ldtoken class Gen`1<!T>
+ nop
+ IL_0005: call class [mscorlib]System.Type class [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
+ IL_000a: ret
+ } // end of method Gen`1::typeOfGenT
+
+ } // end of class Gen`1
+
+ .class public auto ansi beforefieldinit main
+ extends [mscorlib]System.Object
+ {
+
+ // method line 5
+ .method public hidebysig specialname rtspecialname
+ instance default void '.ctor' () cil managed
+ {
+ // Method begins at RVA 0x2114
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void object::'.ctor'()
+ IL_0006: ret
+ } // end of method main::.ctor
+
+ // method line 6
+ .method public static hidebysig
+ default int32 Main () cil managed
+ {
+ // Method begins at RVA 0x211c
+ .entrypoint
+ // Code size 54 (0x36)
+ .maxstack 9
+ .locals init (
+ class Gen`1<class ClassA> V_0)
+ IL_0000: newobj instance void class Gen`1<class ClassA>::'.ctor'()
+ IL_0005: stloc.0
+ IL_0006: ldloc.0
+ IL_0007: callvirt instance class [mscorlib]System.Type class Gen`1<class ClassA>::typeOfT()
+ IL_000c: ldtoken ClassA
+ IL_0011: call class [mscorlib]System.Type class [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
+ IL_0016: beq IL_001d
+
+ IL_001b: ldc.i4.1
+ IL_001c: ret
+ IL_001d: ldloc.0
+ IL_001e: callvirt instance class [mscorlib]System.Type class Gen`1<class ClassA>::typeOfGenT()
+ IL_0023: ldtoken class Gen`1<class ClassA>
+ IL_0028: call class [mscorlib]System.Type class [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
+ IL_002d: beq IL_0034
+
+ IL_0032: ldc.i4.1
+ IL_0033: ret
+ IL_0034: ldc.i4.0
+ IL_0035: ret
+ } // end of method main::Main
+
+ } // end of class main
+
--- /dev/null
+.assembly extern mscorlib
+{
+ .ver 2:0:0:0
+ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
+}
+.assembly 'generic-mkrefany.2'
+{
+ .custom instance void class [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::'.ctor'() = (
+ 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
+ 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
+
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.module 'generic-mkrefany.2.exe' // GUID = {51FFBB77-6AFB-435E-B206-16DB5C8A3730}
+
+
+ .class public auto ansi beforefieldinit ClassA
+ extends [mscorlib]System.Object
+ {
+
+ // method line 1
+ .method public hidebysig specialname rtspecialname
+ instance default void '.ctor' () cil managed
+ {
+ // Method begins at RVA 0x20ec
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void object::'.ctor'()
+ IL_0006: ret
+ } // end of method ClassA::.ctor
+
+ } // end of class ClassA
+
+ .class public sequential ansi sealed beforefieldinit GenStruct`1<T>
+ extends [mscorlib]System.ValueType
+ {
+ .field public int32 field1
+ .field public !0 field2
+
+ } // end of class GenStruct`1
+
+ .class public auto ansi beforefieldinit Gen`1<T>
+ extends [mscorlib]System.Object
+ {
+
+ // method line 2
+ .method public hidebysig specialname rtspecialname
+ instance default void '.ctor' () cil managed
+ {
+ // Method begins at RVA 0x20f4
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void object::'.ctor'()
+ IL_0006: ret
+ } // end of method Gen`1::.ctor
+
+ // method line 3
+ .method public hidebysig
+ instance default !T ident (!T t) cil managed
+ {
+ // Method begins at RVA 0x20fc
+ // Code size 4 (0x4)
+ .maxstack 1
+ .locals init (
+ !T V_0)
+ IL_0000: ldarg.1
+ IL_0001: stloc.0
+ ldloca 0
+ mkrefany !0
+ refanyval ClassA
+ ldobj ClassA
+ IL_0003: ret
+ } // end of method Gen`1::ident
+
+ // method line 4
+ .method public hidebysig
+ instance default valuetype GenStruct`1<!T> structIdent (valuetype GenStruct`1<!T> gst) cil managed
+ {
+ // Method begins at RVA 0x210c
+ // Code size 4 (0x4)
+ .maxstack 1
+ .locals init (
+ valuetype GenStruct`1<!T> V_0)
+ IL_0000: ldarg.1
+ IL_0001: stloc.0
+ ldloca 0
+ mkrefany valuetype GenStruct`1<!0>
+ refanyval valuetype GenStruct`1<ClassA>
+ ldobj valuetype GenStruct`1<ClassA>
+ IL_0003: ret
+ } // end of method Gen`1::structIdent
+
+ } // end of class Gen`1
+
+ .class public auto ansi beforefieldinit main
+ extends [mscorlib]System.Object
+ {
+
+ // method line 5
+ .method public hidebysig specialname rtspecialname
+ instance default void '.ctor' () cil managed
+ {
+ // Method begins at RVA 0x211c
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void object::'.ctor'()
+ IL_0006: ret
+ } // end of method main::.ctor
+
+ // method line 6
+ .method public static hidebysig
+ default int32 Main () cil managed
+ {
+ // Method begins at RVA 0x2124
+ .entrypoint
+ // Code size 94 (0x5e)
+ .maxstack 8
+ .locals init (
+ class ClassA V_0,
+ valuetype GenStruct`1<class ClassA> V_1,
+ class Gen`1<class ClassA> V_2,
+ valuetype GenStruct`1<class ClassA> V_3)
+ IL_0000: newobj instance void class ClassA::'.ctor'()
+ IL_0005: stloc.0
+ IL_0006: ldloca.s 1
+ IL_0008: ldc.i4.s 0x7b
+ IL_000a: stfld int32 valuetype GenStruct`1<class ClassA>::field1
+ IL_000f: ldloca.s 1
+ IL_0011: ldloc.0
+ IL_0012: stfld !0 valuetype GenStruct`1<class ClassA>::field2
+ IL_0017: newobj instance void class Gen`1<class ClassA>::'.ctor'()
+ IL_001c: stloc.2
+ IL_001d: ldloc.2
+ IL_001e: ldloc.0
+ IL_001f: callvirt instance !0 class Gen`1<class ClassA>::ident(!0)
+ IL_0024: ldloc.0
+ IL_0025: beq IL_002c
+
+ IL_002a: ldc.i4.1
+ IL_002b: ret
+ IL_002c: ldloc.2
+ IL_002d: ldloc.1
+ IL_002e: callvirt instance valuetype GenStruct`1<!0> class Gen`1<class ClassA>::structIdent(valuetype GenStruct`1<!0>)
+ IL_0033: stloc.3
+ IL_0034: ldloca.s 3
+ IL_0036: ldfld int32 valuetype GenStruct`1<class ClassA>::field1
+ IL_003b: ldloca.s 1
+ IL_003d: ldfld int32 valuetype GenStruct`1<class ClassA>::field1
+ IL_0042: bne.un IL_005a
+
+ IL_0047: ldloca.s 3
+ IL_0049: ldfld !0 valuetype GenStruct`1<class ClassA>::field2
+ IL_004e: ldloca.s 1
+ IL_0050: ldfld !0 valuetype GenStruct`1<class ClassA>::field2
+ IL_0055: beq IL_005c
+
+ IL_005a: ldc.i4.1
+ IL_005b: ret
+ IL_005c: ldc.i4.0
+ IL_005d: ret
+ } // end of method main::Main
+
+ } // end of class main
+
--- /dev/null
+public class ClassA {}
+public struct GenStruct<T> {
+ int field1;
+ long field2;
+ T field3;
+}
+public struct Struct {
+ int field1;
+ long field2;
+ byte field3;
+}
+
+public class Gen<T> {
+ public unsafe int sizeofGenStructT () { return sizeof (Struct); }
+}
+
+public class main {
+ public static unsafe int Main () {
+ Gen<ClassA> ga = new Gen<ClassA> ();
+
+ if (ga.sizeofGenStructT () != sizeof (Struct))
+ return 1;
+
+ return 0;
+ }
+}
--- /dev/null
+.assembly extern mscorlib
+{
+ .ver 2:0:0:0
+ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
+}
+.assembly 'generic-tailcall.2'
+{
+ .custom instance void class [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::'.ctor'() = (
+ 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
+ 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
+
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.module 'generic-tailcall.2.exe' // GUID = {06726C6C-6C85-4737-B731-8585E31F7647}
+
+
+ .class public auto ansi beforefieldinit ClassA
+ extends [mscorlib]System.Object
+ {
+
+ // method line 1
+ .method public hidebysig specialname rtspecialname
+ instance default void '.ctor' () cil managed
+ {
+ // Method begins at RVA 0x20ec
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void object::'.ctor'()
+ IL_0006: ret
+ } // end of method ClassA::.ctor
+
+ } // end of class ClassA
+
+ .class public auto ansi beforefieldinit Gen`1<T>
+ extends [mscorlib]System.Object
+ {
+
+ // method line 2
+ .method public hidebysig specialname rtspecialname
+ instance default void '.ctor' () cil managed
+ {
+ // Method begins at RVA 0x20f4
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void object::'.ctor'()
+ IL_0006: ret
+ } // end of method Gen`1::.ctor
+
+ // method line 3
+ .method public hidebysig
+ instance default !T[] caller (int32 x) cil managed
+ {
+ // Method begins at RVA 0x20fc
+ // Code size 10 (0xa)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: ldarg.1
+ IL_0002: ldc.i4.1
+ IL_0003: add
+ IL_0004: tail. call instance !0[] class Gen`1<!T>::callee(int32)
+ IL_0009: ret
+ } // end of method Gen`1::caller
+
+ // method line 4
+ .method public hidebysig
+ instance default !T[] callee (int32 x) cil managed
+ {
+ // Method begins at RVA 0x2108
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.1
+ IL_0001: newarr !0
+ IL_0006: ret
+ } // end of method Gen`1::callee
+
+ } // end of class Gen`1
+
+ .class public auto ansi beforefieldinit main
+ extends [mscorlib]System.Object
+ {
+
+ // method line 5
+ .method public hidebysig specialname rtspecialname
+ instance default void '.ctor' () cil managed
+ {
+ // Method begins at RVA 0x2110
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void object::'.ctor'()
+ IL_0006: ret
+ } // end of method main::.ctor
+
+ // method line 6
+ .method public static hidebysig
+ default int32 Main () cil managed
+ {
+ // Method begins at RVA 0x2118
+ .entrypoint
+ // Code size 48 (0x30)
+ .maxstack 7
+ .locals init (
+ class Gen`1<class ClassA> V_0,
+ class ClassA[] V_1)
+ IL_0000: newobj instance void class Gen`1<class ClassA>::'.ctor'()
+ IL_0005: stloc.0
+ IL_0006: ldloc.0
+ IL_0007: ldc.i4.3
+ IL_0008: callvirt instance !0[] class Gen`1<class ClassA>::caller(int32)
+ IL_000d: stloc.1
+ IL_000e: ldloc.1
+ IL_000f: callvirt instance class [mscorlib]System.Type object::GetType()
+ IL_0014: ldtoken class ClassA[]
+ IL_0019: call class [mscorlib]System.Type class [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle)
+ IL_001e: bne.un IL_002c
+
+ IL_0023: ldloc.1
+ IL_0024: ldlen
+ IL_0025: conv.i4
+ IL_0026: ldc.i4.4
+ IL_0027: beq IL_002e
+
+ IL_002c: ldc.i4.1
+ IL_002d: ret
+ IL_002e: ldc.i4.0
+ IL_002f: ret
+ } // end of method main::Main
+
+ } // end of class main
+
--- /dev/null
+using UnboxTest;
+
+public class ClassA {};
+
+public class main {
+ public static int Main () {
+ UnboxerStruct<ClassA> us;
+ Unboxer<ClassA> u = new Unboxer<ClassA> ();
+
+ us.field = 123;
+
+ if (u.unbox ((object)us).field != 123)
+ return 1;
+ if (u.unboxNullable ((object)us).Value.field != 123)
+ return 1;
+ if (u.unboxNullable (null) != null)
+ return 1;
+ return 0;
+ }
+}
--- /dev/null
+.assembly extern mscorlib
+{
+ .ver 2:0:0:0
+ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
+}
+.assembly 'generic-unboxing.2'
+{
+ .custom instance void class [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::'.ctor'() = (
+ 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
+ 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
+
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.module 'generic-unboxing.2.dll' // GUID = {0285A5AB-E59B-4ED1-848C-3BB9C270CB7D}
+
+.namespace UnboxTest
+{
+ .class public sequential ansi sealed beforefieldinit UnboxerStruct`1<T>
+ extends [mscorlib]System.ValueType
+ {
+ .field public int32 'field'
+
+ } // end of class UnboxTest.UnboxerStruct`1
+}
+
+.namespace UnboxTest
+{
+ .class public auto ansi beforefieldinit Unboxer`1<T>
+ extends [mscorlib]System.Object
+ {
+
+ // method line 1
+ .method public hidebysig specialname rtspecialname
+ instance default void '.ctor' () cil managed
+ {
+ // Method begins at RVA 0x20ec
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void object::'.ctor'()
+ IL_0006: ret
+ } // end of method Unboxer`1::.ctor
+
+ // method line 2
+ .method public hidebysig
+ instance default valuetype [mscorlib]System.Nullable`1<valuetype UnboxTest.UnboxerStruct`1<!T>> 'unboxNullable' (object obj) cil managed
+ {
+ // Method begins at RVA 0x20f4
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.1
+ // IL_0001: unbox.any valuetype [mscorlib]System.Nullable`1<valuetype UnboxerStruct`1<!0>>
+ IL_0001: unbox valuetype [mscorlib]System.Nullable`1<valuetype UnboxTest.UnboxerStruct`1<!0>>
+ IL_0002: ldobj valuetype [mscorlib]System.Nullable`1<valuetype UnboxTest.UnboxerStruct`1<!0>>
+ IL_0006: ret
+ } // end of method Unboxer`1::unboxNullable
+
+ // method line 2
+ .method public hidebysig
+ instance default valuetype UnboxTest.UnboxerStruct`1<!T> 'unbox' (object obj) cil managed
+ {
+ // Method begins at RVA 0x20f4
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.1
+ IL_0001: unbox valuetype UnboxTest.UnboxerStruct`1<!0>
+ IL_0002: ldobj valuetype UnboxTest.UnboxerStruct`1<!0>
+ IL_0006: ret
+ } // end of method Unboxer`1::unbox
+
+ } // end of class Unboxer`1
+
+}
--- /dev/null
+using System;
+
+public class ClassA {}
+public class ClassB {}
+
+public class Gen<T> {
+ static bool checkArr<S> (Array arr, int length) {
+ if (arr.GetType () != typeof (S[]))
+ return false;
+ if (arr.Length != length)
+ return false;
+ return true;
+ }
+
+ public bool test () {
+ return checkArr<ClassB> (newArr<ClassB> (), myLength ());
+ }
+
+ public virtual int myLength () {
+ return 3;
+ }
+
+ public virtual S[] newArr<S> () {
+ return new S[3];
+ }
+}
+
+public class GenSub<T> : Gen<T> {
+ public override int myLength () {
+ return 4;
+ }
+
+ public override S[] newArr<S> () {
+ return new S[4];
+ }
+}
+
+public class GenSubSub : GenSub<ClassA> {
+ public override int myLength () {
+ return 5;
+ }
+
+ public override S[] newArr<S> () {
+ return new S[5];
+ }
+}
+
+public class main {
+ public static int Main () {
+ Gen<ClassA> ga = new Gen<ClassA> ();
+ Gen<ClassA> gsa = new GenSub<ClassA> ();
+ Gen<ClassA> gss = new GenSubSub ();
+
+ if (!ga.test ())
+ return 1;
+ if (!gsa.test ())
+ return 1;
+ if (!gss.test ())
+ return 1;
+ return 0;
+ }
+}
}
public struct GenStruct<T> {
+ public static int staticField;
+
public int field;
public int dummy1;
public int dummy2;
GenStruct<T> valueIMethod (int x);
}
+public class IGenImpl<T> : IGen<T> {
+ public int field;
+
+ public T[] iMethod () {
+ return new T[3];
+ }
+
+ public void voidIMethod (int x) {
+ field = x;
+ }
+
+ public long longIMethod (long x) {
+ return x + 1;
+ }
+
+ public float floatIMethod () {
+ return 1.0f;
+ }
+
+ public GenStruct<T> valueIMethod (int x) {
+ return new GenStruct<T> (x);
+ }
+}
+
public class GenA<T> {
public static T[] arr;
return NonGen.field;
}
+ public int getGenStructStaticField () {
+ return GenStruct<T>.staticField;
+ }
+
public T[] getArr () {
return arr;
}
return (T)obj;
}
+ public GenStruct<T> structCast (Object obj) {
+ return (GenStruct<T>)obj;
+ }
+
public Type ldtokenT () {
return typeof (T);
}
return typeof (GenB<>);
}
+ public GenStruct<T>? makeNullable (Object obj) {
+ return (GenStruct<T>?)obj;
+ }
+
+ public object unmakeNullable (GenStruct<T>? obj) {
+ return (object)obj;
+ }
+
public void except () {
try {
NonGen.doThrow ();
public static long staticBiLongCaller (long x) {
return GenBi<int, T>.staticLongMethod (x);
}
+
+ public int structCaller (int x) {
+ GenStruct<GenA<T>> gs = new GenStruct<GenA<T>> (123);
+
+ return gs.method (x);
+ }
+
+ public T[] callInterface (IGen<T> ig) {
+ return ig.iMethod ();
+ }
+
+ public void callVoidInterface (IGen<T> ig, int x) {
+ ig.voidIMethod (x);
+ }
+
+ public long callLongInterface (IGen<T> ig, long x) {
+ return ig.longIMethod (x);
+ }
+
+ public float callFloatInterface (IGen<T> ig) {
+ return ig.floatIMethod ();
+ }
+
+ public GenStruct<T> callValueInterface (IGen<T> ig, int x) {
+ return ig.valueIMethod (x);
+ }
}
public class GenB<T> {
}
public class main {
+ delegate void ActionDelegate ();
+
static bool haveError = false;
- public static void error (string message) {
+ static void error (string message) {
haveError = true;
Console.WriteLine (message);
}
- public static void typeCheck (String method, Object obj, Type t) {
+ static void typeCheck (String method, Object obj, Type t) {
if (obj.GetType () != t)
error ("object from " + method + " should have type " + t.ToString () + " but has type " + obj.GetType ().ToString ());
}
- public static int callStaticMethod<T> () {
+ static int callStaticMethod<T> () {
return GenA<T>.staticMethod ();
}
+ static void checkException<T> (String method, ActionDelegate action) where T : Exception {
+ try {
+ try {
+ action ();
+ } catch (T) {
+ return;
+ }
+ } catch (Exception exc) {
+ error ("method " + method + " should have thrown " + typeof (T).ToString () + " but did throw " + exc);
+ }
+ }
+
public static void work<T> (T obj, bool mustCatch) {
EqualityComparer<T> comp = EqualityComparer<T>.Default;
if (ga.getNonGenField () != 123)
error ("getNonGenField");
+ GenStruct<T>.staticField = 321;
+ if (ga.getGenStructStaticField () != 321)
+ error ("getGenStructStaticField");
+ GenStruct<T>.staticField = -1;
+
ga.hash (obj);
if (!comp.Equals (ga.ident (obj), obj))
if (!comp.Equals (ga.cast (obj), obj))
error ("cast");
+ if (typeof (T).IsValueType) {
+ checkException<NullReferenceException> ("cast null value", delegate { ga.cast (null); });
+ } else {
+ if (ga.cast (null) != null)
+ error ("cast null");
+ }
+
+ GenStruct<T> genstructt = new GenStruct<T> (453);
+ if (ga.structCast ((object)genstructt).field != 453)
+ error ("structCast");
+ checkException<NullReferenceException> ("structCast null", delegate { ga.structCast (null); });
+
+ if (ga.makeNullable ((object)genstructt).Value.field != 453)
+ error ("makeNullable");
+ if (ga.makeNullable (null) != null)
+ error ("makeNullable null");
if (ga.ldtokenT () != typeof (T))
error ("ldtokenT");
if (GenA<T>.staticFloatMethod () != 1.0)
error ("staticFloatMethod");
- new GenADeriv<T> ();
+ if (ga.structCaller (234) != 357)
+ error ("structCaller");
- if (mustCatch) {
- bool didCatch = false;
+ IGenImpl<T> igi = new IGenImpl<T> ();
- try {
- ga.except ();
- } catch (GenExc<ClassA>) {
- didCatch = true;
- }
- if (!didCatch)
- error ("except");
+ typeCheck ("callInterface", ga.callInterface (igi), typeof (T[]));
+ if (ga.callLongInterface (igi, 345) != 346)
+ error ("callLongInterface");
+ GenStruct<T> gst = ga.callValueInterface (igi, 543);
+ if (gst.field != 543)
+ error ("callValueInterface");
+ ga.callVoidInterface (igi, 654);
+ if (igi.field != 654)
+ error ("callVoidInterface");
+ if (ga.callFloatInterface (igi) != 1.0f)
+ error ("callFloatInterface");
- didCatch = false;
+ new GenADeriv<T> ();
- try {
- GenA<T>.staticExcept ();
- } catch (GenExc<ClassA>) {
- didCatch = true;
- }
- if (!didCatch)
- error ("staticExcept");
+ if (mustCatch) {
+ checkException<GenExc<ClassA>> ("except", delegate { ga.except (); });
+ checkException<GenExc<ClassA>> ("staticExcept", delegate { GenA<T>.staticExcept (); });
} else {
ga.except ();
GenA<T>.staticExcept ();
{
work<ClassA> (new ClassA (), false);
work<ClassB> (new ClassB (), true);
+ work<ClassB> (new ClassB (), true);
work<ClassC> (new ClassC (), true);
work<GenA<ClassA>> (new GenA<ClassA> (), true);
work<int[]> (new int[3], true);
work<int> (123, true);
+ work<int?> (123, true);
+ work<GenStruct<ClassA>?> (new GenStruct<ClassA> (123), true);
+ work<GenStruct<ClassA>?> (null, true);
StaticTest<ClassA> sa = new StaticTest<ClassA> (1234);
StaticTest<ClassB> sb = new StaticTest<ClassB> (2345);