From a11705186f83e6186dc197ee11b7bcf652a963b5 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Thu, 11 Jan 2024 14:29:32 +0200 Subject: [PATCH] [FIR2IR] Properly extract accessor symbols in FakeOverrideGenerator ^KT-64432 Fixed --- .../kotlin/fir/backend/generators/FakeOverrideGenerator.kt | 6 ++---- .../codegen/box/collections/removeAtIntOverrideInJava.kt | 1 - 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/FakeOverrideGenerator.kt b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/FakeOverrideGenerator.kt index cd332cc30b4..5ea6a6c8233 100644 --- a/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/FakeOverrideGenerator.kt +++ b/compiler/fir/fir2ir/src/org/jetbrains/kotlin/fir/backend/generators/FakeOverrideGenerator.kt @@ -555,7 +555,6 @@ class FakeOverrideGenerator( } } - @OptIn(UnsafeDuringIrConstructionAPI::class) private fun IrProperty.setOverriddenSymbolsForProperty( declarationStorage: Fir2IrDeclarationStorage, isVar: Boolean, @@ -564,14 +563,13 @@ class FakeOverrideGenerator( val overriddenIrSymbols = getOverriddenSymbolsInSupertypes(this, firOverriddenSymbols) { declarationStorage.getIrPropertySymbol(it) as IrPropertySymbol } - val overriddenIrProperties = overriddenIrSymbols.map { it.owner } getter?.apply { - overriddenSymbols = overriddenIrProperties.mapNotNull { it.getter?.symbol } + overriddenSymbols = overriddenIrSymbols.mapNotNull { declarationStorage.findGetterOfProperty(it) } } if (isVar) { setter?.apply { - overriddenSymbols = overriddenIrProperties.mapNotNull { it.setter?.symbol } + overriddenSymbols = overriddenIrSymbols.mapNotNull { declarationStorage.findSetterOfProperty(it) } } } overriddenSymbols = overriddenIrSymbols diff --git a/compiler/testData/codegen/box/collections/removeAtIntOverrideInJava.kt b/compiler/testData/codegen/box/collections/removeAtIntOverrideInJava.kt index 74730eda968..88983dfd7a2 100644 --- a/compiler/testData/codegen/box/collections/removeAtIntOverrideInJava.kt +++ b/compiler/testData/codegen/box/collections/removeAtIntOverrideInJava.kt @@ -1,5 +1,4 @@ // TARGET_BACKEND: JVM -// IGNORE_CODEGEN_WITH_IR_FAKE_OVERRIDE_GENERATION: KT-64432 // JVM_ABI_K1_K2_DIFF: KT-57300, KT-63857 // FILE: A.java