1 // Static fields in generic types: this is a runtime/JIT-only test
3 // We need to make sure that we're instantiating each closed generic
4 // type (ie. "Test<int>") only once.
10 public static int Count;
17 public int GetCount ()
25 static int DoTheTest<T> ()
27 Test<T> test = new Test<T> ();
30 if (test.GetCount () != 1)
32 if (Test<T>.Count != 1)
36 if (test.GetCount () != 2)
38 if (Test<T>.Count != 2)
42 if (test.GetCount () != 3)
44 if (Test<T>.Count != 3)
52 int result = DoTheTest<int> ();
56 result = DoTheTest<long> () + 10;
63 result = DoTheTest<int> () + 20;
67 if (Test<int>.Count != 3)
69 if (Test<long>.Count != 4)
71 Test<float>.Count = 5;
72 if (Test<int>.Count != 3)
74 if (Test<long>.Count != 4)