[FIR] Fix substituted synthetic property with overridden getter only
When building the original for a substitution override for a synthetic property, use the initial setter as fallback when unsubstituting it returns null. This can happen when a generic class overrides the getter of a synthetic property of a non-generic class. Then the setter is never substituted, therefore there is nothing to unsubstitute. ^KT-57168 Fixed
This commit is contained in:
committed by
Space Team
parent
b3d0a0a1c8
commit
e0baeb53db
+6
@@ -28933,6 +28933,12 @@ public class FirLightTreeBlackBoxCodegenTestGenerated extends AbstractFirLightTr
|
|||||||
runTest("compiler/testData/codegen/box/javaInterop/syntheticPropClashingWithJvmField.kt");
|
runTest("compiler/testData/codegen/box/javaInterop/syntheticPropClashingWithJvmField.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("syntheticPropOverriddenGetter.kt")
|
||||||
|
public void testSyntheticPropOverriddenGetter() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/javaInterop/syntheticPropOverriddenGetter.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("unresolvedJavaClassInDifferentFile.kt")
|
@TestMetadata("unresolvedJavaClassInDifferentFile.kt")
|
||||||
public void testUnresolvedJavaClassInDifferentFile() throws Exception {
|
public void testUnresolvedJavaClassInDifferentFile() throws Exception {
|
||||||
|
|||||||
+6
@@ -28933,6 +28933,12 @@ public class FirPsiBlackBoxCodegenTestGenerated extends AbstractFirPsiBlackBoxCo
|
|||||||
runTest("compiler/testData/codegen/box/javaInterop/syntheticPropClashingWithJvmField.kt");
|
runTest("compiler/testData/codegen/box/javaInterop/syntheticPropClashingWithJvmField.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("syntheticPropOverriddenGetter.kt")
|
||||||
|
public void testSyntheticPropOverriddenGetter() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/javaInterop/syntheticPropOverriddenGetter.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("unresolvedJavaClassInDifferentFile.kt")
|
@TestMetadata("unresolvedJavaClassInDifferentFile.kt")
|
||||||
public void testUnresolvedJavaClassInDifferentFile() throws Exception {
|
public void testUnresolvedJavaClassInDifferentFile() throws Exception {
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ class FirSyntheticPropertiesScope private constructor(
|
|||||||
property.originalForSubstitutionOverrideAttr = buildSyntheticProperty(
|
property.originalForSubstitutionOverrideAttr = buildSyntheticProperty(
|
||||||
propertyName,
|
propertyName,
|
||||||
it,
|
it,
|
||||||
matchingSetter?.originalForSubstitutionOverride
|
matchingSetter?.originalForSubstitutionOverride ?: matchingSetter
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
val syntheticSymbol = property.symbol
|
val syntheticSymbol = property.symbol
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
// TARGET_BACKEND: JVM
|
||||||
|
// FILE: Component.java
|
||||||
|
|
||||||
|
public abstract class Component {
|
||||||
|
public void setPreferredSize(Object preferredSize) {}
|
||||||
|
public Object getPreferredSize() { return new Object(); }
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: ProjectMain.kt
|
||||||
|
|
||||||
|
class ComboBox<T>: Component() {
|
||||||
|
override fun getPreferredSize(): Any? = "OK"
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val comboBox = ComboBox<Int>()
|
||||||
|
comboBox.preferredSize = Any()
|
||||||
|
return comboBox.preferredSize as String
|
||||||
|
}
|
||||||
+6
@@ -27649,6 +27649,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
runTest("compiler/testData/codegen/box/javaInterop/syntheticPropClashingWithJvmField.kt");
|
runTest("compiler/testData/codegen/box/javaInterop/syntheticPropClashingWithJvmField.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("syntheticPropOverriddenGetter.kt")
|
||||||
|
public void testSyntheticPropOverriddenGetter() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/javaInterop/syntheticPropOverriddenGetter.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("unresolvedJavaClassInDifferentFile.kt")
|
@TestMetadata("unresolvedJavaClassInDifferentFile.kt")
|
||||||
public void testUnresolvedJavaClassInDifferentFile() throws Exception {
|
public void testUnresolvedJavaClassInDifferentFile() throws Exception {
|
||||||
|
|||||||
+6
@@ -28933,6 +28933,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTest("compiler/testData/codegen/box/javaInterop/syntheticPropClashingWithJvmField.kt");
|
runTest("compiler/testData/codegen/box/javaInterop/syntheticPropClashingWithJvmField.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("syntheticPropOverriddenGetter.kt")
|
||||||
|
public void testSyntheticPropOverriddenGetter() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/javaInterop/syntheticPropOverriddenGetter.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("unresolvedJavaClassInDifferentFile.kt")
|
@TestMetadata("unresolvedJavaClassInDifferentFile.kt")
|
||||||
public void testUnresolvedJavaClassInDifferentFile() throws Exception {
|
public void testUnresolvedJavaClassInDifferentFile() throws Exception {
|
||||||
|
|||||||
+5
@@ -23341,6 +23341,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
runTest("compiler/testData/codegen/box/javaInterop/syntheticPropClashingWithJvmField.kt");
|
runTest("compiler/testData/codegen/box/javaInterop/syntheticPropClashingWithJvmField.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("syntheticPropOverriddenGetter.kt")
|
||||||
|
public void testSyntheticPropOverriddenGetter() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/javaInterop/syntheticPropOverriddenGetter.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("unresolvedJavaClassInDifferentFile.kt")
|
@TestMetadata("unresolvedJavaClassInDifferentFile.kt")
|
||||||
public void testUnresolvedJavaClassInDifferentFile() throws Exception {
|
public void testUnresolvedJavaClassInDifferentFile() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/javaInterop/unresolvedJavaClassInDifferentFile.kt");
|
runTest("compiler/testData/codegen/box/javaInterop/unresolvedJavaClassInDifferentFile.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user