Merge pull request #2698 from esdrubal/iosxmlarray
[mono.git] / mcs / tests / gtest-540.cs
1 // lifted null binary operators
2
3 using System;
4
5 class C
6 {
7         public static int Main ()
8         {
9                 bool v;
10                 v = (true & null) == null;
11                 if (!v)
12                         return 1;
13
14                 v = (false & null) != null;
15                 if (!v)
16                         return 2;
17                 
18                 v = (null & true) == null;
19                 if (!v)
20                         return 3;
21
22                 v = (null & false) != null;
23                 if (!v)
24                         return 4;
25
26                 v = (true | null) == null;
27                 if (v != false)
28                         return 11;
29
30                 v = (false | null) != null;
31                 if (v != false)
32                         return 12;
33
34                 v = (null | true) == null;
35                 if (v != false)
36                         return 13;
37
38                 v = (null | false) != null;
39                 if (v != false)
40                         return 14;
41                 
42                 v = (null & 1) == null;
43                 if (v != true)
44                         return 20;
45                 
46                 v = (null & 0) != null;
47                 if (v != false)
48                         return 21;
49
50                 bool? a = false;
51                 bool? b = true;
52
53                 if ((a & null) != false)
54                         return 50;
55
56                 if ((b & null) != null)
57                         return 51;
58                 
59                 if ((null & a) != false)
60                         return 52;
61                 
62                 if ((null & b) != null)
63                         return 53;
64
65                 if ((a & true) != false)
66                         return 54;
67                 
68                 if ((true & a) != false)
69                         return 55;
70
71                 if ((a | null) != null)
72                         return 60;
73
74                 if ((b | null) != true)
75                         return 61;
76                 
77                 if ((null | a) != null)
78                         return 62;
79                 
80                 if ((null | b) != true)
81                         return 63;
82                 
83                 if ((a | true) != true)
84                         return 64;
85                 
86                 if ((true | a) != true)
87                         return 65;
88
89                 var b4 = true;
90                 if ((b4 & null) != null)
91                         return 100;
92
93                 if ((null & b4) != null)
94                         return 101;
95
96                 if ((b4 | null) != true)
97                         return 102;
98
99                 if ((null | b4) != true)
100                         return 103;
101
102                 bool? x_n = null;
103                 bool? x_f = false;
104                 bool? x_t = true;
105
106                 bool? res;
107                 res = null & x_n;
108                 if (res.HasValue)
109                         return 201;
110
111                 res = null & x_t;
112                 if (res.HasValue)
113                         return 202;
114
115                 res = null & x_f;
116                 if (res.Value != false)
117                         return 203;
118
119                 res = null | x_n;
120                 if (res.HasValue)
121                         return 204;
122
123                 res = null | x_t;
124                 if (res.Value != true)
125                         return 205;
126
127                 res = null | x_f;
128                 if (res.HasValue)
129                         return 206;
130                 
131                 return 0;
132         }
133         
134         // This does not look right but C# spec needs tidying up to special case it
135         void BrokenLiftedNull ()
136         {
137                 int i = 44;
138                 int? u = null;
139                 i <<= u;
140                 i <<= null;
141         }
142 }