[Fir2IR] Don't compute overriddenSymbols if ir builder is enabled
Ir builder would recompute them anyway, while computation can lead to triggering computations in lazy classes too early, which is incorrect. ^KT-65116
This commit is contained in:
committed by
Space Team
parent
2f4860886a
commit
5e25707648
+6
@@ -19280,6 +19280,12 @@ public class LLFirBlackBoxCodegenBasedTestGenerated extends AbstractLLFirBlackBo
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/kt49371.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt65116.kt")
|
||||
public void testKt65116() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/kt65116.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("methodOfAnyFromInterface.kt")
|
||||
public void testMethodOfAnyFromInterface() throws Exception {
|
||||
|
||||
+6
@@ -19280,6 +19280,12 @@ public class LLFirReversedBlackBoxCodegenBasedTestGenerated extends AbstractLLFi
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/kt49371.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt65116.kt")
|
||||
public void testKt65116() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/kt65116.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("methodOfAnyFromInterface.kt")
|
||||
public void testMethodOfAnyFromInterface() throws Exception {
|
||||
|
||||
+14
-2
@@ -211,7 +211,13 @@ internal class ClassMemberGenerator(
|
||||
declarationStorage.leaveScope(irFunction.symbol)
|
||||
}
|
||||
if (irFunction is IrSimpleFunction && firFunction is FirSimpleFunction && containingClass != null) {
|
||||
irFunction.overriddenSymbols = firFunction.generateOverriddenFunctionSymbols(containingClass)
|
||||
/**
|
||||
* In useIrFakeOverrideBuilder it would be dropped anyway, as [org.jetbrains.kotlin.ir.overrides.IrFakeOverrideBuilder.buildFakeOverridesForClass]
|
||||
* recalculates this value from scratch. Also, it's quite meaningless in non-platform modules anyway.
|
||||
*/
|
||||
if (!configuration.useIrFakeOverrideBuilder) {
|
||||
irFunction.overriddenSymbols = firFunction.generateOverriddenFunctionSymbols(containingClass)
|
||||
}
|
||||
}
|
||||
}
|
||||
return irFunction
|
||||
@@ -223,7 +229,13 @@ internal class ClassMemberGenerator(
|
||||
val propertyType = property.returnTypeRef.toIrType()
|
||||
irProperty.initializeBackingField(property, initializerExpression = initializer ?: delegate)
|
||||
if (containingClass != null) {
|
||||
irProperty.overriddenSymbols = property.generateOverriddenPropertySymbols(containingClass)
|
||||
/**
|
||||
* In useIrFakeOverrideBuilder it would be dropped anyway, as [org.jetbrains.kotlin.ir.overrides.IrFakeOverrideBuilder.buildFakeOverridesForClass]
|
||||
* recalculates this value from scratch. Also, it's quite meaningless in non-platform modules anyway.
|
||||
*/
|
||||
if (!configuration.useIrFakeOverrideBuilder) {
|
||||
irProperty.overriddenSymbols = property.generateOverriddenPropertySymbols(containingClass)
|
||||
}
|
||||
}
|
||||
val needGenerateDefaultGetter =
|
||||
property.getter is FirDefaultPropertyGetter ||
|
||||
|
||||
+6
@@ -19269,6 +19269,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/kt49371.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt65116.kt")
|
||||
public void testKt65116() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/kt65116.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("methodOfAnyFromInterface.kt")
|
||||
public void testMethodOfAnyFromInterface() throws Exception {
|
||||
|
||||
+6
@@ -19269,6 +19269,12 @@ public class FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/kt49371.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt65116.kt")
|
||||
public void testKt65116() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/kt65116.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("methodOfAnyFromInterface.kt")
|
||||
public void testMethodOfAnyFromInterface() throws Exception {
|
||||
|
||||
+6
@@ -19269,6 +19269,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/kt49371.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt65116.kt")
|
||||
public void testKt65116() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/kt65116.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("methodOfAnyFromInterface.kt")
|
||||
public void testMethodOfAnyFromInterface() throws Exception {
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
|
||||
// FILE: Java1.java
|
||||
public interface Java1 extends KotlinInterface { }
|
||||
|
||||
//FILE: Java2.java
|
||||
public interface Java2 {
|
||||
public void bar(int o);
|
||||
}
|
||||
|
||||
//FILE: 1.kt
|
||||
class A: Java1 {
|
||||
override fun bar(o: Int) { }
|
||||
}
|
||||
|
||||
abstract class B : Java1
|
||||
|
||||
interface KotlinInterface : Java2
|
||||
|
||||
fun test(b: B) {
|
||||
val k = b.bar(1)
|
||||
}
|
||||
|
||||
fun box() = "OK"
|
||||
+6
@@ -19269,6 +19269,12 @@ public class JvmAbiConsistencyTestBoxGenerated extends AbstractJvmAbiConsistency
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/kt49371.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt65116.kt")
|
||||
public void testKt65116() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/kt65116.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("methodOfAnyFromInterface.kt")
|
||||
public void testMethodOfAnyFromInterface() throws Exception {
|
||||
|
||||
+6
@@ -19269,6 +19269,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/kt49371.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt65116.kt")
|
||||
public void testKt65116() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/kt65116.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("methodOfAnyFromInterface.kt")
|
||||
public void testMethodOfAnyFromInterface() throws Exception {
|
||||
|
||||
+6
@@ -19269,6 +19269,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/kt49371.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("kt65116.kt")
|
||||
public void testKt65116() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/kt65116.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("methodOfAnyFromInterface.kt")
|
||||
public void testMethodOfAnyFromInterface() throws Exception {
|
||||
|
||||
+5
@@ -16054,6 +16054,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/kt49371.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt65116.kt")
|
||||
public void testKt65116() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/kt65116.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("methodOfAnyFromInterface.kt")
|
||||
public void testMethodOfAnyFromInterface() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/fakeOverride/methodOfAnyFromInterface.kt");
|
||||
|
||||
Reference in New Issue
Block a user