[mcs] Add codegen for null operator on result of awaited instance expression of prope...
[mono.git] / mcs / tests / test-316.cs
1 using System;
2
3 interface IA
4 {
5         int Add(int i);
6 }
7
8 interface IB
9 {
10         int Add(int i); 
11 }
12
13 interface IC : IA, IB {}
14
15 interface IE : ICloneable, IDisposable {
16         void doom ();
17 }
18
19 class D : IC, IB
20 {
21         int IA.Add (int i) {
22                 return 5;
23         }
24         
25         int IB.Add (int i) {
26                 return 6;
27         }
28 }
29
30 class E: IE, IC {
31         public E() {
32         }
33         public void doom () {
34                 return;
35         }
36         public Object Clone () {
37                 return null;
38         }
39         public void Dispose () {}
40         int IA.Add (int i) {
41                 return 7;
42         }
43         
44         int IB.Add (int i) {
45                 return 8;
46         }
47 }
48
49 class C
50 {
51         static int Test(IC n) {
52                 IA a = (IA) n;
53                 if (a.Add(0) != 5)
54                         return 1;
55
56                 if (((IA)n).Add(0) != 5)
57                         return 1;
58
59                 if (((IB)n).Add(0) != 6)
60                         return 1;
61
62
63                 return 0;
64         }
65
66         static void Test2(IE ie) {
67                 ie.doom ();
68                 ie.Clone();
69                 ie.Dispose ();
70         }
71
72         public static int Main()
73         {
74                 D d = new D();
75                 E e = new E();
76                 Test (e);
77                 Test2 (e);
78                 
79                 return Test (d);
80         }
81 }
82