Files
kotlin/compiler/testData/codegen/box/defaultArguments/function/covariantOverrideGeneric.kt
Denis Zharkov ede4b61980 Add tests for obsolete issue
#KT-7412 Obsolete
2016-01-20 14:27:53 +03:00

11 lines
269 B
Kotlin
Vendored

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