Files
kotlin-fork/compiler/testData/codegen/box/defaultArguments/function/covariantOverrideGeneric.kt
T
2018-06-09 19:15:38 +03:00

12 lines
294 B
Kotlin
Vendored

// IGNORE_BACKEND: JS_IR
open class Foo {
open fun foo(x: CharSequence = "O"): CharSequence = x
}
class Bar<T : String>: Foo() {
override fun foo(x: CharSequence): T { // Note the covariant return type
return (x.toString() + "K") as T
}
}
fun box() = Bar<String>().foo()