We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 5c5d2ea + b6c3ad3 commit 5810000Copy full SHA for 5810000
test/stmt/switch_nil.swift
@@ -12,3 +12,19 @@ func test() {
12
break
13
}
14
15
+
16
+struct Nilable: ExpressibleByNilLiteral {
17
+ init(nilLiteral: ()) {}
18
+}
19
20
+func testNil() {
21
+ // N.B. A deeply confusing case as no conversion is performed on the `nil`
22
+ // literal. Instead, the match subject is converted to `Nilable?` and compared
23
+ // using ~=.
24
+ switch Nilable(nilLiteral: ()) {
25
+ case nil: // expected-warning {{type 'Nilable' is not optional, value can never be nil}}
26
+ break
27
+ default:
28
29
+ }
30
0 commit comments