JVM IR: Fix corresponding properties in BridgeLowering

This commit is contained in:
Steven Schäfer
2020-04-21 17:38:32 +02:00
committed by Alexander Udalov
parent 4a2b5df9fa
commit 24b28f80cb
@@ -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.JvmBackendContext
import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin
import org.jetbrains.kotlin.backend.jvm.codegen.isJvmInterface 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.eraseTypeParameters
import org.jetbrains.kotlin.backend.jvm.ir.erasedUpperBound import org.jetbrains.kotlin.backend.jvm.ir.erasedUpperBound
import org.jetbrains.kotlin.backend.jvm.ir.isJvmAbstract import org.jetbrains.kotlin.backend.jvm.ir.isJvmAbstract
@@ -341,14 +342,10 @@ private class BridgeLowering(val context: JvmBackendContext) : FileLoweringPass,
returnType = irFunction.returnType returnType = irFunction.returnType
isFakeOverride = false isFakeOverride = false
}.apply { }.apply {
// If the function is a property accessor, link in the new function as the new accessor for the property. // If the function is a property accessor, we need to mark the abstract stub as a property accessor as well.
correspondingPropertySymbol = irFunction.correspondingPropertySymbol?.also { // However, we cannot link in the new function as the new accessor for the property, since there might still
if (irFunction.isGetter) { // be references to the original fake override stub.
it.owner.getter = this copyCorrespondingPropertyFrom(irFunction)
} else {
it.owner.setter = this
}
}
copyParametersWithErasure(this@addAbstractMethodStub, irFunction, needsArgumentBoxing) copyParametersWithErasure(this@addAbstractMethodStub, irFunction, needsArgumentBoxing)
} }