8 public TestStruct (int i) {
15 return TestDriver.RunTests (typeof (Tests));
18 public static int test_1_nullable_unbox ()
20 return Unbox<int?> (1).Value;
23 public static int test_1_nullable_unbox_null ()
25 return Unbox<int?> (null).HasValue ? 0 : 1;
28 public static int test_1_nullable_box ()
30 return (int) Box<int?> (1);
33 public static int test_1_nullable_box_null ()
35 return Box<int?> (null) == null ? 1 : 0;
38 public static int test_1_isinst_nullable ()
41 return (o is int?) ? 1 : 0;
44 public static int test_1_nullable_unbox_vtype ()
46 return Unbox<TestStruct?> (new TestStruct (1)).Value.i;
49 public static int test_1_nullable_unbox_null_vtype ()
51 return Unbox<TestStruct?> (null).HasValue ? 0 : 1;
54 public static int test_1_nullable_box_vtype ()
56 return ((TestStruct)(Box<TestStruct?> (new TestStruct (1)))).i;
59 public static int test_1_nullable_box_null_vtype ()
61 return Box<TestStruct?> (null) == null ? 1 : 0;
64 public static int test_1_isinst_nullable_vtype ()
66 object o = new TestStruct (1);
67 return (o is TestStruct?) ? 1 : 0;
70 public static void stelem_any<T> (T[] arr, T elem) {
74 public static T ldelem_any<T> (T[] arr) {
78 public static int test_1_ldelem_stelem_any_int () {
79 int[] arr = new int [3];
82 return ldelem_any (arr);
90 public static int test_0_iface_call_null_bug_77442 () {
96 catch (NullReferenceException) {
103 public struct GenericStruct<T> {
106 public GenericStruct (T t) {
111 public class GenericClass<T> {
114 public GenericClass (T t) {
119 public class MRO : MarshalByRefObject {
120 public GenericStruct<int> struct_field;
121 public GenericClass<int> class_field;
124 public static int test_0_ldfld_stfld_mro () {
126 GenericStruct<int> s = new GenericStruct<int> (5);
127 // This generates stfld
130 // This generates ldflda
131 if (m.struct_field.t != 5)
134 // This generates ldfld
135 GenericStruct<int> s2 = m.struct_field;
139 if (m.struct_field.t != 5)
142 m.class_field = new GenericClass<int> (5);
143 if (m.class_field.t != 5)
149 public static int test_0_generic_virtual_call_on_vtype_unbox () {
150 object o = new Object ();
151 IMyHandler h = new Handler(o);
153 if (h.Bar<object> () != o)
159 public static int test_0_box_brtrue_opt_regress_81102 () {
160 if (new Foo<int>(5).ToString () == "null")
173 public override string ToString()
175 return Bar(m_t1 == null ? "null" : "null");
178 public String Bar (String s) {
185 public interface IMyHandler {
189 struct Handler : IMyHandler {
192 public Handler(object o) {
196 public object Bar<T>() {
201 static object Box<T> (T t)
206 static T Unbox <T> (object o) {