[mcs] Add codegen for null operator on result of awaited instance expression of prope...
[mono.git] / mcs / tests / test-179.cs
1
2 class A {
3         double d1,d2;
4         public double this[double x] {
5                 set {
6                         d1 = x;
7                         d2 = value;
8                 }
9                 get {
10                         if (d1 == x) {
11                                 return d2;
12                         }
13                         return 0.0;
14                 }
15         }
16 }
17
18 class B : A {
19         double d1,d2;
20         public new double this[double x] {
21                 set {
22                         d1 = x;
23                         d2 = value;
24                 }
25                 get {
26                         if (d1 == x) {
27                                 return d2;
28                         }
29                         return 0.0;
30                 }
31         }
32 }
33
34 class C : B{
35         string s1,s2;
36         int i1,i2;
37         public string this[string x] {
38                 set {
39                         s1 = x;
40                         s2 = value;
41                 }
42                 get {
43                         if (s1 == x) {
44                                 return s2;
45                         }
46                         return "";
47                 }
48         }
49         public int this[int x] {
50                 set {
51                         i1 = x;
52                         i2 = value;
53                 }
54                 get {
55                         if (i1 == x) {
56                                 return i2;
57                         }
58                         return 0;
59                 }
60         }
61 }
62
63 struct EntryPoint {
64
65         public static int Main (string[] args) {
66                 C test = new C();
67
68                 test[333.333] = 444.444;
69                 if (test[333.333] != 444.444)
70                         return 1;
71
72                 test["a string"] = "another string";
73                 if (test["a string"] != "another string")
74                         return 2;
75
76                 test[111] = 222;
77                 if (test[111] != 222)
78                         return 3;
79
80                 System.Console.WriteLine ("Passes");
81                 return 0;
82         }
83
84 }