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

dtest-054.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 90f440dff211eb4a78dd3805b876a5cb68077e7f (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
54
55
56
57
58
59
60
61
62
63
64
using System;

// dynamic with anonymous method mutator

class C
{
	static Action<T> Test<T> (T t)
	{
		return l => {
			dynamic d = l;
			d.Method (l);
		};
	}

	static Action Test2<T> (T t)
	{
		T l = t;
		return () => {
			T l2 = l;
			Action a = () => {
				dynamic d = l2;
				d.Method (l);
			};

			a ();
		};
	}

	static Action<T> Test3<T> (T t)
	{
		return l => {
			dynamic d = l;
			d.MethodRef (ref l);
		};
	}

	static Action Test4<T> (T t)
	{
		T l = t;
		return () => {
			dynamic d = l;
			d.MethodRef (ref l);
		};
	}

	void Method (object arg)
	{
	}

	void MethodRef (ref C arg)
	{
		arg = new C ();
	}

	public static int Main ()
	{
		Test<C> (null) (new C ());
		Test2 (new C ()) ();
		Test<C> (null) (new C ());
		Test4 (new C ()) ();

		return 0;
	}
}