You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/Misc/misc_diagnostics.swift
+5-2Lines changed: 5 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -8,8 +8,11 @@ import CoreGraphics
8
8
varroomName:String?
9
9
10
10
iflet realRoomName = roomName as!NSString{ // expected-warning{{forced cast from 'String?' to 'NSString' only unwraps and bridges; did you mean to use '!' with 'as'?}}
11
-
// expected-error@-1{{initializer for conditional binding must have Optional type, not 'NSString'}}
12
-
11
+
// expected-error@-1{{initializer for conditional binding must have Optional type, not 'NSString'}}
12
+
// expected-warning@-2{{treating a forced downcast to 'NSString' as optional will never produce 'nil'}}
13
+
// expected-note@-3{{add parentheses around the cast to silence this warning}}
14
+
// expected-note@-4{{use 'as?' to perform a conditional downcast to 'NSString'}}
0 commit comments