Files
kotlin-fork/compiler/testData/codegen/box/fir/falsePositiveBoundSmartcast.kt
T
2021-03-04 17:09:17 +03:00

22 lines
306 B
Kotlin
Vendored

abstract class A {
abstract fun foo(): String
}
class B : A() {
override fun foo() = "OK"
}
class C : A() {
override fun foo() = "fail"
}
fun test(c: C, cond: Boolean): String {
var x: A = c
if (cond) {
x = B()
}
return x.foo()
}
fun box(): String = test(C(), true)