Merge pull request #5636 from BrzVlad/fix-xmm-scan
[mono.git] / mcs / tests / test-300.cs
1 using System;
2 using System.Collections;
3
4 class A
5 {
6         class C { }
7
8         public class B
9         {
10                 class C { }
11
12                 public B() {
13                         string error = "";
14
15                         if (typeof (C) != typeof (A.B.C))
16                                 error += " 'typeof' keyword,";
17
18                         object o0 = new C ();
19                         if (o0.GetType() != typeof (A.B.C))
20                                 error += " 'new' keyword,";
21
22                         C o1 = new C ();
23                         if (o1.GetType () != typeof (A.B.C))
24                                 error += " local declaration,";
25
26                         object o2 = new A.B.C ();
27                         if (!(o2 is C))
28                                 error += " 'is' keyword,";
29
30                         object o3 = o2 as C;
31                         if (o3 == null)
32                                 error += " 'as' keyword,";
33
34                         try {
35                                 object o4 = (C) o2;
36                         }
37                         catch {
38                                 error += " type cast,";
39                         }
40
41                         try {
42                                 object o5 = (C) (o2);
43                         }
44                         catch {
45                                 error += " invocation-or-cast,";
46                         }
47
48                         object o6 = new C [1];
49
50                         if (o6.GetType ().GetElementType () != typeof (A.B.C))
51                                 error += " array creation,";
52
53                         if (typeof (C []).GetElementType () != typeof (A.B.C))
54                                 error += " composed cast (array),";
55
56                         ArrayList a = new ArrayList ();
57                         a.Add (new A.B.C ());
58
59                         try {
60                                 foreach (C c in a)
61                                 { 
62                                 }
63                         }
64                         catch {
65                                 error += " 'foreach' statement,";
66                         }
67
68                         if (error.Length != 0)
69                                 throw new Exception ("The following couldn't resolve C as A+B+C:" + error);
70                 }
71         }
72
73         public static void Main()
74         {
75                 object o = new A.B();
76         }
77 }