Files
swift-mirror/test/SILGen/optional_to_optional.swift
Michael Gottesman 9e13779702 [ownership] Remove most -enable-sil-ownership from SILGen now that %target-swift-emit-silgen does it automatically.
I did this using a sed pattern and verified by hand that I was only touching
target-swift-emit-silgen lines.
2018-12-13 11:54:54 -08:00

33 lines
734 B
Swift

// RUN: %target-swift-emit-silgen %s | %FileCheck %s
protocol P {}
class Foo {
var x: Foo!
var p: P!
// CHECK-LABEL: {{.*3Foo.*3foo.*}}
// CHECK-NOT: unchecked_{{.*}}cast {{.*}} Optional{{.*}} to Optional
func foo() -> Foo? {
return x
}
// CHECK-LABEL: {{.*3Foo.*3poo.*}}
// CHECK-NOT: unchecked_{{.*}}cast {{.*}} Optional{{.*}} to Optional
func poo() -> P? {
return p
}
// CHECK-LABEL: {{.*3Foo.*3bar.*}}
// CHECK-NOT: unchecked_{{.*}}cast {{.*}} Optional{{.*}} to Optional
func bar() -> Foo? {
var x2 = x
}
// CHECK-LABEL: {{.*3Foo.*3par.*}}
// CHECK-NOT: unchecked_{{.*}}cast {{.*}} Optional{{.*}} to Optional
func par(p3: P) -> P? {
var p2 = p
p2! = p3
p2? = p3
}
}