Files
kotlin-fork/compiler/testData/codegen/box/defaultArguments/function/covariantOverride.kt
T
2022-05-20 12:22:43 +03:00

12 lines
250 B
Kotlin
Vendored

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()