blob: c753a567a24655786d1498c524142ad0a3496eba [file] [log] [blame]
// RUN: %target-swift-frontend -O -emit-sil %s | %FileCheck %s
// Check that the optimizer does not crash.
public class Base {
@inline(never)
final func next() -> Base? {
return self
}
}
public class Derived : Base {}
// CHECK: sil {{.*}}testit
public func testit(_ x: Base?) -> Derived? {
var i: Base? = x
while (i is Derived) == false && i != nil {
i = i?.next()
}
return i as? Derived
}