@@ -138,7 +138,6 @@ limitXY(someInt, toGamut: intArray) {} // expected-error{{cannot invoke 'limitX
138
138
// <rdar://problem/23036383> QoI: Invalid trailing closures in stmt-conditions produce lowsy diagnostics
139
139
func retBool( x: ( ) -> Int ) -> Bool { }
140
140
func maybeInt( _: ( ) -> Int ) -> Int ? { }
141
- func twoClosureArgs( _: ( ) -> Void , _: ( ) -> Void ) -> Bool { }
142
141
class Foo23036383 {
143
142
init ( ) { }
144
143
func map( _: ( Int ) -> Int ) -> Int ? { }
@@ -203,82 +202,7 @@ func r23036383(foo: Foo23036383?, obj: Foo23036383) {
203
202
204
203
if let _ = maybeInt { 1 } , retBool { 1 } { }
205
204
// expected-error@-1 {{trailing closure requires parentheses for disambiguation in this context}} {{22-23=(}} {{28-28=)}}
206
- // expected-error@-2 {{trailing closure requires parentheses for disambiguation in this context}} {{37-38=(x: }} {{43-43=)}}
207
-
208
- if let _ = foo? . map { $0+ 1 } . map { $0+ 1 } { } // expected-error {{trailing closure requires parentheses for disambiguation in this context}} {{33-34=(}} {{40-40=)}}
209
- // expected-error@-1 {{trailing closure requires parentheses for disambiguation in this context}} {{22-23=(}} {{29-29=)}}
210
-
211
- if let _ = foo? . map { $0+ 1 } . map ( { $0+ 1 } ) { } // expected-error {{trailing closure requires parentheses for disambiguation in this context}} {{22-23=(}} {{29-29=)}}
212
-
213
- if let _ = foo? . map { $0+ 1 } . map ( { $0+ 1 } ) . map { $0+ 1 } { } // expected-error {{trailing closure requires parentheses for disambiguation in this context}} {{45-45=(}} {{51-51=)}}
214
- // expected-error@-1 {{trailing closure requires parentheses for disambiguation in this context}} {{22-23=(}} {{29-29=)}}
215
-
216
- if twoClosureArgs ( { } ) { } { } // expected-error {{trailing closure requires parentheses for disambiguation in this context}} {{23-25=, }} {{27-27=)}}
217
-
218
- if let _ = ( foo? . map { $0+ 1 } . map ( { $0+ 1 } ) . map { $0+ 1 } ) { } // OK
219
-
220
- if let _ = ( foo? . map { $0+ 1 } . map ( { $0+ 1 } ) ) . map ( { $0+ 1 } ) { } // OK
221
- }
222
-
223
- func id< T> ( fn: ( ) -> T ) -> T { return fn ( ) }
224
- func any< T> ( fn: ( ) -> T ) -> Any { return fn ( ) }
225
-
226
- func testSR8736( ) {
227
- if !id { true } { return } // expected-error {{trailing closure requires parentheses for disambiguation in this context}}
228
-
229
- if id { true } == true { return } // expected-error {{trailing closure requires parentheses for disambiguation in this context}}
230
-
231
- if true == id { true } { return } // expected-error {{trailing closure requires parentheses for disambiguation in this context}}
232
-
233
- if id { true } ? true : false { return } // expected-error {{trailing closure requires parentheses for disambiguation in this context}}
234
-
235
- if true ? id { true } : false { return } // expected-error {{trailing closure requires parentheses for disambiguation in this context}}
236
-
237
- if true ? true : id { false } { return } // expected-error {{trailing closure requires parentheses for disambiguation in this context}}
238
-
239
- if id { [ false , true ] } [ 0 ] { return } // expected-error {{trailing closure requires parentheses for disambiguation in this context}}
240
-
241
- if id { { true } } ( ) { return } // expected-error {{trailing closure requires parentheses for disambiguation in this context}}
242
-
243
- if any { true } as! Bool { return } // expected-error {{trailing closure requires parentheses for disambiguation in this context}}
244
-
245
- if let _ = any { " test " } as? Int { return } // expected-error {{trailing closure requires parentheses for disambiguation in this context}}
246
-
247
- if any { " test " } is Int { return } // expected-error {{trailing closure requires parentheses for disambiguation in this context}}
248
-
249
- if let _ = id { [ ] as [ Int ] ? } ? . first { return } // expected-error {{trailing closure requires parentheses for disambiguation in this context}}
250
-
251
- if id { true as Bool ? } ! { return } // expected-error {{trailing closure requires parentheses for disambiguation in this context}}
252
-
253
- if case id { 1 } = 1 { return } // expected-error {{trailing closure requires parentheses for disambiguation in this context}}
254
-
255
- if case 1 = id { 1 } { return } // expected-error {{trailing closure requires parentheses for disambiguation in this context}}
256
-
257
- if case 1 = id { 1 } /*comment*/ { return } // expected-error {{trailing closure requires parentheses for disambiguation in this context}}
258
-
259
- if case ( id { 1 } ) = 1 { return } // OK
260
-
261
- if case 1 = ( id { 1 } ) { return } // OK
262
-
263
- if [ id { true } ] . count == 0 { return } // OK
264
-
265
- if [ id { true } : " test " ] . keys. count == 0 { return } // OK
266
-
267
- if " \( id { true } ) " == " foo " { return } // OK
268
-
269
- if ( id { true } ) { return } // OK
270
-
271
- if ( id { true } ) { }
272
- [ 1 , 2 , 3 ] . count // expected-warning {{expression of type 'Int' is unused}}
273
-
274
- if true { }
275
- ( ) // OK
276
-
277
- if true
278
- {
279
-
280
- }
281
- ( ) // OK
205
+ // expected-error@-2 {{trailing closure requires parentheses for disambiguation in this context}} {{37-38=(x: }} {{43-43=)}}
282
206
}
283
207
284
208
func overloadOnLabel( a: ( ) -> Void ) { }
0 commit comments