Files
kotlin/compiler/testData/codegen/box/defaultArguments/function/covariantOverride.kt
2018-06-21 13:27:17 +03:00

11 lines
249 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()