Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gtest-anon-35.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 49944643afb675d2c9a831fa31435fb179bdcd0d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System;
using System.Reflection;

// Delegate Cache
class C<T>
{
	static Func<T> XX ()
	{
		System.Func<T> t = () => default (T);
		return t;
	}
}

// Delegate Cache
class C2<T>
{
	static Func<C<T>> XX ()
	{
		System.Func<C<T>> t = () => default (C<T>);
		return t;
	}
}

// No delegate cache
class N1
{
	static Func<T> XX<T> ()
	{
		System.Func<T> t = () => default (T);
		return t;
	}
}

public class Test
{
	public static int Main ()
	{
		var t = typeof (C<>);
		if (t.GetFields (BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static).Length != 1)
			return 1;
		
		t = typeof (C2<>);
		if (t.GetFields (BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static).Length != 1)
			return 1;
		
		t = typeof (N1);
		if (t.GetFields (BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static).Length != 0)
			return 1;
		
		Console.WriteLine ("OK");
		return 0;
	}
}