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

test-261.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b6ca39ff3b99bfd8d1002dcf05f54bc3d2bed39c (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
using System;

class T {
        T Me { get { calls ++; return this; } }
	T GetMe () { foo ++; return this; }
        int blah = 0, calls = 0, foo = 0, bar = 0;

	static int Test (T t)
	{
                t.Me.Me.blah ++;
		t.GetMe ().GetMe ().bar++;
		if (t.blah != 1)
			return 1;
		if (t.bar != 1)
			return 2;
		if (t.calls != 2)
			return 3;
		if (t.foo != 2)
			return 4;
		return 0;
	}

	public static int Main ()
	{
		T t = new T ();
		int result = Test (t);
		Console.WriteLine ("RESULT: {0}", result);
		return result;
        }
}