2 using System.Collections.Generic;
4 using System.Runtime.CompilerServices;
5 using System.Threading;
6 using System.Threading.Tasks;
18 public TestStruct (int i, int j) {
25 class Enumerator <T> : MyIEnumerator <T> {
26 T MyIEnumerator<T>.Current {
32 bool MyIEnumerator<T>.MoveNext () {
37 class Comparer <T> : IComparer <T> {
38 bool IComparer<T>.Compare (T x, T y) {
45 static int Main (string[] args)
47 return TestDriver.RunTests (typeof (Tests), args);
51 public static int test_1_nullable_unbox ()
53 return Unbox<int?> (1).Value;
56 public static int test_1_nullable_unbox_null ()
58 return Unbox<int?> (null).HasValue ? 0 : 1;
61 public static int test_1_nullable_box ()
63 return (int) Box<int?> (1);
66 public static int test_1_nullable_box_null ()
68 return Box<int?> (null) == null ? 1 : 0;
71 public static int test_1_isinst_nullable ()
74 return (o is int?) ? 1 : 0;
77 public static int test_1_nullable_unbox_vtype ()
79 return Unbox<TestStruct?> (new TestStruct (1, 2)).Value.i;
82 public static int test_1_nullable_unbox_null_vtype ()
84 return Unbox<TestStruct?> (null).HasValue ? 0 : 1;
87 public static int test_1_nullable_box_vtype ()
89 return ((TestStruct)(Box<TestStruct?> (new TestStruct (1, 2)))).i;
92 public static int test_1_nullable_box_null_vtype ()
94 return Box<TestStruct?> (null) == null ? 1 : 0;
97 public static int test_1_isinst_nullable_vtype ()
99 object o = new TestStruct (1, 2);
100 return (o is TestStruct?) ? 1 : 0;
103 public static int test_0_nullable_normal_unbox ()
108 // This uses unbox instead of unbox_any
117 public static void stelem_any<T> (T[] arr, T elem) {
121 public static T ldelem_any<T> (T[] arr) {
125 public static int test_1_ldelem_stelem_any_int () {
126 int[] arr = new int [3];
129 return ldelem_any (arr);
132 public static T return_ref<T> (ref T t) {
136 public static T ldelema_any<T> (T[] arr) {
137 return return_ref<T> (ref arr [0]);
140 public static int test_0_ldelema () {
141 string[] arr = new string [1];
145 if (ldelema_any <string> (arr) == "Hello")
151 public static T[,] newarr_multi<T> () {
155 public static int test_0_newarr_multi_dim () {
156 return newarr_multi<string> ().GetType () == typeof (string[,]) ? 0 : 1;
164 public static int test_0_iface_call_null_bug_77442 () {
170 catch (NullReferenceException) {
177 public static int test_18_ldobj_stobj_generics () {
178 GenericClass<int> t = new GenericClass <int> ();
181 return t.ldobj_stobj (ref i, ref j) + i + j;
184 public static int test_5_ldelem_stelem_generics () {
185 GenericClass<TestStruct> t = new GenericClass<TestStruct> ();
187 TestStruct s = new TestStruct (5, 5);
188 return t.ldelem_stelem (s).i;
191 public static int test_0_constrained_vtype_box () {
192 GenericClass<TestStruct> t = new GenericClass<TestStruct> ();
195 return t.toString (new TestStruct ()) == "GenericsTests+TestStruct" ? 0 : 1;
197 return t.toString (new TestStruct ()) == "Tests+TestStruct" ? 0 : 1;
201 public static int test_0_constrained_vtype () {
202 GenericClass<int> t = new GenericClass<int> ();
204 return t.toString (1234) == "1234" ? 0 : 1;
207 public static int test_0_constrained_reftype () {
208 GenericClass<String> t = new GenericClass<String> ();
210 return t.toString ("1234") == "1234" ? 0 : 1;
213 public static int test_0_box_brtrue_optimizations () {
217 if (!IsNull<object>(null))
223 [Category ("!FULLAOT")]
224 public static int test_0_generic_get_value_optimization_int () {
225 int[] x = new int[] {100, 200};
227 if (GenericClass<int>.Z (x, 0) != 100)
230 if (GenericClass<int>.Z (x, 1) != 200)
236 interface NonGenericInterface {
240 interface GenericInterface<T> : NonGenericInterface {
244 struct ImplementGenericInterface<T> : GenericInterface<T> {
245 public Object padding1;
246 public Object padding2;
247 public Object padding3;
250 public ImplementGenericInterface (T[] arr_t) {
251 this.padding1 = null;
252 this.padding2 = null;
253 this.padding3 = null;
257 public T not_used () {
261 public int return_field () {
266 public static int test_8_struct_implements_generic_interface () {
267 int[] arr = {1, 2, 3, 4};
268 NonGenericInterface s = new ImplementGenericInterface<int> (arr);
269 return s.return_field () + s.return_field ();
272 public static int test_0_generic_get_value_optimization_vtype () {
273 TestStruct[] arr = new TestStruct[] { new TestStruct (100, 200), new TestStruct (300, 400) };
274 IEnumerator<TestStruct> enumerator = GenericClass<TestStruct>.Y (arr);
277 while (enumerator.MoveNext ()) {
278 s = enumerator.Current;
285 s = GenericClass<TestStruct>.Z (arr, 0);
286 if (s.i != 100 || s.j != 200)
289 s = GenericClass<TestStruct>.Z (arr, 1);
290 if (s.i != 300 || s.j != 400)
296 public static int test_0_nullable_ldflda () {
297 return GenericClass<string>.BIsAClazz == false ? 0 : 1;
300 public struct GenericStruct<T> {
303 public GenericStruct (T t) {
308 public class GenericClass<T> {
311 public GenericClass (T t) {
315 public GenericClass () {
318 public T ldobj_stobj (ref T t1, ref T t2) {
325 public T ldelem_stelem (T t) {
326 T[] arr = new T [10];
332 public String toString (T t) {
333 return t.ToString ();
336 public static IEnumerator<T> Y (IEnumerable <T> x)
338 return x.GetEnumerator ();
341 public static T Z (IList<T> x, int index)
346 protected static T NullB = default(T);
347 private static Nullable<bool> _BIsA = null;
348 public static bool BIsAClazz {
356 public class MRO : MarshalByRefObject {
357 public GenericStruct<int> struct_field;
358 public GenericClass<int> class_field;
361 public class MRO<T> : MarshalByRefObject {
364 public T stfld_ldfld (T t) {
371 public static int test_0_ldfld_stfld_mro () {
373 GenericStruct<int> s = new GenericStruct<int> (5);
374 // This generates stfld
377 // This generates ldflda
378 if (m.struct_field.t != 5)
381 // This generates ldfld
382 GenericStruct<int> s2 = m.struct_field;
386 if (m.struct_field.t != 5)
389 m.class_field = new GenericClass<int> (5);
390 if (m.class_field.t != 5)
394 var m2 = new MRO<string> ();
395 if (m2.stfld_ldfld ("A") != "A")
402 [Category ("!FULLAOT")]
403 public static int test_0_generic_virtual_call_on_vtype_unbox () {
404 object o = new Object ();
405 IFoo h = new Handler(o);
407 if (h.Bar<object> () != o)
413 public static int test_0_box_brtrue_opt () {
414 Foo<int> f = new Foo<int> (5);
421 public static int test_0_box_brtrue_opt_regress_81102 () {
422 if (new Foo<int>(5).ToString () == "null")
432 public static int test_0_ldloca_initobj_opt () {
433 if (new Foo<S> (new S ()).get_default ().i != 0)
435 if (new Foo<object> (null).get_default () != null)
441 public static int test_0_variance_reflection () {
442 // covariance on IEnumerator
443 if (!typeof (MyIEnumerator<object>).IsAssignableFrom (typeof (MyIEnumerator<string>)))
445 // covariance on IEnumerator and covariance on arrays
446 if (!typeof (MyIEnumerator<object>[]).IsAssignableFrom (typeof (MyIEnumerator<string>[])))
448 // covariance and implemented interfaces
449 if (!typeof (MyIEnumerator<object>).IsAssignableFrom (typeof (Enumerator<string>)))
452 // contravariance on IComparer
453 if (!typeof (IComparer<string>).IsAssignableFrom (typeof (IComparer<object>)))
455 // contravariance on IComparer, contravariance on arrays
456 if (!typeof (IComparer<string>[]).IsAssignableFrom (typeof (IComparer<object>[])))
458 // contravariance and interface inheritance
459 if (!typeof (IComparer<string>[]).IsAssignableFrom (typeof (IKeyComparer<object>[])))
465 public static int test_0_ldvirtftn_generic_method () {
466 new GenericsTests ().ldvirtftn<string> ();
468 return the_type == typeof (string) ? 0 : 1;
471 public static int test_0_throw_dead_this () {
472 new Foo<string> ("").throw_dead_this ();
478 public static int test_0_inline_infinite_polymorphic_recursion () {
484 private static void f<T>(int i) {
485 if(i==42) f<S<T>>(i);
488 // This cannot be made to work with full-aot, since there it is impossible to
489 // statically determine that Foo<string>.Bar <int> is needed, the code only
490 // references IFoo.Bar<int>
491 [Category ("!FULLAOT")]
492 public static int test_0_generic_virtual_on_interfaces () {
493 Foo<string>.count1 = 0;
494 Foo<string>.count2 = 0;
495 Foo<string>.count3 = 0;
497 IFoo f = new Foo<string> ("");
498 for (int i = 0; i < 1000; ++i) {
504 if (Foo<string>.count1 != 1000)
506 if (Foo<string>.count2 != 1000)
508 if (Foo<string>.count3 != 1000)
511 VirtualInterfaceCallFromGenericMethod<long> (f);
516 public static int test_0_generic_virtual_on_interfaces_ref () {
517 Foo<string>.count1 = 0;
518 Foo<string>.count2 = 0;
519 Foo<string>.count3 = 0;
520 Foo<string>.count4 = 0;
522 IFoo f = new Foo<string> ("");
523 for (int i = 0; i < 1000; ++i) {
529 if (Foo<string>.count2 != 1000)
531 if (Foo<string>.count3 != 1000)
533 if (Foo<string>.count4 != 1000)
540 [Category ("!FULLAOT")]
541 public static int test_2_cprop_bug () {
544 var cmp = System.Collections.Generic.Comparer<int>.Default ;
545 if (cmp.Compare (a, 0) > 0)
547 do { idx++; } while (cmp.Compare (idx - 1, a) == 0);
551 enum MyEnumUlong : ulong {
555 public static int test_0_regress_550964_constrained_enum_long () {
556 MyEnumUlong a = MyEnumUlong.Value_2;
557 MyEnumUlong b = MyEnumUlong.Value_2;
559 return Pan (a, b) ? 0 : 1;
562 static bool Pan<T> (T a, T b)
567 public class XElement {
568 public string Value {
573 [Category ("!INTERPRETER")]
574 public static int test_0_fullaot_linq () {
575 var allWords = new XElement [] { new XElement { Value = "one" } };
576 var filteredWords = allWords.Where(kw => kw.Value.StartsWith("T"));
577 return filteredWords.Count ();
580 public static int test_0_fullaot_comparer_t () {
581 var l = new SortedList <TimeSpan, int> ();
585 public static int test_0_fullaot_comparer_t_2 () {
586 var l = new Dictionary <TimeSpan, int> ();
590 static void enumerate<T> (IEnumerable<T> arr) {
591 foreach (var o in arr)
593 int c = ((ICollection<T>)arr).Count;
596 /* Test that treating arrays as generic collections works with full-aot */
597 public static int test_0_fullaot_array_wrappers () {
598 GenericsTests[] arr = new GenericsTests [10];
599 enumerate<GenericsTests> (arr);
603 static int cctor_count = 0;
605 public abstract class Beta<TChanged>
613 public class Gamma<T> : Beta<T>
621 public static int test_2_generic_class_init_gshared_ctor () {
628 static int cctor_count2 = 0;
630 class ServiceController<T> {
631 static ServiceController () {
635 public ServiceController () {
639 static ServiceController<T> Create<T>() {
640 return new ServiceController<T>();
644 public static int test_2_generic_class_init_gshared_ctor_from_gshared () {
651 public static Type get_type<T> () {
655 public static int test_0_gshared_delegate_rgctx () {
656 Func<Type> t = new Func<Type> (get_type<string>);
658 if (t () == typeof (string))
664 // Creating a delegate from a generic method from gshared code
665 public static int test_0_gshared_delegate_from_gshared () {
666 if (gshared_delegate_from_gshared <object> () != 0)
668 if (gshared_delegate_from_gshared <string> () != 0)
673 public static int gshared_delegate_from_gshared <T> () {
674 Func<Type> t = new Func<Type> (get_type<T>);
676 return t () == typeof (T) ? 0 : 1;
679 public static int test_0_marshalbyref_call_from_gshared_virt_elim () {
680 /* Calling a virtual method from gshared code which is changed to a nonvirt call */
681 Class1<object> o = new Class1<object> ();
682 o.Do (new Class2<object> ());
686 class Pair<TKey, TValue> {
687 public static KeyValuePair<TKey, TValue> make_pair (TKey key, TValue value)
689 return new KeyValuePair<TKey, TValue> (key, value);
692 public delegate TRet Transform<TRet> (TKey key, TValue value);
695 public static int test_0_bug_620864 () {
696 var d = new Pair<string, Type>.Transform<KeyValuePair<string, Type>> (Pair<string, Type>.make_pair);
698 var p = d ("FOO", typeof (int));
699 if (p.Key != "FOO" || p.Value != typeof (int))
706 struct RecStruct<T> {
707 public void foo (RecStruct<RecStruct<T>> baz) {
711 public static int test_0_infinite_generic_recursion () {
712 // Check that the AOT compile can deal with infinite generic recursion through
722 bool IsNull2 <T> (object value) where T : struct {
723 T? item = (T?) value;
731 public static int test_0_full_aot_nullable_unbox_from_gshared_code () {
732 if (!new GenericsTests ().IsNull2<FooStruct> (null))
734 if (new GenericsTests ().IsNull2<FooStruct> (new FooStruct ()))
739 public static int test_0_partial_sharing () {
740 if (PartialShared1 (new List<string> (), 1) != typeof (string))
742 if (PartialShared1 (new List<GenericsTests> (), 1) != typeof (GenericsTests))
744 if (PartialShared2 (new List<string> (), 1) != typeof (int))
746 if (PartialShared2 (new List<GenericsTests> (), 1) != typeof (int))
751 [Category ("GSHAREDVT")]
752 public static int test_6_partial_sharing_linq () {
753 var messages = new List<Message> ();
755 messages.Add (new Message () { MessageID = 5 });
756 messages.Add (new Message () { MessageID = 6 });
758 return messages.Max(i => i.MessageID);
761 public static int test_0_partial_shared_method_in_nonshared_class () {
762 var c = new Class1<double> ();
763 return (c.Foo<string> (5).GetType () == typeof (Class1<string>)) ? 0 : 1;
767 public int MessageID {
772 public static Type PartialShared1<T, K> (List<T> list, K k) {
776 public static Type PartialShared2<T, K> (List<T> list, K k) {
780 public class Class1<T> {
781 public virtual void Do (Class2<T> t) {
785 public virtual object Foo<U> (T t) {
786 return new Class1<U> ();
790 public interface IFace1<T> {
794 public class Class2<T> : MarshalByRefObject, IFace1<T> {
801 public static void VirtualInterfaceCallFromGenericMethod <T> (IFoo f) {
805 public static Type the_type;
807 public void ldvirtftn<T> () {
808 Foo <T> binding = new Foo <T> (default (T));
810 binding.GenericEvent += event_handler;
814 public virtual void event_handler<T> (Foo<T> sender) {
815 the_type = typeof (T);
818 public interface IFoo {
823 public class Foo<T1> : IFoo
830 public override string ToString()
832 return Bar(m_t1 == null ? "null" : "null");
835 public String Bar (String s) {
839 public int this [T1 key] {
842 throw new ArgumentNullException ("key");
846 public void throw_dead_this () {
848 new SomeClass().ThrowAnException();
854 public T1 get_default () {
860 public delegate void GenericEventHandler (Foo<T1> sender);
862 public event GenericEventHandler GenericEvent;
864 public void fire () {
868 public static int count1, count2, count3, count4;
870 public void NonGeneric () {
874 public object Bar <T> () {
875 if (typeof (T) == typeof (int))
877 else if (typeof (T) == typeof (string))
879 else if (typeof (T) == typeof (object))
885 public class SomeClass {
886 public void ThrowAnException() {
887 throw new Exception ("Something went wrong");
891 struct Handler : IFoo {
894 public Handler(object o) {
898 public void NonGeneric () {
901 public object Bar<T>() {
906 static bool IsNull<T> (T t)
914 static object Box<T> (T t)
919 static T Unbox <T> (object o) {
923 interface IDefaultRetriever
928 class DefaultRetriever : IDefaultRetriever
930 [MethodImpl(MethodImplOptions.Synchronized)]
931 public T GetDefault<T>()
937 [Category ("!FULLAOT")]
938 [Category ("!BITCODE")]
939 public static int test_0_regress_668095_synchronized_gshared () {
940 return DoSomething (new DefaultRetriever ());
943 static int DoSomething(IDefaultRetriever foo) {
944 int result = foo.GetDefault<int>();
949 [MethodImpl(MethodImplOptions.Synchronized)]
950 public Type getInstance() {
955 [Category ("!INTERPRETER")]
956 [Category ("GSHAREDVT")]
957 static int test_0_synchronized_gshared () {
958 var c = new SyncClass<string> ();
959 if (c.getInstance () != typeof (string))
967 public static int test_0_687865_isinst_with_cache_wrapper () {
968 object o = new object ();
969 if (o is Action<IEnumerable<Response>>)
986 public DocType Type {
992 [Category ("!INTERPRETER")]
993 [Category ("GSHAREDVT")]
994 public static int test_0_fullaot_sflda_cctor () {
995 List<Doc> documents = new List<Doc>();
996 documents.Add(new Doc { Name = "Doc1", Type = DocType.One } );
997 documents.Add(new Doc { Name = "Doc2", Type = DocType.Two } );
998 documents.Add(new Doc { Name = "Doc3", Type = DocType.Three } );
999 documents.Add(new Doc { Name = "Doc4", Type = DocType.One } );
1000 documents.Add(new Doc { Name = "Doc5", Type = DocType.Two } );
1001 documents.Add(new Doc { Name = "Doc6", Type = DocType.Three } );
1002 documents.Add(new Doc { Name = "Doc7", Type = DocType.One } );
1003 documents.Add(new Doc { Name = "Doc8", Type = DocType.Two } );
1004 documents.Add(new Doc { Name = "Doc9", Type = DocType.Three } );
1006 List<DocType> categories = documents.Select(d=>d.Type).Distinct().ToList<DocType>().OrderBy(d => d).ToList();
1007 foreach(DocType cat in categories) {
1008 List<Doc> catDocs = documents.Where(d => d.Type == cat).OrderBy(d => d.Name).ToList<Doc>();
1015 static List<A> sources = new List<A>();
1018 [Category ("!INTERPRETER")]
1019 public static int test_0_fullaot_imt () {
1023 int a = sources.Count;
1024 var enumerator = sources.GetEnumerator() as IEnumerator<object>;
1026 while (enumerator.MoveNext())
1028 object o = enumerator.Current;
1037 class BClass : AClass {
1040 [Category ("!INTERPRETER")]
1041 public static int test_0_fullaot_variant_iface () {
1042 var arr = new BClass [10];
1043 var enumerable = (IEnumerable<AClass>)arr;
1044 enumerable.GetEnumerator ();
1048 struct Record : Foo2<Record>.IRecord {
1050 int Foo2<Record>.IRecord.DoSomething () {
1055 class Foo2<T> where T : Foo2<T>.IRecord {
1056 public interface IRecord {
1060 public static int Extract (T[] t) {
1061 return t[0].DoSomething ();
1065 class Foo3<T> where T : IComparable {
1066 public static int CompareTo (T[] t) {
1067 // This is a constrained call to Enum.CompareTo ()
1068 return t[0].CompareTo (t [0]);
1072 [Category ("!INTERPRETER")]
1073 public static int test_1_regress_constrained_iface_call_7571 () {
1074 var r = new Record [10];
1075 Foo2<Record>.Extract (r);
1076 return Foo2<Record>.Extract (r);
1079 enum ConstrainedEnum {
1083 [Category ("!INTERPRETER")]
1084 public static int test_0_regress_constrained_iface_call_enum () {
1085 var r = new ConstrainedEnum [10];
1086 return Foo3<ConstrainedEnum>.CompareTo (r);
1089 public interface IFoo2 {
1093 public struct Foo2 : IFoo2 {
1094 public void MoveNext () {
1098 public static Action Dingus (ref Foo2 f) {
1099 return new Action (f.MoveNext);
1102 public static int test_0_delegate_unbox_full_aot () {
1103 Foo2 foo = new Foo2 ();
1104 Dingus (ref foo) ();
1108 public static int test_0_arrays_ireadonly () {
1109 int[] arr = new int [10];
1110 for (int i = 0; i < 10; ++i)
1112 IReadOnlyList<int> a = (IReadOnlyList<int>)(object)arr;
1122 public static int test_0_volatile_read_write () {
1124 Volatile.Write (ref foo, "DEF");
1125 return Volatile.Read (ref foo) == "DEF" ? 0 : 1;
1128 // FIXME: Doesn't work with --regression as Interlocked.Add(ref long) is only implemented as an intrinsic
1130 public static async Task<T> FooAsync<T> (int i, int j) {
1131 Task<int> t = new Task<int> (delegate () { Console.WriteLine ("HIT!"); return 0; });
1132 var response = await t;
1136 public static int test_0_fullaot_generic_async () {
1137 Task<string> t = FooAsync<string> (1, 2);
1138 t.RunSynchronously ();
1143 [Category ("!INTERPRETER")]
1144 public static int test_0_delegate_callvirt_fullaot () {
1145 Func<string> f = delegate () { return "A"; };
1146 var f2 = (Func<Func<string>, string>)Delegate.CreateDelegate (typeof
1147 (Func<Func<string>, string>), null, f.GetType ().GetMethod ("Invoke"));
1150 return s == "A" ? 0 : 1;
1153 public interface ICovariant<out R>
1157 // Deleting the `out` modifier from this line stop the problem
1158 public interface IExtCovariant<out R> : ICovariant<R>
1162 public class Sample<R> : ICovariant<R>
1166 public interface IMyInterface
1170 public static int test_0_variant_cast_cache () {
1171 object covariant = new Sample<IMyInterface>();
1173 var foo = (ICovariant<IMyInterface>)(covariant);
1176 var extCovariant = (IExtCovariant<IMyInterface>)covariant;
1184 public int a1, a2, a3;
1187 class MyClass<T> where T: struct {
1188 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1189 public MyClass(int a1, int a2, int a3, int a4, int a5, int a6, Nullable<T> a) {
1192 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1193 public static MyClass<T> foo () {
1194 Nullable<T> a = new Nullable<T> ();
1195 return new MyClass<T> (0, 0, 0, 0, 0, 0, a);
1199 public static int test_0_newobj_generic_context () {
1200 MyClass<FooStruct2>.foo ();
1209 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1210 public static string constrained_tostring<T> (T t) {
1211 return t.ToString ();
1214 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1215 public static bool constrained_equals<T> (T t1, T t2) {
1216 var c = EqualityComparer<T>.Default;
1218 return c.Equals (t1, t2);
1221 [MethodImplAttribute (MethodImplOptions.NoInlining)]
1222 public static int constrained_gethashcode<T> (T t) {
1223 return t.GetHashCode ();
1226 [Category ("!INTERPRETER")]
1227 public static int test_0_constrained_partial_sharing () {
1230 s = constrained_tostring<int> (5);
1233 s = constrained_tostring<AnEnum> (AnEnum.B);
1237 if (!constrained_equals<int> (1, 1))
1239 if (constrained_equals<int> (1, 2))
1241 if (!constrained_equals<AnEnum> (AnEnum.A, AnEnum.A))
1243 if (constrained_equals<AnEnum> (AnEnum.A, AnEnum.B))
1246 int i = constrained_gethashcode<int> (5);
1249 i = constrained_gethashcode<AnEnum> (AnEnum.B);
1265 public static int test_0_partial_sharing_ginst () {
1266 var l1 = new List<KeyValuePair<int, Enum1>> ();
1267 l1.Add (new KeyValuePair<int, Enum1>(5, Enum1.A));
1268 if (l1 [0].Key != 5)
1270 if (l1 [0].Value != Enum1.A)
1272 var l2 = new List<KeyValuePair<int, Enum2>> ();
1273 l2.Add (new KeyValuePair<int, Enum2>(5, Enum2.B));
1274 if (l2 [0].Key != 5)
1276 if (l2 [0].Value != Enum2.B)
1281 static object delegate_8_args_res;
1283 public static int test_0_delegate_8_args () {
1284 delegate_8_args_res = null;
1285 Action<string, string, string, string, string, string, string,
1286 string> test = (a, b, c, d, e, f, g, h) =>
1288 delegate_8_args_res = h;
1290 test("a", "b", "c", "d", "e", "f", "g", "h");
1291 return delegate_8_args_res == "h" ? 0 : 1;
1294 static void throw_catch_t<T> () where T: Exception {
1296 throw new NotSupportedException ();
1301 public static int test_0_gshared_catch_open_type () {
1302 throw_catch_t<NotSupportedException> ();
1306 class ThrowClass<T> where T: Exception {
1307 public void throw_catch_t () {
1309 throw new NotSupportedException ();
1315 public static int test_0_gshared_catch_open_type_instance () {
1316 var c = new ThrowClass<NotSupportedException> ();
1323 class GenericsTests : Tests