X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmini%2Fgenerics.cs;h=19282df514e273e5f2da45e6208e835255b34b58;hb=6b104c2bc41fe0e94488f0ef461319cb3a512aa3;hp=842ddf6352d65b38ea7fbe461dc9a53c2eee467c;hpb=f78e6f8fee273c6c80c8c36e7e1b2bbd8392b8cb;p=mono.git diff --git a/mono/mini/generics.cs b/mono/mini/generics.cs index 842ddf6352d..19282df514e 100644 --- a/mono/mini/generics.cs +++ b/mono/mini/generics.cs @@ -921,4 +921,63 @@ class Tests { } return 0; } + + class A { } + + static List sources = new List(); + + // #6112 + public static int test_0_fullaot_imt () { + sources.Add(null); + sources.Add(null); + + int a = sources.Count; + var enumerator = sources.GetEnumerator() as IEnumerator; + + while (enumerator.MoveNext()) + { + object o = enumerator.Current; + } + + return 0; + } + + struct Record : Foo2.IRecord { + int counter; + int Foo2.IRecord.DoSomething () { + return counter++; + } + } + + class Foo2 where T : Foo2.IRecord { + public interface IRecord { + int DoSomething (); + } + + public static int Extract (T[] t) { + return t[0].DoSomething (); + } + } + + class Foo3 where T : IComparable { + public static int CompareTo (T[] t) { + // This is a constrained call to Enum.CompareTo () + return t[0].CompareTo (t [0]); + } + } + + public static int test_1_regress_constrained_iface_call_7571 () { + var r = new Record [10]; + Foo2.Extract (r); + return Foo2.Extract (r); + } + + enum ConstrainedEnum { + Val = 1 + } + + public static int test_0_regress_constrained_iface_call_enum () { + var r = new ConstrainedEnum [10]; + return Foo3.CompareTo (r); + } }