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 5f2377a + 720d22d commit 6f551ccCopy full SHA for 6f551cc
test/SILGen/if_expr.swift
@@ -571,3 +571,12 @@ func testCaptureList() -> Int {
571
let fn = { [x = if .random() { 0 } else { 1 }] in x }
572
return fn()
573
}
574
+
575
+// https://github.com/apple/swift/issues/68764
576
+func testConditionalCast<T>(_ x: Any) -> T? {
577
+ if .random() {
578
+ x as? T
579
+ } else {
580
+ nil
581
+ }
582
+}
test/SILGen/switch_expr.swift
@@ -767,3 +767,11 @@ func testCaptureList() -> Int {
767
let fn = { [x = switch Bool.random() { case true: 0 case false: 1 }] in x }
768
769
770
771
772
+func testConditionalCast<T>(_ x: Any, _ y: Int) -> T? {
773
+ switch y {
774
+ default:
775
776
777
0 commit comments