From 70522f6bc4521839f510dea2784c1cb19a0dcd0d Mon Sep 17 00:00:00 2001 From: Georgy Bronnikov Date: Fri, 21 May 2021 15:02:31 +0300 Subject: [PATCH] JVM_IR: simplify resolveFakeOverride call in SyntheticAccessorLowering (cherry picked from commit 7e6782d6845b958bef5254516afe9a12c1e1feab) --- .../backend/jvm/lower/SyntheticAccessorLowering.kt | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/SyntheticAccessorLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/SyntheticAccessorLowering.kt index 6a8a0dff9b887..f96585c2f8b16 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/SyntheticAccessorLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/SyntheticAccessorLowering.kt @@ -732,7 +732,8 @@ internal class SyntheticAccessorLowering(val context: JvmBackendContext) : IrEle is IrField -> { val correspondingProperty = declarationRaw.correspondingPropertySymbol?.owner if (correspondingProperty != null && correspondingProperty.isFakeOverride) { - val realProperty = correspondingProperty.resolveFakeOverrideForProperty() + val realProperty = correspondingProperty.resolveFakeOverride() + ?: throw AssertionError("No real override for ${correspondingProperty.render()}") realProperty.backingField ?: throw AssertionError( "Fake override property ${correspondingProperty.render()} with backing field " + @@ -765,16 +766,6 @@ internal class SyntheticAccessorLowering(val context: JvmBackendContext) : IrEle } } - private fun IrProperty.resolveFakeOverrideForProperty(): IrProperty { - if (!isFakeOverride) return this - - return this.overriddenSymbols - .map { it.owner } - .collectAndFilterRealOverrides() - .firstOrNull() - ?: throw AssertionError("No real override for ${this.render()}") - } - private class OuterClassInfo(val outerClass: IrClass, val throughCrossinlineLambda: Boolean) private fun getOuterClassInfo(): OuterClassInfo? {