mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 15:53:19 +00:00
17 lines
317 B
Kotlin
Vendored
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() |