X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mono%2Fmini%2Fgenerics.cs;h=19282df514e273e5f2da45e6208e835255b34b58;hb=6b104c2bc41fe0e94488f0ef461319cb3a512aa3;hp=25fd698d61508158504439a0d2a7ead8e8079504;hpb=320b06dd60adce1e5887afc25ec37cd997d9ded3;p=mono.git diff --git a/mono/mini/generics.cs b/mono/mini/generics.cs index 25fd698d615..19282df514e 100644 --- a/mono/mini/generics.cs +++ b/mono/mini/generics.cs @@ -885,4 +885,99 @@ class Tests { else return 0; } + + enum DocType { + One, + Two, + Three + } + + class Doc { + public string Name { + get; set; + } + + public DocType Type { + get; set; + } + } + + // #2155 + public static int test_0_fullaot_sflda_cctor () { + List documents = new List(); + documents.Add(new Doc { Name = "Doc1", Type = DocType.One } ); + documents.Add(new Doc { Name = "Doc2", Type = DocType.Two } ); + documents.Add(new Doc { Name = "Doc3", Type = DocType.Three } ); + documents.Add(new Doc { Name = "Doc4", Type = DocType.One } ); + documents.Add(new Doc { Name = "Doc5", Type = DocType.Two } ); + documents.Add(new Doc { Name = "Doc6", Type = DocType.Three } ); + documents.Add(new Doc { Name = "Doc7", Type = DocType.One } ); + documents.Add(new Doc { Name = "Doc8", Type = DocType.Two } ); + documents.Add(new Doc { Name = "Doc9", Type = DocType.Three } ); + + List categories = documents.Select(d=>d.Type).Distinct().ToList().OrderBy(d => d).ToList(); + foreach(DocType cat in categories) { + List catDocs = documents.Where(d => d.Type == cat).OrderBy(d => d.Name).ToList(); + } + 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); + } }