JVM IR: Don't skip bridge generation for concrete fake overrides
This commit is contained in:
committed by
Georgy Bronnikov
parent
c027c0e659
commit
8746d08dd5
+7
-2
@@ -127,8 +127,13 @@ private class BridgeLowering(val context: JvmBackendContext) : ClassLoweringPass
|
|||||||
targetForCommonBridges = bridge
|
targetForCommonBridges = bridge
|
||||||
}
|
}
|
||||||
|
|
||||||
val signaturesToSkip = mutableSetOf(ourSignature)
|
val signaturesToSkip =
|
||||||
signaturesToSkip.addAll(getFinalOverridden(irFunction).map { it.getJvmSignature() })
|
if (irFunction.origin != IrDeclarationOrigin.FAKE_OVERRIDE || irFunction.modality == Modality.ABSTRACT || targetForCommonBridges != irFunction)
|
||||||
|
mutableSetOf(ourSignature)
|
||||||
|
else
|
||||||
|
mutableSetOf()
|
||||||
|
|
||||||
|
signaturesToSkip += getFinalOverridden(irFunction).map { it.getJvmSignature() }
|
||||||
|
|
||||||
val firstOverridden = irFunction.overriddenInClasses().firstOrNull()
|
val firstOverridden = irFunction.overriddenInClasses().firstOrNull()
|
||||||
val firstOverriddenSignature = firstOverridden?.getJvmSignature()
|
val firstOverriddenSignature = firstOverridden?.getJvmSignature()
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
// IGNORE_BACKEND_FIR: JVM_IR
|
||||||
|
interface A {
|
||||||
|
val result: Any
|
||||||
|
}
|
||||||
|
interface B : A {
|
||||||
|
override val result: String
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class AImpl<out Self : Any>(override val result: Self) : A
|
||||||
|
class BImpl(result: String) : AImpl<String>(result), B
|
||||||
|
|
||||||
|
fun box(): String = (BImpl("OK") as B).result
|
||||||
@@ -1,5 +1,4 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
// IGNORE_BACKEND_FIR: JVM_IR
|
||||||
// IGNORE_BACKEND: JVM_IR
|
|
||||||
// IGNORE_BACKEND: JVM
|
// IGNORE_BACKEND: JVM
|
||||||
|
|
||||||
interface I<T> {
|
interface I<T> {
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
// IGNORE_BACKEND_FIR: JVM_IR
|
||||||
// IGNORE_BACKEND: JVM_IR
|
|
||||||
// IGNORE_BACKEND: JVM
|
// IGNORE_BACKEND: JVM
|
||||||
|
|
||||||
interface I<T> {
|
interface I<T> {
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
// IGNORE_BACKEND_FIR: JVM_IR
|
// IGNORE_BACKEND_FIR: JVM_IR
|
||||||
// IGNORE_BACKEND: JVM_IR
|
|
||||||
// IGNORE_BACKEND: JVM
|
// IGNORE_BACKEND: JVM
|
||||||
|
|
||||||
interface I<T> {
|
interface I<T> {
|
||||||
|
|||||||
+5
@@ -1377,6 +1377,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
runTest("compiler/testData/codegen/box/bridges/complexTraitImpl.kt");
|
runTest("compiler/testData/codegen/box/bridges/complexTraitImpl.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("covariantGenericDiamond.kt")
|
||||||
|
public void testCovariantGenericDiamond() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/bridges/covariantGenericDiamond.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("delegation.kt")
|
@TestMetadata("delegation.kt")
|
||||||
public void testDelegation() throws Exception {
|
public void testDelegation() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/bridges/delegation.kt");
|
runTest("compiler/testData/codegen/box/bridges/delegation.kt");
|
||||||
|
|||||||
+5
@@ -1377,6 +1377,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
runTest("compiler/testData/codegen/box/bridges/complexTraitImpl.kt");
|
runTest("compiler/testData/codegen/box/bridges/complexTraitImpl.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("covariantGenericDiamond.kt")
|
||||||
|
public void testCovariantGenericDiamond() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/bridges/covariantGenericDiamond.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("delegation.kt")
|
@TestMetadata("delegation.kt")
|
||||||
public void testDelegation() throws Exception {
|
public void testDelegation() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/bridges/delegation.kt");
|
runTest("compiler/testData/codegen/box/bridges/delegation.kt");
|
||||||
|
|||||||
+5
@@ -1357,6 +1357,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
runTest("compiler/testData/codegen/box/bridges/complexTraitImpl.kt");
|
runTest("compiler/testData/codegen/box/bridges/complexTraitImpl.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("covariantGenericDiamond.kt")
|
||||||
|
public void testCovariantGenericDiamond() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/bridges/covariantGenericDiamond.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("delegation.kt")
|
@TestMetadata("delegation.kt")
|
||||||
public void testDelegation() throws Exception {
|
public void testDelegation() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/bridges/delegation.kt");
|
runTest("compiler/testData/codegen/box/bridges/delegation.kt");
|
||||||
|
|||||||
+5
@@ -1357,6 +1357,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTest("compiler/testData/codegen/box/bridges/complexTraitImpl.kt");
|
runTest("compiler/testData/codegen/box/bridges/complexTraitImpl.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("covariantGenericDiamond.kt")
|
||||||
|
public void testCovariantGenericDiamond() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/bridges/covariantGenericDiamond.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("delegation.kt")
|
@TestMetadata("delegation.kt")
|
||||||
public void testDelegation() throws Exception {
|
public void testDelegation() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/bridges/delegation.kt");
|
runTest("compiler/testData/codegen/box/bridges/delegation.kt");
|
||||||
|
|||||||
Generated
+5
@@ -987,6 +987,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/bridges/complexTraitImpl.kt");
|
runTest("compiler/testData/codegen/box/bridges/complexTraitImpl.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("covariantGenericDiamond.kt")
|
||||||
|
public void testCovariantGenericDiamond() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/bridges/covariantGenericDiamond.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("delegation.kt")
|
@TestMetadata("delegation.kt")
|
||||||
public void testDelegation() throws Exception {
|
public void testDelegation() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/bridges/delegation.kt");
|
runTest("compiler/testData/codegen/box/bridges/delegation.kt");
|
||||||
|
|||||||
+5
@@ -987,6 +987,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
|||||||
runTest("compiler/testData/codegen/box/bridges/complexTraitImpl.kt");
|
runTest("compiler/testData/codegen/box/bridges/complexTraitImpl.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("covariantGenericDiamond.kt")
|
||||||
|
public void testCovariantGenericDiamond() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/bridges/covariantGenericDiamond.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("delegation.kt")
|
@TestMetadata("delegation.kt")
|
||||||
public void testDelegation() throws Exception {
|
public void testDelegation() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/bridges/delegation.kt");
|
runTest("compiler/testData/codegen/box/bridges/delegation.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user