Merge pull request #5675 from mono/glib-debug-symbols
[mono.git] / mcs / tests / test-anon-135.cs
1 using System;
2 using System.Reflection;
3
4 // Delegate Cache
5 class C<T>
6 {
7         static Func<T> XX ()
8         {
9                 System.Func<T> t = () => default (T);
10                 return t;
11         }
12 }
13
14 // Delegate Cache
15 class C2<T>
16 {
17         static Func<C<T>> XX ()
18         {
19                 System.Func<C<T>> t = () => default (C<T>);
20                 return t;
21         }
22 }
23
24 // No delegate cache
25 class N1
26 {
27         static Func<T> XX<T> ()
28         {
29                 System.Func<T> t = () => default (T);
30                 return t;
31         }
32 }
33
34 public class Test
35 {
36         public static int Main ()
37         {
38                 var t = typeof (C<>);
39                 if (t.GetFields (BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static).Length != 1)
40                         return 1;
41                 
42                 t = typeof (C2<>);
43                 if (t.GetFields (BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static).Length != 1)
44                         return 1;
45                 
46                 t = typeof (N1);
47                 if (t.GetFields (BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static).Length != 0)
48                         return 1;
49                 
50                 Console.WriteLine ("OK");
51                 return 0;
52         }
53 }