[JVM IR] Maintain KT-36188 bug compatibility between non-IR and IR
backends.
This commit is contained in:
committed by
Alexander Udalov
parent
435e74b74b
commit
2239b5ceab
Generated
+10
@@ -8535,6 +8535,16 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
runTest("compiler/testData/codegen/box/defaultArguments/function/innerExtentionFunctionManyArgs.kt");
|
runTest("compiler/testData/codegen/box/defaultArguments/function/innerExtentionFunctionManyArgs.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt36188.kt")
|
||||||
|
public void testKt36188() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/defaultArguments/function/kt36188.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt36188_2.kt")
|
||||||
|
public void testKt36188_2() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/defaultArguments/function/kt36188_2.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt5232.kt")
|
@TestMetadata("kt5232.kt")
|
||||||
public void testKt5232() throws Exception {
|
public void testKt5232() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/defaultArguments/function/kt5232.kt");
|
runTest("compiler/testData/codegen/box/defaultArguments/function/kt5232.kt");
|
||||||
|
|||||||
+8
-4
@@ -96,12 +96,16 @@ internal class InterfaceLowering(val context: JvmBackendContext) : IrElementTran
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
function.origin == IrDeclarationOrigin.FAKE_OVERRIDE -> {
|
function.origin == IrDeclarationOrigin.FAKE_OVERRIDE -> {
|
||||||
val implementation = function.resolveFakeOverride()!!
|
// We check to see if this is a default stub function BEFORE finding the implementation because of a front-end bug
|
||||||
|
// (KT-36188) where there could be multiple implementations. (resolveFakeOverride() only returns the implementation if
|
||||||
|
// there's only one.)
|
||||||
|
if (function.name.asString().endsWith("\$default")) {
|
||||||
|
continue@loop
|
||||||
|
}
|
||||||
|
val implementation = function.resolveFakeOverride() ?: error("No single implementation found for: ${function.render()}")
|
||||||
|
|
||||||
when {
|
when {
|
||||||
Visibilities.isPrivate(implementation.visibility) ||
|
Visibilities.isPrivate(implementation.visibility) || implementation.isMethodOfAny() ->
|
||||||
implementation.isMethodOfAny() ||
|
|
||||||
implementation.origin == IrDeclarationOrigin.FUNCTION_FOR_DEFAULT_PARAMETER ->
|
|
||||||
continue@loop
|
continue@loop
|
||||||
!implementation.hasJvmDefault() -> {
|
!implementation.hasJvmDefault() -> {
|
||||||
val defaultImpl = createDefaultImpl(function)
|
val defaultImpl = createDefaultImpl(function)
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
// IGNORE_BACKEND_FIR: JVM_IR
|
||||||
|
// IGNORE_BACKEND: JS
|
||||||
|
|
||||||
|
// Test for KT-36188 bug compatibility between non-IR and IR backends
|
||||||
|
|
||||||
|
interface A {
|
||||||
|
fun foo(a: String = "OK"): String
|
||||||
|
}
|
||||||
|
|
||||||
|
interface A2 : A
|
||||||
|
|
||||||
|
interface B {
|
||||||
|
fun foo(a: String = "Fail"): String
|
||||||
|
}
|
||||||
|
|
||||||
|
class Impl : A2, B {
|
||||||
|
override fun foo(a: String) = a
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String = Impl().foo()
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
// IGNORE_BACKEND_FIR: JVM_IR
|
||||||
|
// IGNORE_BACKEND: JS
|
||||||
|
|
||||||
|
// Test for KT-36188 bug compatibility between non-IR and IR backends
|
||||||
|
|
||||||
|
interface A {
|
||||||
|
fun foo(a: String = "OK"): String
|
||||||
|
}
|
||||||
|
|
||||||
|
interface A2 : A
|
||||||
|
|
||||||
|
interface B {
|
||||||
|
fun foo(a: String = "Fail"): String
|
||||||
|
}
|
||||||
|
|
||||||
|
interface C : A2, B
|
||||||
|
|
||||||
|
class Impl : C {
|
||||||
|
override fun foo(a: String) = a
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String = Impl().foo()
|
||||||
+10
@@ -9680,6 +9680,16 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
runTest("compiler/testData/codegen/box/defaultArguments/function/innerExtentionFunctionManyArgs.kt");
|
runTest("compiler/testData/codegen/box/defaultArguments/function/innerExtentionFunctionManyArgs.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt36188.kt")
|
||||||
|
public void testKt36188() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/defaultArguments/function/kt36188.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt36188_2.kt")
|
||||||
|
public void testKt36188_2() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/defaultArguments/function/kt36188_2.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt5232.kt")
|
@TestMetadata("kt5232.kt")
|
||||||
public void testKt5232() throws Exception {
|
public void testKt5232() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/defaultArguments/function/kt5232.kt");
|
runTest("compiler/testData/codegen/box/defaultArguments/function/kt5232.kt");
|
||||||
|
|||||||
+10
@@ -9680,6 +9680,16 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
runTest("compiler/testData/codegen/box/defaultArguments/function/innerExtentionFunctionManyArgs.kt");
|
runTest("compiler/testData/codegen/box/defaultArguments/function/innerExtentionFunctionManyArgs.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt36188.kt")
|
||||||
|
public void testKt36188() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/defaultArguments/function/kt36188.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt36188_2.kt")
|
||||||
|
public void testKt36188_2() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/defaultArguments/function/kt36188_2.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt5232.kt")
|
@TestMetadata("kt5232.kt")
|
||||||
public void testKt5232() throws Exception {
|
public void testKt5232() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/defaultArguments/function/kt5232.kt");
|
runTest("compiler/testData/codegen/box/defaultArguments/function/kt5232.kt");
|
||||||
|
|||||||
+10
@@ -8535,6 +8535,16 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTest("compiler/testData/codegen/box/defaultArguments/function/innerExtentionFunctionManyArgs.kt");
|
runTest("compiler/testData/codegen/box/defaultArguments/function/innerExtentionFunctionManyArgs.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt36188.kt")
|
||||||
|
public void testKt36188() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/defaultArguments/function/kt36188.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt36188_2.kt")
|
||||||
|
public void testKt36188_2() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/defaultArguments/function/kt36188_2.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt5232.kt")
|
@TestMetadata("kt5232.kt")
|
||||||
public void testKt5232() throws Exception {
|
public void testKt5232() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/defaultArguments/function/kt5232.kt");
|
runTest("compiler/testData/codegen/box/defaultArguments/function/kt5232.kt");
|
||||||
|
|||||||
Generated
+10
@@ -7245,6 +7245,16 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/defaultArguments/function/innerExtentionFunctionManyArgs.kt");
|
runTest("compiler/testData/codegen/box/defaultArguments/function/innerExtentionFunctionManyArgs.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt36188.kt")
|
||||||
|
public void testKt36188() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/defaultArguments/function/kt36188.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt36188_2.kt")
|
||||||
|
public void testKt36188_2() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/defaultArguments/function/kt36188_2.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt5232.kt")
|
@TestMetadata("kt5232.kt")
|
||||||
public void testKt5232() throws Exception {
|
public void testKt5232() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/defaultArguments/function/kt5232.kt");
|
runTest("compiler/testData/codegen/box/defaultArguments/function/kt5232.kt");
|
||||||
|
|||||||
+10
@@ -7245,6 +7245,16 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/defaultArguments/function/innerExtentionFunctionManyArgs.kt");
|
runTest("compiler/testData/codegen/box/defaultArguments/function/innerExtentionFunctionManyArgs.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt36188.kt")
|
||||||
|
public void testKt36188() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/defaultArguments/function/kt36188.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt36188_2.kt")
|
||||||
|
public void testKt36188_2() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/defaultArguments/function/kt36188_2.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("kt5232.kt")
|
@TestMetadata("kt5232.kt")
|
||||||
public void testKt5232() throws Exception {
|
public void testKt5232() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/defaultArguments/function/kt5232.kt");
|
runTest("compiler/testData/codegen/box/defaultArguments/function/kt5232.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user