Add tests for obsolete issue

#KT-7412 Obsolete
This commit is contained in:
Denis Zharkov
2016-01-20 14:20:39 +03:00
parent 06fbc9bdd3
commit ede4b61980
3 changed files with 32 additions and 0 deletions
@@ -0,0 +1,10 @@
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()
@@ -0,0 +1,10 @@
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()