JVM IR: add test for complex generic diamond hierarchy

This is a test for KT-43832, which is fixed in the previous commit.
This commit is contained in:
Alexander Udalov
2020-12-08 20:37:18 +01:00
parent 3370fa03d7
commit 3e0efeef31
9 changed files with 74 additions and 0 deletions
@@ -31636,6 +31636,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/traits/doubleDiamond.kt");
}
@TestMetadata("doubleGenericDiamond.kt")
public void testDoubleGenericDiamond() throws Exception {
runTest("compiler/testData/codegen/box/traits/doubleGenericDiamond.kt");
}
@TestMetadata("genericMethod.kt")
public void testGenericMethod() throws Exception {
runTest("compiler/testData/codegen/box/traits/genericMethod.kt");
@@ -0,0 +1,34 @@
// FILE: lib.kt
var result = ""
interface Left
interface Right
class Bottom : Left, Right
interface A<T> {
fun f(): T? {
result = "A"
return null
}
}
interface B<T : Left> : A<T> {
override fun f(): T? {
result = "B"
return null
}
}
abstract class C<T> : A<T>
abstract class D<T : Right> : C<T>()
// FILE: box.kt
class Z : D<Bottom>(), B<Bottom>
fun box(): String {
Z().f()
return if (result == "B") "OK" else "Fail: $result"
}
@@ -33407,6 +33407,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/traits/doubleDiamond.kt");
}
@TestMetadata("doubleGenericDiamond.kt")
public void testDoubleGenericDiamond() throws Exception {
runTest("compiler/testData/codegen/box/traits/doubleGenericDiamond.kt");
}
@TestMetadata("genericMethod.kt")
public void testGenericMethod() throws Exception {
runTest("compiler/testData/codegen/box/traits/genericMethod.kt");
@@ -31041,6 +31041,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/traits/doubleDiamond.kt");
}
@TestMetadata("doubleGenericDiamond.kt")
public void testDoubleGenericDiamond() throws Exception {
runTest("compiler/testData/codegen/box/traits/doubleGenericDiamond.kt");
}
@TestMetadata("genericMethod.kt")
public void testGenericMethod() throws Exception {
runTest("compiler/testData/codegen/box/traits/genericMethod.kt");
@@ -31636,6 +31636,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/traits/doubleDiamond.kt");
}
@TestMetadata("doubleGenericDiamond.kt")
public void testDoubleGenericDiamond() throws Exception {
runTest("compiler/testData/codegen/box/traits/doubleGenericDiamond.kt");
}
@TestMetadata("genericMethod.kt")
public void testGenericMethod() throws Exception {
runTest("compiler/testData/codegen/box/traits/genericMethod.kt");
@@ -25592,6 +25592,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
runTest("compiler/testData/codegen/box/traits/doubleDiamond.kt");
}
@TestMetadata("doubleGenericDiamond.kt")
public void testDoubleGenericDiamond() throws Exception {
runTest("compiler/testData/codegen/box/traits/doubleGenericDiamond.kt");
}
@TestMetadata("genericMethod.kt")
public void testGenericMethod() throws Exception {
runTest("compiler/testData/codegen/box/traits/genericMethod.kt");
@@ -25592,6 +25592,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/traits/doubleDiamond.kt");
}
@TestMetadata("doubleGenericDiamond.kt")
public void testDoubleGenericDiamond() throws Exception {
runTest("compiler/testData/codegen/box/traits/doubleGenericDiamond.kt");
}
@TestMetadata("genericMethod.kt")
public void testGenericMethod() throws Exception {
runTest("compiler/testData/codegen/box/traits/genericMethod.kt");
@@ -25592,6 +25592,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/traits/doubleDiamond.kt");
}
@TestMetadata("doubleGenericDiamond.kt")
public void testDoubleGenericDiamond() throws Exception {
runTest("compiler/testData/codegen/box/traits/doubleGenericDiamond.kt");
}
@TestMetadata("genericMethod.kt")
public void testGenericMethod() throws Exception {
runTest("compiler/testData/codegen/box/traits/genericMethod.kt");
@@ -13890,6 +13890,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
runTest("compiler/testData/codegen/box/traits/doubleDiamond.kt");
}
@TestMetadata("doubleGenericDiamond.kt")
public void testDoubleGenericDiamond() throws Exception {
runTest("compiler/testData/codegen/box/traits/doubleGenericDiamond.kt");
}
@TestMetadata("genericMethod.kt")
public void testGenericMethod() throws Exception {
runTest("compiler/testData/codegen/box/traits/genericMethod.kt");