JVM_IR KT-42137 bridges are not generated for fake overrides

This commit is contained in:
Dmitry Petrov
2020-11-20 10:51:50 +03:00
parent 5d5473ef08
commit e59c8e0a5c
14 changed files with 116 additions and 2 deletions
@@ -1522,6 +1522,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/bridges/kt318.kt");
}
@TestMetadata("kt42137.kt")
public void testKt42137() throws Exception {
runTest("compiler/testData/codegen/box/bridges/kt42137.kt");
}
@TestMetadata("longChainOneBridge.kt")
public void testLongChainOneBridge() throws Exception {
runTest("compiler/testData/codegen/box/bridges/longChainOneBridge.kt");
@@ -350,9 +350,12 @@ internal class BridgeLowering(val context: JvmBackendContext) : FileLoweringPass
//
// This can still break binary compatibility, but it matches the behavior of the JVM backend.
if (irFunction.isFakeOverride) {
irFunction.overriddenSymbols.asSequence().map { it.owner }.filter { !it.isJvmAbstract(context.state.jvmDefaultMode) }
irFunction.overriddenSymbols.asSequence()
.map { it.owner }.filter { !it.isJvmAbstract(context.state.jvmDefaultMode) }
.forEach { override ->
override.allOverridden().mapTo(blacklist) { it.jvmMethod }
override.allOverridden()
.filter { !it.isFakeOverride }
.mapTo(blacklist) { it.jvmMethod }
}
}
+16
View File
@@ -0,0 +1,16 @@
interface A<out T> {
val value: T
}
interface B<out T : CharSequence> : A<T>
open class C(override val value: String) : B<CharSequence>
interface X {
val value: CharSequence
}
class Y(value: String) : C(value), X
fun box(): String =
(Y("OK") as X).value.toString()
+13
View File
@@ -0,0 +1,13 @@
interface A<out T> {
val value: T
}
interface B<out T : CharSequence> : A<T>
open class C(override val value: String) : B<CharSequence>
interface X {
val value: CharSequence
}
class Y(value: String) : C(value), X
+32
View File
@@ -0,0 +1,32 @@
@kotlin.Metadata
public interface A {
// source: 'kt42137.kt'
public abstract method getValue(): java.lang.Object
}
@kotlin.Metadata
public interface B {
// source: 'kt42137.kt'
}
@kotlin.Metadata
public class C {
// source: 'kt42137.kt'
private final @org.jetbrains.annotations.NotNull field value: java.lang.String
public method <init>(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
public synthetic bridge method getValue(): java.lang.Object
public @org.jetbrains.annotations.NotNull method getValue(): java.lang.String
}
@kotlin.Metadata
public interface X {
// source: 'kt42137.kt'
public abstract @org.jetbrains.annotations.NotNull method getValue(): java.lang.CharSequence
}
@kotlin.Metadata
public final class Y {
// source: 'kt42137.kt'
public method <init>(@org.jetbrains.annotations.NotNull p0: java.lang.String): void
public synthetic bridge method getValue(): java.lang.CharSequence
}
@@ -1542,6 +1542,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/bridges/kt318.kt");
}
@TestMetadata("kt42137.kt")
public void testKt42137() throws Exception {
runTest("compiler/testData/codegen/box/bridges/kt42137.kt");
}
@TestMetadata("longChainOneBridge.kt")
public void testLongChainOneBridge() throws Exception {
runTest("compiler/testData/codegen/box/bridges/longChainOneBridge.kt");
@@ -104,6 +104,11 @@ public class BytecodeListingTestGenerated extends AbstractBytecodeListingTest {
runTest("compiler/testData/codegen/bytecodeListing/jvmStaticWithDefaultParameters.kt");
}
@TestMetadata("kt42137.kt")
public void testKt42137() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/kt42137.kt");
}
@TestMetadata("kt42879.kt")
public void testKt42879() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/kt42879.kt");
@@ -1542,6 +1542,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/bridges/kt318.kt");
}
@TestMetadata("kt42137.kt")
public void testKt42137() throws Exception {
runTest("compiler/testData/codegen/box/bridges/kt42137.kt");
}
@TestMetadata("longChainOneBridge.kt")
public void testLongChainOneBridge() throws Exception {
runTest("compiler/testData/codegen/box/bridges/longChainOneBridge.kt");
@@ -1522,6 +1522,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/bridges/kt318.kt");
}
@TestMetadata("kt42137.kt")
public void testKt42137() throws Exception {
runTest("compiler/testData/codegen/box/bridges/kt42137.kt");
}
@TestMetadata("longChainOneBridge.kt")
public void testLongChainOneBridge() throws Exception {
runTest("compiler/testData/codegen/box/bridges/longChainOneBridge.kt");
@@ -104,6 +104,11 @@ public class IrBytecodeListingTestGenerated extends AbstractIrBytecodeListingTes
runTest("compiler/testData/codegen/bytecodeListing/jvmStaticWithDefaultParameters.kt");
}
@TestMetadata("kt42137.kt")
public void testKt42137() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/kt42137.kt");
}
@TestMetadata("kt42879.kt")
public void testKt42879() throws Exception {
runTest("compiler/testData/codegen/bytecodeListing/kt42879.kt");
@@ -1137,6 +1137,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
runTest("compiler/testData/codegen/box/bridges/kt318.kt");
}
@TestMetadata("kt42137.kt")
public void testKt42137() throws Exception {
runTest("compiler/testData/codegen/box/bridges/kt42137.kt");
}
@TestMetadata("longChainOneBridge.kt")
public void testLongChainOneBridge() throws Exception {
runTest("compiler/testData/codegen/box/bridges/longChainOneBridge.kt");
@@ -1137,6 +1137,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/bridges/kt318.kt");
}
@TestMetadata("kt42137.kt")
public void testKt42137() throws Exception {
runTest("compiler/testData/codegen/box/bridges/kt42137.kt");
}
@TestMetadata("longChainOneBridge.kt")
public void testLongChainOneBridge() throws Exception {
runTest("compiler/testData/codegen/box/bridges/longChainOneBridge.kt");
@@ -1137,6 +1137,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/bridges/kt318.kt");
}
@TestMetadata("kt42137.kt")
public void testKt42137() throws Exception {
runTest("compiler/testData/codegen/box/bridges/kt42137.kt");
}
@TestMetadata("longChainOneBridge.kt")
public void testLongChainOneBridge() throws Exception {
runTest("compiler/testData/codegen/box/bridges/longChainOneBridge.kt");
@@ -977,6 +977,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
runTest("compiler/testData/codegen/box/bridges/kt318.kt");
}
@TestMetadata("kt42137.kt")
public void testKt42137() throws Exception {
runTest("compiler/testData/codegen/box/bridges/kt42137.kt");
}
@TestMetadata("longChainOneBridge.kt")
public void testLongChainOneBridge() throws Exception {
runTest("compiler/testData/codegen/box/bridges/longChainOneBridge.kt");