blob: acfbc534646d4596ccf5590782f4ca36a4fd15d9 (
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
78
79
80
81
82
83
84
85
86
|
//
// Tests for bug # 52427 -- property inhertance stuff.
// these tests are problems that cropped up while
// making the patch. We dont want to regress on these.
//
class A { public virtual int Blah { get { return 1; } set {} } }
class B : A {
public override int Blah { get { return 2; } }
public static bool Test ()
{
// Make sure we see that set in A
B b = new B ();
if (b.Blah != 2) return false;
if (b.Blah ++ != 2) return false;
b.Blah = 0;
return true;
}
}
abstract class C { public abstract int Blah { get; set; } }
class D : C { public override int Blah { get { return 2; } set {} } }
class E : D {
// Make sure we see that there is actually a base
// which we can call
public override int Blah { get { return base.Blah; } }
public static bool Test ()
{
E e = new E ();
if (e.Blah != 2) return false;
if (e.Blah ++ != 2) return false;
e.Blah = 2;
return true;
}
}
interface IBlah {
int this [int i] { get; set; }
int Blah { get; set; }
}
class F : IBlah {
int IBlah.this [int i] { get { return 1; } set {} }
int IBlah.Blah { get { return 1; } set {} }
public int this [int i] { get { return 2; } set {} }
public int Blah { get { return 2; } set {} }
public static bool Test ()
{
// Make sure we dont see a conflict between
// the explicit impl and the non interface version
F f = new F ();
if (f.Blah != 2) return false;
if (f.Blah ++ != 2) return false;
f.Blah = 2;
if (f [1] != 2) return false;
if (f [1] ++ != 2) return false;
f [1] = 2;
return true;
}
}
class Driver {
public static int Main ()
{
if (! B.Test ()) return 1;
if (! E.Test ()) return 2;
if (! F.Test ()) return 3;
return 0;
}
}
|