Files
kotlin/compiler/testData/codegen/box/smartCasts/falseSmartCast.kt
Mikhail Glukhikh 0d35033106 Introduction of CastedClassReceiver and its handling in codegen #KT-6744 Fixed
ClassReceiver converted to Kotlin
Also #KT-7617 Fixed
2015-11-10 20:20:51 +03:00

17 lines
317 B
Kotlin
Vendored

open class SuperFoo {
public fun bar(): String {
if (this is Foo) {
superFoo() // Smart cast
return baz() // Cannot be cast
}
return baz()
}
public fun baz() = "OK"
}
class Foo : SuperFoo() {
public fun superFoo() {}
}
fun box(): String = Foo().bar()