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

test-300.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 86bb5cde88a7711fb1c66a4fe05d18b5a8e88035 (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
65
66
67
68
69
70
71
72
73
74
75
76
77
using System;
using System.Collections;

class A
{
	class C { }

	public class B
	{
		class C { }

		public B() {
			string error = "";

			if (typeof (C) != typeof (A.B.C))
				error += " 'typeof' keyword,";

			object o0 = new C ();
			if (o0.GetType() != typeof (A.B.C))
				error += " 'new' keyword,";

			C o1 = new C ();
			if (o1.GetType () != typeof (A.B.C))
				error += " local declaration,";

			object o2 = new A.B.C ();
			if (!(o2 is C))
				error += " 'is' keyword,";

			object o3 = o2 as C;
			if (o3 == null)
				error += " 'as' keyword,";

			try {
				object o4 = (C) o2;
			}
			catch {
				error += " type cast,";
			}

			try {
				object o5 = (C) (o2);
			}
			catch {
				error += " invocation-or-cast,";
			}

			object o6 = new C [1];

			if (o6.GetType ().GetElementType () != typeof (A.B.C))
				error += " array creation,";

			if (typeof (C []).GetElementType () != typeof (A.B.C))
				error += " composed cast (array),";

			ArrayList a = new ArrayList ();
			a.Add (new A.B.C ());

			try {
				foreach (C c in a)
				{ 
				}
			}
			catch {
				error += " 'foreach' statement,";
			}

			if (error.Length != 0)
				throw new Exception ("The following couldn't resolve C as A+B+C:" + error);
		}
	}

	public static void Main()
	{
		object o = new A.B();
	}
}