[mcs] Pending implementation of accessors cannot hide base implementation with differ...
[mono.git] / mcs / tests / test-147.cs
1 using System;
2
3 public class X
4 {
5         public long Value = 5;
6         public static long StaticValue = 6;
7
8         public static X Foo ()
9         {
10                 return new X ();
11         }
12         
13         public static X Bar ()
14         {
15                 return Foo ();
16         }
17
18         public X Baz ()
19         {
20                 return Bar ();
21         }
22
23         public uint Property {
24                 get {
25                         return 3;
26                 }
27         }
28
29         public static uint StaticProperty {
30                 get {
31                         return 20;
32                 }
33         }
34
35         public int this [int index] {
36                 get {
37                         return 1;
38                 }
39         }
40 }
41
42 public class Y : X
43 {
44         new public long Value = 8;
45         new public static long StaticValue = 9;
46
47         public static new Y Foo ()
48         {
49                 return new Y ();
50         }
51
52         public static new Y Bar ()
53         {
54                 return Foo ();
55         }
56
57         public new Y Baz ()
58         {
59                 return Bar ();
60         }
61
62         public new uint Property {
63                 get {
64                         return 4;
65                 }
66         }
67
68         public new static uint StaticProperty {
69                 get {
70                         return 21;
71                 }
72         }
73
74         public new int this [int index] {
75                 get {
76                         return 2;
77                 }
78         }
79 }
80
81 public class Z : Y
82 {
83         public int Test () {
84                 if (Property != 4)
85                         return 20;
86
87                 if (StaticProperty != 21)
88                         return 21;
89
90                 if (((X) this).Property != 3)
91                         return 22;
92
93                 if (X.StaticProperty != 20)
94                         return 23;
95
96                 if (this [5] != 2)
97                         return 24;
98
99                 if (((X) this) [6] != 1)
100                         return 25;
101
102                 return 0;
103         }
104 }
105
106 public class Test
107 {
108         public static int Main ()
109         {
110                 Y y = new Y ();
111                 X a,b,c,d;
112
113                 a = Y.Bar ();
114                 if (!(a is Y))
115                         return 1;
116
117                 b = y.Baz ();
118                 if (!(b is Y))
119                         return 2;
120
121                 c = X.Bar ();
122                 if (c is Y)
123                         return 3;
124
125                 d = ((X) y).Baz ();
126                 if (d is Y)
127                         return 4;
128
129                 if (y.Value != 8)
130                         return 5;
131
132                 if (((X) y).Value != 5)
133                         return 6;
134
135                 if (Y.StaticValue != 9)
136                         return 7;
137
138                 if (X.StaticValue != 6)
139                         return 8;
140
141                 if (y.Property != 4)
142                         return 9;
143
144                 if (((X) y).Property != 3)
145                         return 10;
146
147                 if (y [5] != 2)
148                         return 11;
149
150                 if (((X) y) [7] != 1)
151                         return 10;
152
153                 if (X.StaticProperty != 20)
154                         return 11;
155
156                 if (Y.StaticProperty != 21)
157                         return 12;
158
159                 Z z = new Z ();
160
161                 return z.Test ();
162         }
163 }