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()
@@ -2778,6 +2778,18 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
doTest(fileName);
}
@TestMetadata("covariantOverride.kt")
public void testCovariantOverride() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/defaultArguments/function/covariantOverride.kt");
doTest(fileName);
}
@TestMetadata("covariantOverrideGeneric.kt")
public void testCovariantOverrideGeneric() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/defaultArguments/function/covariantOverrideGeneric.kt");
doTest(fileName);
}
@TestMetadata("extensionFunctionManyArgs.kt")
public void testExtensionFunctionManyArgs() throws Exception {
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/defaultArguments/function/extensionFunctionManyArgs.kt");