Files
kotlin/compiler/testData/codegen/box/defaultArguments/function/covariantOverride.kt
2019-11-19 11:00:09 +03:00

12 lines
279 B
Kotlin
Vendored

// IGNORE_BACKEND_FIR: JVM_IR
open class Foo {
open fun foo(x: CharSequence = "O"): CharSequence = x
}
class Bar(): Foo() {
override fun foo(x: CharSequence): String { // Note the covariant return type
return x.toString() + "K"
}
}
fun box() = Bar().foo()