+2006-01-05 Ankit Jain <jankit@novell.com>
+
+ * gen-extern-type.il: New. Test for ref to an external generic type.
+ * gen-array1.il, gen-array-2.il: New. Test for duplicate typespecs for
+ generic types and arrays of the same.
+ * gen-interf-1.il, gen-interf-2.il: New. Test for inheriting from a generic
+ base class and implementing generic interfaces.
+ * gen-struct.il: New. Test for generic valuetype.
+ * gen-local.il: New. No entry in the TypeSpec table should be emitted if a
+ generic type is referenced only as a local var.
+ * one.cs, two.cs: Updated to include types required the new tests.
+
2006-01-03 Ankit Jain <jankit@novell.com>
* gen-dotted-name.il: New. Test for dotted-name of a generic type.
--- /dev/null
+// Test that no duplicate TypeSpec entries are emitted
+//
+// Multiple instaces of generic type class g<T>, with the same
+// argument (int32). Only one typespec should be emitted and shared by all these.
+
+.assembly extern mscorlib
+{
+ .ver 2:0:0:0
+}
+.assembly 'gen-array-1'
+{
+ .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.
+
+ .ver 0:0:0:0
+}
+.module arr.exe
+
+ .class private auto ansi beforefieldinit g`1<T>
+ extends [mscorlib]System.Object
+ {
+ .method public hidebysig specialname rtspecialname
+ instance default void .ctor () cil managed
+ {
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void object::.ctor()
+ IL_0006: ret
+ }
+ }
+
+ .class private auto ansi beforefieldinit test
+ extends [mscorlib]System.Object
+ {
+ .method public static hidebysig
+ default void Main () cil managed
+ {
+ .entrypoint
+ .maxstack 3
+ .locals init (
+ /* Multiple generic instances with same argument */
+ class g`1<int32>[] V_0,
+ class g`1<int32>[][] V_1,
+ class g`1<int32> V_2,
+ class g`1<int32>[] V_3,
+ class g`1<class g`1<int32>> V_4,
+ class g`1<class g`1<int32>>[] V_5,
+ class g`1<class g`1<int32>>[][] V_6,
+ class g`1<class g`1<int32>[]>[][] V_7,
+ class g`1<class g`1<int32>[][]>[][] V_8)
+ IL_0000: ldc.i4.s 0x36
+ IL_0002: newarr class g`1<int32>
+ IL_0007: stloc.0
+ IL_0008: ldloc.0
+ IL_0009: ldc.i4.0
+ IL_000a: newobj instance void class g`1<int32>::.ctor()
+ IL_000f: stelem.ref
+ IL_0010: ret
+ }
+
+ }
--- /dev/null
+// Test that no duplicate TypeSpec entries are emitted
+//
+// Multiple instaces of generic type class [one]gen<T> from an *external* assembly, with the same
+// argument (int32). Only one typespec should be emitted and shared by all these.
+
+.assembly extern mscorlib
+{
+ .ver 2:0:0:0
+}
+.assembly extern one
+{
+}
+.assembly 'gen-array2'
+{
+ .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.
+
+ .ver 0:0:0:0
+}
+.module arr.exe
+
+ .class private auto ansi beforefieldinit test
+ extends [mscorlib]System.Object
+ {
+ .method public static hidebysig
+ default void Main () cil managed
+ {
+ .entrypoint
+ .maxstack 3
+ .locals init (
+ /* Multiple generic instances with same argument */
+ class [one]gen`1<int32>[] V_0,
+ class [one]gen`1<int32>[][] V_1,
+ class [one]gen`1<int32> V_2,
+ class [one]gen`1<int32>[] V_3,
+ class [one]gen`1<class [one]gen`1<int32>> V_4,
+ class [one]gen`1<class [one]gen`1<int32>>[] V_5,
+ class [one]gen`1<class [one]gen`1<int32>>[][] V_6,
+ class [one]gen`1<class [one]gen`1<int32>[]>[][] V_7,
+ class [one]gen`1<class [one]gen`1<int32>[][]>[][] V_8)
+ IL_0000: ldc.i4.s 0x36
+ IL_0002: newarr class [one]gen`1<int32>
+ IL_0007: stloc.0
+ IL_0008: ldloc.0
+ IL_0009: ldc.i4.0
+ IL_000a: newobj instance void class [one]gen`1<int32>::.ctor()
+ IL_000f: stelem.ref
+ IL_0010: ret
+ }
+
+ }
--- /dev/null
+// Test for Ref to external generic types\r
+\r
+.assembly extern mscorlib\r
+{\r
+ .ver 2:0:0:0\r
+}\r
+.assembly extern one\r
+{\r
+ .ver 0:0:0:0\r
+}\r
+.assembly 'gen-extern-type'\r
+{\r
+ .custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78\r
+ 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 )\r
+ .ver 0:0:0:0\r
+}\r
+\r
+.module use.exe\r
+\r
+.class private auto ansi beforefieldinit test\r
+ extends [mscorlib]System.Object\r
+{\r
+ .method public hidebysig specialname rtspecialname \r
+ instance void .ctor() cil managed\r
+ {\r
+ .maxstack 8\r
+ IL_0000: ldarg.0\r
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()\r
+ IL_0006: ret\r
+ }\r
+\r
+ .method public hidebysig static void Main() cil managed\r
+ {\r
+ .entrypoint\r
+ .maxstack 3\r
+ .locals init (class [one]ns.gen_m`1<int32>[] V_0)\r
+ IL_0000: ldc.i4.5\r
+ IL_0001: newarr class [one]ns.gen_m`1<int32>\r
+ IL_0006: stloc.0\r
+ IL_0007: ldloc.0\r
+ IL_0008: ldc.i4.0\r
+ IL_0009: newobj instance void class [one]ns.gen_m`1<int32>::.ctor()\r
+ IL_000e: stelem.ref\r
+ IL_000f: ldstr "asd"\r
+ IL_0014: call void class [one]ns.gen_m`1<int32>::foo<string>(!!0)\r
+ IL_0019: ldc.i4.5\r
+ IL_001a: call void class [one]ns.gen_m`1<int32>::foo<int32,string>(!!0)\r
+ IL_001f: ret\r
+ }\r
+\r
+}\r
--- /dev/null
+// Test for : inheriting generic base class and implementing generic interfaces
+
+.assembly extern mscorlib
+{
+ .ver 2:0:0:0
+}
+.assembly 'gen-interf-1'
+{
+ .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.
+
+ .ver 0:0:0:0
+}
+.module interf.exe
+
+ .class interface private auto ansi abstract IGen`1<T>
+ {
+ }
+
+ .class interface private auto ansi abstract IFen`1<T>
+ {
+ }
+
+ .class interface private auto ansi abstract ISimple
+ {
+ }
+
+ .class private auto ansi beforefieldinit cbase`1<Z>
+ extends [mscorlib]System.Object
+ {
+ .method public hidebysig specialname rtspecialname
+ instance default void .ctor () cil managed
+ {
+ .locals init (class cbase`1<int32>[] c)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void object::.ctor()
+ IL_0006: ret
+ }
+
+ }
+
+ /* Inherits a generic base class and implements generic interfaces */
+ .class private auto ansi beforefieldinit gen_another`2<A,B>
+ extends class cbase`1<!1>
+ implements class IGen`1<!0>, class IFen`1<!1>, ISimple {
+
+ }
--- /dev/null
+// Test for : inheriting generic (external) base class and implementing (external) generic interfaces
+
+.assembly extern mscorlib
+{
+ .ver 2:0:0:0
+}
+.assembly extern one
+{
+}
+.assembly 'gen-interf-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.
+
+ .ver 0:0:0:0
+}
+.module interf.exe
+
+
+ .class interface private auto ansi abstract ISimple
+ {
+
+ }
+
+ .class private auto ansi beforefieldinit gen_another`2<A,B>
+ extends class [one]gen`1<!0>
+ implements class [one]If1`1<!0>, class [one]If2`1<!1>, ISimple, [one]If3 {
+
+ }
--- /dev/null
+// No entry in the TypeSpec table should be emitted for generic types (g<> and gen<>)
+// referenced in local var sig as it(GenericInst) is emitted the sig itself, and not a TypeSpec token
+
+.assembly extern mscorlib
+{
+ .ver 2:0:0:0
+}
+.assembly extern one
+{
+}
+
+.assembly 'gen-local'
+{
+ .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.
+
+ .ver 0:0:0:0
+}
+.module 'gen-local.exe'
+
+ .class private auto ansi beforefieldinit g`1<T>
+ extends [mscorlib]System.Object
+ {
+ .method public hidebysig specialname rtspecialname
+ instance default void .ctor () cil managed
+ {
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void object::.ctor()
+ IL_0006: ret
+ }
+ }
+
+ .class private auto ansi beforefieldinit test
+ extends [mscorlib]System.Object
+ {
+ .method public static hidebysig
+ default void Main () cil managed
+ {
+ .entrypoint
+ .maxstack 3
+ .locals init (
+ class g`1<string> V_0,
+ class [one]gen`1<string> V_1)
+ IL_0010: ret
+ }
+
+ }
--- /dev/null
+// Test for generic valuetypes
+
+.assembly extern mscorlib
+{
+ .ver 2:0:0:0
+}
+.assembly extern one
+{
+ .ver 0:0:0:0
+}
+.assembly 'gen-struct'
+{
+ .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.
+
+ .ver 0:0:0:0
+}
+.module 'gen-struct.exe'
+
+ .class private auto ansi beforefieldinit test
+ extends [mscorlib]System.Object
+ {
+
+ .method public hidebysig specialname rtspecialname
+ instance default void .ctor () cil managed
+ {
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void object::.ctor()
+ IL_0006: ret
+ }
+
+ .method public static hidebysig
+ default void Main () cil managed
+ {
+ .entrypoint
+ .maxstack 1
+ .locals init (
+ valuetype [one]gen_struct`1<string> V_0)
+ IL_0000: ldloca.s 0
+ IL_0002: initobj valuetype [one]gen_struct`1<string>
+ IL_0008: call void valuetype [one]gen_struct`1<int32>::foo()
+ IL_000d: ret
+ }
+
+ }
public class inner {
}
}
+
+public class gen <T> {
+ public static void foo ()
+ {
+ }
+}
+
+namespace ns {
+ public class gen_m <T> {
+ public static void foo ()
+ {
+ }
+ public static void foo <A> (A _a)
+ {
+ }
+ public static void foo <A, B> (A _a)
+ {
+ }
+ }
+}
+
+public interface If1 <T> {
+}
+
+public interface If2 <T> {
+}
+
+public interface If3 {
+}
+
+public struct gen_struct <T> {
+ public static void foo ()
+ {
+ }
+}
public class inner {
}
}
+
+public class gen <T> {
+}