From 24b28f80cb5ded4e3e4c143ab24338f520c47a95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steven=20Sch=C3=A4fer?= Date: Tue, 21 Apr 2020 17:38:32 +0200 Subject: [PATCH] JVM IR: Fix corresponding properties in BridgeLowering --- .../kotlin/backend/jvm/lower/BridgeLowering.kt | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/BridgeLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/BridgeLowering.kt index 34932981251..29ce0014239 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/BridgeLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/BridgeLowering.kt @@ -14,6 +14,7 @@ import org.jetbrains.kotlin.backend.common.phaser.makeIrFilePhase import org.jetbrains.kotlin.backend.jvm.JvmBackendContext import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin import org.jetbrains.kotlin.backend.jvm.codegen.isJvmInterface +import org.jetbrains.kotlin.backend.jvm.ir.copyCorrespondingPropertyFrom import org.jetbrains.kotlin.backend.jvm.ir.eraseTypeParameters import org.jetbrains.kotlin.backend.jvm.ir.erasedUpperBound import org.jetbrains.kotlin.backend.jvm.ir.isJvmAbstract @@ -341,14 +342,10 @@ private class BridgeLowering(val context: JvmBackendContext) : FileLoweringPass, returnType = irFunction.returnType isFakeOverride = false }.apply { - // If the function is a property accessor, link in the new function as the new accessor for the property. - correspondingPropertySymbol = irFunction.correspondingPropertySymbol?.also { - if (irFunction.isGetter) { - it.owner.getter = this - } else { - it.owner.setter = this - } - } + // If the function is a property accessor, we need to mark the abstract stub as a property accessor as well. + // However, we cannot link in the new function as the new accessor for the property, since there might still + // be references to the original fake override stub. + copyCorrespondingPropertyFrom(irFunction) copyParametersWithErasure(this@addAbstractMethodStub, irFunction, needsArgumentBoxing) }