FIR2IR: add another fallback for simple synthetic property

This commit is contained in:
Mikhail Glukhikh
2021-11-01 19:04:00 +03:00
committed by teamcity
parent b50350f6a5
commit f2c734fc02
4 changed files with 38 additions and 1 deletions
@@ -1171,7 +1171,9 @@ class Fir2IrDeclarationStorage(
dispatchReceiverIrClass.declarations.find {
it is IrSimpleFunction && it.isFakeOverride && it.name == fir.name &&
it.overrides(originalSymbol.owner as IrSimpleFunction)
}?.symbol as IrFunctionSymbol
}?.symbol as? IrFunctionSymbol
// Fallback for simple synthetic property
?: originalSymbol
} else {
originalSymbol
}
@@ -16336,6 +16336,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/fir/classCanNotBeCastedToVoid.kt");
}
@Test
@TestMetadata("ColorValuePanel.kt")
public void testColorValuePanel() throws Exception {
runTest("compiler/testData/codegen/box/fir/ColorValuePanel.kt");
}
@Test
@TestMetadata("ConstValAccess.kt")
public void testConstValAccess() throws Exception {
+23
View File
@@ -0,0 +1,23 @@
// TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND: ANDROID, ANDROID_IR
// WITH_RUNTIME
// FULL_JDK
import java.awt.GridLayout
import javax.swing.JPanel
class Some {
val baz get() = foo().layout
companion object {
private fun foo() = object : ButtonPanel() {
init {
layout = GridLayout()
}
}
}
}
abstract class ButtonPanel : JPanel()
fun box() = if (Some().baz is GridLayout) "OK" else "FAIL"
@@ -16336,6 +16336,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/fir/classCanNotBeCastedToVoid.kt");
}
@Test
@TestMetadata("ColorValuePanel.kt")
public void testColorValuePanel() throws Exception {
runTest("compiler/testData/codegen/box/fir/ColorValuePanel.kt");
}
@Test
@TestMetadata("ConstValAccess.kt")
public void testConstValAccess() throws Exception {