Merge pull request #495 from nicolas-raoul/fix-for-issue2907-with-no-formatting-changes
[mono.git] / mcs / tests / test-87.cs
1 //
2 // Tests the lookup of names on nested classes.
3 //
4 // Tests nested interfaces
5 //
6 class Top {
7
8         class X {
9
10         }
11
12         class Y : X {
13         }
14
15         interface A {
16                 int get_one ();
17         }
18
19         interface B : A {
20                 int get_two ();
21         }
22
23         public class XA : A {
24                 public int get_one () { return 1; }
25         }
26
27         class XB : B {
28                 public int get_one () { return 1; }
29                 public int get_two () { return 2; }
30         }
31         
32         public static int Main ()
33         {
34                 XA x = new XA ();
35
36                 if (x.get_one () != 1)
37                         return 1;
38
39                 XB b = new XB ();
40                 if (x.get_one () != 1)
41                         return 2;
42                 if (b.get_two () != 2)
43                         return 3;
44
45                 XB [] xb = null;
46
47                 return 0;
48         }
49 }
50
51 //
52 // The following tests that the compiler will actually properly
53 // find the types that are requested (they are nested types)
54 //
55 class Other {
56         public void X ()
57         {
58                 Top.XA xa = null;
59                 Top.XA [] xb = null;
60         }
61 }       
62