Skip to content

Commit 32bacc8

Browse files
committed
More complicated as? test.
1 parent 78fba7e commit 32bacc8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/Constraints/bridging.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,12 @@ func rdar20029786(_ ns: NSString?) {
298298
var s5: String = (ns ?? "str") as String // fixed version
299299
}
300300

301+
// Make sure more complicated cast has correct parenthesization
302+
func castMoreComplicated(anInt: Int?) {
303+
let _: (NSObject & NSCopying)? = anInt // expected-error{{cannot convert value of type 'Int?' to specified type '(NSObject & NSCopying)?'}}{{41-41= as (NSObject & NSCopying)?}}
304+
}
305+
306+
301307
// <rdar://problem/19813772> QoI: Using as! instead of as in this case produces really bad diagnostic
302308
func rdar19813772(_ nsma: NSMutableArray) {
303309
var a1 = nsma as! Array // expected-error{{generic parameter 'Element' could not be inferred in cast to 'Array'}} expected-note {{explicitly specify the generic arguments to fix this issue}} {{26-26=<Any>}}

0 commit comments

Comments
 (0)