File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change 1
- // RUN: %target-typecheck-verify-swift -enable-objc-interop
2
- // REQUIRES: objc_interop
3
-
4
- import Foundation
1
+ // RUN: %target-typecheck-verify-swift
5
2
6
3
let ok = " A " as Character // OK
7
4
let succeed = " A " as? String // expected-warning {{always succeeds}}
@@ -18,10 +15,6 @@ let okUInt = 1 as UInt // OK
18
15
let badUInt = 1 as? UInt // expected-warning {{conditional downcast from literal to 'UInt' always fails; consider using 'as' coercion}} {{none}}
19
16
let badUInt1 = 1.0 as? UInt // expected-warning {{cast from 'Double' to unrelated type 'UInt' always fails}}
20
17
21
- // Can downcast by bridging
22
- let bridge = " A " as? NSString // expected-warning {{always succeeds}}
23
- let bridge1 = 1 as? NSNumber // expected-warning {{always succeeds}}
24
-
25
18
// Custom protocol adoption
26
19
struct S : ExpressibleByStringLiteral {
27
20
typealias StringLiteralType = String
Original file line number Diff line number Diff line change
1
+ // RUN: %target-typecheck-verify-swift -enable-objc-interop
2
+ // REQUIRES: OS=macosx
3
+
4
+ import Foundation
5
+
6
+ // Can downcast by bridging
7
+ let bridge = " A " as? NSString // expected-warning {{always succeeds}}
8
+ let bridge1 = 1 as? NSNumber // expected-warning {{always succeeds}}
You can’t perform that action at this time.
0 commit comments