JVM_IR: add a transformChildren call to PropertyReferenceLowering

#KT-42354 Fixed
This commit is contained in:
pyos
2020-10-05 14:20:34 +02:00
committed by Alexander Udalov
parent b1bd138afb
commit a6d5c02d9b
9 changed files with 43 additions and 3 deletions
@@ -2976,6 +2976,11 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
runTest("compiler/testData/codegen/box/callableReference/property/inEnum.kt");
}
@TestMetadata("inReceiverOfAnother.kt")
public void testInReceiverOfAnother() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/property/inReceiverOfAnother.kt");
}
@TestMetadata("invokePropertyReference.kt")
public void testInvokePropertyReference() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/property/invokePropertyReference.kt");
@@ -66,9 +66,6 @@ internal class PropertyReferenceLowering(val context: JvmBackendContext) : Class
private val IrMemberAccessExpression<*>.field: IrFieldSymbol?
get() = (this as? IrPropertyReference)?.field
private val IrSimpleFunction.signature: String
get() = context.methodSignatureMapper.mapSignatureSkipGeneric(collectRealOverrides().first()).toString()
// Plain Java fields do not have a getter, but can be referenced nonetheless. The signature should be the one
// that a getter would have, if it existed.
private val IrField.signature: String
@@ -216,6 +213,7 @@ internal class PropertyReferenceLowering(val context: JvmBackendContext) : Class
cachedKProperty(expression)
private fun cachedKProperty(expression: IrCallableReference<*>): IrExpression {
expression.transformChildrenVoid()
if (expression.origin != IrStatementOrigin.PROPERTY_REFERENCE_FOR_DELEGATE)
return createSpecializedKProperty(expression)
@@ -0,0 +1,7 @@
var x = "OK"
class C(init: () -> String) {
val value = init()
}
fun box() = C(::x)::value.get()
@@ -2996,6 +2996,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
runTest("compiler/testData/codegen/box/callableReference/property/inEnum.kt");
}
@TestMetadata("inReceiverOfAnother.kt")
public void testInReceiverOfAnother() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/property/inReceiverOfAnother.kt");
}
@TestMetadata("invokePropertyReference.kt")
public void testInvokePropertyReference() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/property/invokePropertyReference.kt");
@@ -2996,6 +2996,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/callableReference/property/inEnum.kt");
}
@TestMetadata("inReceiverOfAnother.kt")
public void testInReceiverOfAnother() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/property/inReceiverOfAnother.kt");
}
@TestMetadata("invokePropertyReference.kt")
public void testInvokePropertyReference() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/property/invokePropertyReference.kt");
@@ -2976,6 +2976,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
runTest("compiler/testData/codegen/box/callableReference/property/inEnum.kt");
}
@TestMetadata("inReceiverOfAnother.kt")
public void testInReceiverOfAnother() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/property/inReceiverOfAnother.kt");
}
@TestMetadata("invokePropertyReference.kt")
public void testInvokePropertyReference() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/property/invokePropertyReference.kt");
@@ -2341,6 +2341,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
runTest("compiler/testData/codegen/box/callableReference/property/inEnum.kt");
}
@TestMetadata("inReceiverOfAnother.kt")
public void testInReceiverOfAnother() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/property/inReceiverOfAnother.kt");
}
@TestMetadata("invokePropertyReference.kt")
public void testInvokePropertyReference() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/property/invokePropertyReference.kt");
@@ -2341,6 +2341,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/callableReference/property/inEnum.kt");
}
@TestMetadata("inReceiverOfAnother.kt")
public void testInReceiverOfAnother() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/property/inReceiverOfAnother.kt");
}
@TestMetadata("invokePropertyReference.kt")
public void testInvokePropertyReference() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/property/invokePropertyReference.kt");
@@ -2341,6 +2341,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/callableReference/property/inEnum.kt");
}
@TestMetadata("inReceiverOfAnother.kt")
public void testInReceiverOfAnother() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/property/inReceiverOfAnother.kt");
}
@TestMetadata("invokePropertyReference.kt")
public void testInvokePropertyReference() throws Exception {
runTest("compiler/testData/codegen/box/callableReference/property/invokePropertyReference.kt");