[FIR] Reuse enhancement storage during creation of synthetic properies

^KT-61972 Fixed
This commit is contained in:
Dmitriy Novozhilov
2023-09-18 12:00:24 +03:00
committed by Space Team
parent cec299ac0a
commit 97cf240450
8 changed files with 65 additions and 6 deletions
@@ -37685,6 +37685,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
runTest("compiler/testData/codegen/box/properties/privatePropertyWithoutBackingField.kt");
}
@Test
@TestMetadata("propertyInUpperCaseWithJava.kt")
public void testPropertyInUpperCaseWithJava() throws Exception {
runTest("compiler/testData/codegen/box/properties/propertyInUpperCaseWithJava.kt");
}
@Test
@TestMetadata("protectedJavaFieldInInline.kt")
public void testProtectedJavaFieldInInline() throws Exception {
@@ -37685,6 +37685,12 @@ public class FirLightTreeBlackBoxCodegenWithIrFakeOverrideGeneratorTestGenerated
runTest("compiler/testData/codegen/box/properties/privatePropertyWithoutBackingField.kt");
}
@Test
@TestMetadata("propertyInUpperCaseWithJava.kt")
public void testPropertyInUpperCaseWithJava() throws Exception {
runTest("compiler/testData/codegen/box/properties/propertyInUpperCaseWithJava.kt");
}
@Test
@TestMetadata("protectedJavaFieldInInline.kt")
public void testProtectedJavaFieldInInline() throws Exception {
@@ -37685,6 +37685,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
runTest("compiler/testData/codegen/box/properties/privatePropertyWithoutBackingField.kt");
}
@Test
@TestMetadata("propertyInUpperCaseWithJava.kt")
public void testPropertyInUpperCaseWithJava() throws Exception {
runTest("compiler/testData/codegen/box/properties/propertyInUpperCaseWithJava.kt");
}
@Test
@TestMetadata("protectedJavaFieldInInline.kt")
public void testProtectedJavaFieldInInline() throws Exception {
@@ -157,17 +157,13 @@ class FirSignatureEnhancement(
val accessorSymbol = firElement.symbol
val getterDelegate = firElement.getter.delegate
val enhancedGetterSymbol = if (getterDelegate is FirJavaMethod) {
enhanceMethod(
getterDelegate, getterDelegate.symbol.callableId, getterDelegate.name, enhancedTypeParameters = null,
)
enhancementsCache.enhancedFunctions.getValue(getterDelegate.symbol, this to getterDelegate.name)
} else {
getterDelegate.symbol
}
val setterDelegate = firElement.setter?.delegate
val enhancedSetterSymbol = if (setterDelegate is FirJavaMethod) {
enhanceMethod(
setterDelegate, setterDelegate.symbol.callableId, setterDelegate.name, enhancedTypeParameters = null,
)
enhancementsCache.enhancedFunctions.getValue(setterDelegate.symbol, this to setterDelegate.name)
} else {
setterDelegate?.symbol
}
@@ -0,0 +1,28 @@
// TARGET_BACKEND: JVM_IR
// ISSUE: KT-61972
// FILE: Base.kt
interface Base {
val URL: String
}
// FILE: Derived.java
public class Derived implements Base {
private String value;
public Derived(String value) {
this.value = value;
}
@java.lang.Override
public String getURL() {
return value;
}
}
// FILE: main.kt
fun box(): String {
val d1 = Derived("O")
val d2 = Derived("K")
return d1.URL + d2.getURL()
}
@@ -37685,6 +37685,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/properties/privatePropertyWithoutBackingField.kt");
}
@Test
@TestMetadata("propertyInUpperCaseWithJava.kt")
public void testPropertyInUpperCaseWithJava() throws Exception {
runTest("compiler/testData/codegen/box/properties/propertyInUpperCaseWithJava.kt");
}
@Test
@TestMetadata("protectedJavaFieldInInline.kt")
public void testProtectedJavaFieldInInline() throws Exception {
@@ -37685,6 +37685,12 @@ public class IrBlackBoxCodegenWithIrInlinerTestGenerated extends AbstractIrBlack
runTest("compiler/testData/codegen/box/properties/privatePropertyWithoutBackingField.kt");
}
@Test
@TestMetadata("propertyInUpperCaseWithJava.kt")
public void testPropertyInUpperCaseWithJava() throws Exception {
runTest("compiler/testData/codegen/box/properties/propertyInUpperCaseWithJava.kt");
}
@Test
@TestMetadata("protectedJavaFieldInInline.kt")
public void testProtectedJavaFieldInInline() throws Exception {
@@ -32190,6 +32190,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/properties/privatePropertyWithoutBackingField.kt");
}
@TestMetadata("propertyInUpperCaseWithJava.kt")
public void testPropertyInUpperCaseWithJava() throws Exception {
runTest("compiler/testData/codegen/box/properties/propertyInUpperCaseWithJava.kt");
}
@TestMetadata("protectedJavaFieldInInline.kt")
public void testProtectedJavaFieldInInline() throws Exception {
runTest("compiler/testData/codegen/box/properties/protectedJavaFieldInInline.kt");