1
2
3
4
5
6
7 package expr2
8
9 func _bool() {
10 const t = true == true
11 const f = true == false
12 _ = t < f
13 _ = 0 == t
14 var b bool
15 var x, y float32
16 b = x < y
17 _ = b
18 _ = struct{b bool}{x < y}
19 }
20
21
22 var (
23 v0 = nil == nil
24 )
25
26 func arrays() {
27
28 var a, b [10]int
29 _ = a == b
30 _ = a != b
31 _ = a < b
32 _ = a == nil
33
34 type C [10]int
35 var c C
36 _ = a == c
37
38 type D [10]int
39 var d D
40 _ = c == d
41
42 var e [10]func() int
43 _ = e == e
44 }
45
46 func structs() {
47
48 var s, t struct {
49 x int
50 a [10]float32
51 _ bool
52 }
53 _ = s == t
54 _ = s != t
55 _ = s < t
56 _ = s == nil
57
58 type S struct {
59 x int
60 a [10]float32
61 _ bool
62 }
63 type T struct {
64 x int
65 a [10]float32
66 _ bool
67 }
68 var ss S
69 var tt T
70 _ = s == ss
71 _ = ss == tt
72
73 var u struct {
74 x int
75 a [10]map[string]int
76 }
77 _ = u == u
78 }
79
80 func pointers() {
81
82 _ = nil == nil
83 _ = nil != nil
84 _ = nil < nil
85 _ = nil <= nil
86 _ = nil > nil
87 _ = nil >= nil
88
89
90 var p, q *int
91 _ = p == q
92 _ = p != q
93
94 _ = p == nil
95 _ = p != nil
96 _ = nil == q
97 _ = nil != q
98
99 _ = p < q
100 _ = p <= q
101 _ = p > q
102 _ = p >= q
103
104
105 type (
106 S1 struct{}
107 S2 struct{}
108 P1 *S1
109 P2 *S2
110 )
111 var (
112 ps1 *S1
113 ps2 *S2
114 p1 P1
115 p2 P2
116 )
117 _ = ps1 == ps1
118 _ = ps1 == ps2
119 _ = ps2 == ps1
120
121 _ = p1 == p1
122 _ = p1 == p2
123
124 _ = p1 == ps1
125 }
126
127 func channels() {
128
129 var c, d chan int
130 _ = c == d
131 _ = c != d
132 _ = c == nil
133 _ = c < d
134
135
136 type (
137 C1 chan int
138 C1r <-chan int
139 C1s chan<- int
140 C2 chan float32
141 )
142 var (
143 c1 C1
144 c1r C1r
145 c1s C1s
146 c1a chan int
147 c2 C2
148 )
149 _ = c1 == c1
150 _ = c1 == c1r
151 _ = c1 == c1s
152 _ = c1r == c1s
153 _ = c1 == c1a
154 _ = c1a == c1
155 _ = c1 == c2
156 _ = c1a == c2
157
158
159 var (
160 d1 chan int
161 d1r <-chan int
162 d1s chan<- int
163 d1a chan<- int
164 d2 chan float32
165 )
166 _ = d1 == d1
167 _ = d1 == d1r
168 _ = d1 == d1s
169 _ = d1r == d1s
170 _ = d1 == d1a
171 _ = d1a == d1
172 _ = d1 == d2
173 _ = d1a == d2
174 }
175
176
177 type S1 struct{}
178 type S11 struct{}
179 type S2 struct{}
180 func (*S1) m() int
181 func (*S11) m() int
182 func (*S11) n()
183 func (*S2) m() float32
184
185 func interfaces() {
186
187 var i, j interface{ m() int }
188 _ = i == j
189 _ = i != j
190 _ = i == nil
191 _ = i < j
192
193
194 var ii interface { m() int; n() }
195 var k interface { m() float32 }
196 _ = i == ii
197 _ = i == k
198
199
200 var s1 S1
201 var s11 S11
202 var s2 S2
203
204 _ = i == 0
205 _ = i == s1
206 _ = i == &s1
207 _ = i == &s11
208
209 _ = i == s2
210 _ = i == & s2
211
212
213
214 _ = interface{}(nil) == [ ]int(nil)
215
216
217 var e interface{}
218 var s []int
219 var x int
220 _ = e == s
221 _ = s == e
222 _ = e < x
223 _ = x < e
224 }
225
226 func slices() {
227
228 var s []int
229 _ = s == nil
230 _ = s != nil
231 _ = s < nil
232
233
234 _ = s == s
235 _ = s < s
236 }
237
238 func maps() {
239
240 var m map[string]int
241 _ = m == nil
242 _ = m != nil
243 _ = m < nil
244
245
246 _ = m == m
247 _ = m < m
248 }
249
250 func funcs() {
251
252 var f func(int) float32
253 _ = f == nil
254 _ = f != nil
255 _ = f < nil
256
257
258 _ = f == f
259 _ = f < f
260 }
261
View as plain text