X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmini%2Fgenerics.2.cs;h=4b71190a817578c81d6563d7b2bbd5e398db66b2;hb=824e66edd228b294f297e1d2257342db834a423b;hp=1688c779f1f29eb70b53789d07dd0fc16f6055e0;hpb=6bd37037b1dd62b0a2110c52908aacf94036f406;p=mono.git diff --git a/mono/mini/generics.2.cs b/mono/mini/generics.2.cs index 1688c779f1f..4b71190a817 100644 --- a/mono/mini/generics.2.cs +++ b/mono/mini/generics.2.cs @@ -82,6 +82,70 @@ class Tests { return ldelem_any (arr); } + interface ITest + { + void Foo (); + } + + public static int test_0_iface_call_null_bug_77442 () { + ITest test = null; + + try { + test.Foo (); + } + catch (NullReferenceException) { + return 0; + } + + return 1; + } + + public struct GenericStruct { + public T t; + + public GenericStruct (T t) { + this.t = t; + } + } + + public class GenericClass { + public T t; + + public GenericClass (T t) { + this.t = t; + } + } + + public class MRO : MarshalByRefObject { + public GenericStruct struct_field; + public GenericClass class_field; + } + + public static int test_0_ldfld_stfld_mro () { + MRO m = new MRO (); + GenericStruct s = new GenericStruct (5); + // This generates stfld + m.struct_field = s; + + // This generates ldflda + if (m.struct_field.t != 5) + return 1; + + // This generates ldfld + GenericStruct s2 = m.struct_field; + if (s2.t != 5) + return 2; + + if (m.struct_field.t != 5) + return 3; + + m.class_field = new GenericClass (5); + if (m.class_field.t != 5) + return 4; + + return 0; + } + static object Box (T t) { return t;