From 1b557c1657c080c3d122e06645e7211f8fb94eb9 Mon Sep 17 00:00:00 2001 From: Sergej Jaskiewicz Date: Thu, 7 Dec 2023 19:40:15 +0100 Subject: [PATCH] [IR] Mark IrExpressionBodyImpl with an opt-in annotation KT-59318 --- .../PurifyObjectInstanceGettersLowering.kt | 3 +-- .../backend/jvm/lower/EnumClassLowering.kt | 5 +++-- .../backend/jvm/lower/InterfaceLowering.kt | 20 ++++++++++--------- .../lower/JvmOverloadsAnnotationLowering.kt | 2 +- .../MoveCompanionObjectFieldsLowering.kt | 3 +-- .../jvm/lower/SuspendLambdaLowering.kt | 6 +++++- .../jvm/CachedSyntheticDeclarations.kt | 8 ++++---- .../expressions/impl/IrExpressionBodyImpl.kt | 5 ++--- .../ir/interop/cenum/CEnumClassGenerator.kt | 20 ++++++++++--------- .../konan/lower/ExpectDeclarationsRemoving.kt | 4 ++-- .../konan/lower/InitializersLowering.kt | 2 +- .../backend/konan/lower/InteropLowering.kt | 2 +- .../backend/konan/lower/TestProcessor.kt | 2 +- .../common/AbstractAtomicfuIrBuilder.kt | 6 +++--- .../backend/ir/IrBuilderWithPluginContext.kt | 2 +- 15 files changed, 48 insertions(+), 42 deletions(-) diff --git a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PurifyObjectInstanceGettersLowering.kt b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PurifyObjectInstanceGettersLowering.kt index f5fbd6487d3..496a1fc32f0 100644 --- a/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PurifyObjectInstanceGettersLowering.kt +++ b/compiler/ir/backend.js/src/org/jetbrains/kotlin/ir/backend/js/lower/PurifyObjectInstanceGettersLowering.kt @@ -16,7 +16,6 @@ import org.jetbrains.kotlin.ir.backend.js.utils.isObjectInstanceGetter import org.jetbrains.kotlin.ir.backend.js.utils.primaryConstructorReplacement import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.expressions.* -import org.jetbrains.kotlin.ir.expressions.impl.IrExpressionBodyImpl import org.jetbrains.kotlin.ir.types.classOrNull import org.jetbrains.kotlin.ir.util.* @@ -64,7 +63,7 @@ class PurifyObjectInstanceGettersLowering(val context: JsCommonBackendContext) : val objectToCreate = type.classOrNull?.owner ?: return null if (objectToCreate.isPureObject()) { - initializer = IrExpressionBodyImpl( + initializer = context.irFactory.createExpressionBody( objectToCreate.primaryConstructor?.let { JsIrBuilder.buildConstructorCall(it.symbol) } ?: objectToCreate.primaryConstructorReplacement?.let { JsIrBuilder.buildCall(it.symbol) } ?: error("Object should contain a primary constructor") diff --git a/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/EnumClassLowering.kt b/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/EnumClassLowering.kt index 2a54bcd2362..7a1826a08c2 100644 --- a/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/EnumClassLowering.kt +++ b/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/EnumClassLowering.kt @@ -26,7 +26,6 @@ import org.jetbrains.kotlin.ir.builders.declarations.addValueParameter import org.jetbrains.kotlin.ir.builders.declarations.buildConstructor import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.expressions.* -import org.jetbrains.kotlin.ir.expressions.impl.IrExpressionBodyImpl import org.jetbrains.kotlin.ir.expressions.impl.IrGetValueImpl import org.jetbrains.kotlin.ir.expressions.impl.IrSetValueImpl import org.jetbrains.kotlin.ir.symbols.IrConstructorSymbol @@ -143,7 +142,9 @@ private class EnumClassLowering(private val context: JvmBackendContext) : ClassL private fun buildEnumEntryField(enumEntry: IrEnumEntry): IrField = context.cachedDeclarations.getFieldForEnumEntry(enumEntry).apply { - initializer = enumEntry.initializerExpression?.let { IrExpressionBodyImpl(it.expression.patchDeclarationParents(this)) } + initializer = enumEntry.initializerExpression?.let { + context.irFactory.createExpressionBody(it.expression.patchDeclarationParents(this)) + } annotations = annotations + enumEntry.annotations } diff --git a/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/InterfaceLowering.kt b/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/InterfaceLowering.kt index c5c2592e4a7..48f0ccdc230 100644 --- a/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/InterfaceLowering.kt +++ b/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/InterfaceLowering.kt @@ -214,22 +214,24 @@ internal class InterfaceLowering(val context: JvmBackendContext) : IrElementTran // Bridge from static to static method - simply fill the function arguments to the parameters. // By nature of the generation of both source and target of bridge, they line up. private fun IrFunction.bridgeToStatic(callTarget: IrSimpleFunction) { - body = IrExpressionBodyImpl(IrCallImpl.fromSymbolOwner(startOffset, endOffset, returnType, callTarget.symbol).also { call -> + body = context.irFactory.createExpressionBody( + IrCallImpl.fromSymbolOwner(startOffset, endOffset, returnType, callTarget.symbol).also { call -> - callTarget.typeParameters.forEachIndexed { i, _ -> - call.putTypeArgument(i, createPlaceholderAnyNType(context.irBuiltIns)) - } + callTarget.typeParameters.forEachIndexed { i, _ -> + call.putTypeArgument(i, createPlaceholderAnyNType(context.irBuiltIns)) + } - valueParameters.forEachIndexed { i, it -> - call.putValueArgument(i, IrGetValueImpl(startOffset, endOffset, it.symbol)) - } - }) + valueParameters.forEachIndexed { i, it -> + call.putValueArgument(i, IrGetValueImpl(startOffset, endOffset, it.symbol)) + } + }, + ) } // Bridge from static DefaultImpl method to the interface method. Arguments need to // be shifted in presence of dispatch and extension receiver. private fun IrFunction.bridgeViaAccessorTo(callTarget: IrSimpleFunction) { - body = IrExpressionBodyImpl( + body = context.irFactory.createExpressionBody( IrCallImpl.fromSymbolOwner( startOffset, endOffset, diff --git a/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/JvmOverloadsAnnotationLowering.kt b/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/JvmOverloadsAnnotationLowering.kt index 0cd47a90df1..f69925d05c9 100644 --- a/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/JvmOverloadsAnnotationLowering.kt +++ b/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/JvmOverloadsAnnotationLowering.kt @@ -108,7 +108,7 @@ private class JvmOverloadsAnnotationLowering(val context: JvmBackendContext) : C wrapperIrFunction.body = if (target is IrConstructor) { context.irFactory.createBlockBody(UNDEFINED_OFFSET, UNDEFINED_OFFSET, listOf(call)) } else { - IrExpressionBodyImpl( + context.irFactory.createExpressionBody( UNDEFINED_OFFSET, UNDEFINED_OFFSET, call ) } diff --git a/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/MoveCompanionObjectFieldsLowering.kt b/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/MoveCompanionObjectFieldsLowering.kt index f1c86decf99..2c90b79dcaf 100644 --- a/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/MoveCompanionObjectFieldsLowering.kt +++ b/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/MoveCompanionObjectFieldsLowering.kt @@ -17,7 +17,6 @@ import org.jetbrains.kotlin.ir.builders.declarations.addField import org.jetbrains.kotlin.ir.builders.irCall import org.jetbrains.kotlin.ir.declarations.* import org.jetbrains.kotlin.ir.expressions.* -import org.jetbrains.kotlin.ir.expressions.impl.IrExpressionBodyImpl import org.jetbrains.kotlin.ir.expressions.impl.IrGetFieldImpl import org.jetbrains.kotlin.ir.expressions.impl.IrSetFieldImpl import org.jetbrains.kotlin.ir.symbols.impl.IrAnonymousInitializerSymbolImpl @@ -114,7 +113,7 @@ private class MoveOrCopyCompanionObjectFieldsLowering(val context: JvmBackendCon parent = newParent correspondingPropertySymbol = oldProperty.symbol initializer = oldField.initializer?.run { - IrExpressionBodyImpl(startOffset, endOffset, (expression as IrConst<*>).shallowCopy()) + context.irFactory.createExpressionBody(startOffset, endOffset, (expression as IrConst<*>).shallowCopy()) } annotations += oldField.annotations if (oldProperty.parentAsClass.visibility == DescriptorVisibilities.PRIVATE) { diff --git a/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/SuspendLambdaLowering.kt b/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/SuspendLambdaLowering.kt index bb16eec10ad..a35d991df54 100644 --- a/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/SuspendLambdaLowering.kt +++ b/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/SuspendLambdaLowering.kt @@ -94,7 +94,11 @@ internal abstract class SuspendLoweringUtils(protected val context: JvmBackendCo val message = "This is a stub representing a copy of a suspend method without the state machine " + "(used by the inliner). Since the difference is at the bytecode level, the body is " + "still on the original function. Use suspendForInlineToOriginal() to retrieve it." - body = IrExpressionBodyImpl(startOffset, endOffset, IrErrorExpressionImpl(startOffset, endOffset, returnType, message)) + body = context.irFactory.createExpressionBody( + startOffset, + endOffset, + IrErrorExpressionImpl(startOffset, endOffset, returnType, message), + ) } protected fun IrFunction.addCompletionValueParameter(): IrValueParameter = diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/CachedSyntheticDeclarations.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/CachedSyntheticDeclarations.kt index 334464fd8c6..4b730157d88 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/CachedSyntheticDeclarations.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/CachedSyntheticDeclarations.kt @@ -172,7 +172,7 @@ class CachedSyntheticDeclarations(private val context: JvmBackendContext) { JvmLoweredDeclarationOrigin.SYNTHETIC_MARKER_PARAMETER ) - accessor.body = IrExpressionBodyImpl( + accessor.body = context.irFactory.createExpressionBody( UNDEFINED_OFFSET, UNDEFINED_OFFSET, createConstructorCall(accessor, source.symbol) ) @@ -208,7 +208,7 @@ class CachedSyntheticDeclarations(private val context: JvmBackendContext) { accessor.copyValueParametersToStatic(source, JvmLoweredDeclarationOrigin.SYNTHETIC_ACCESSOR, dispatchReceiverType) accessor.returnType = source.returnType.remapTypeParameters(source, accessor) - accessor.body = IrExpressionBodyImpl( + accessor.body = context.irFactory.createExpressionBody( accessor.startOffset, accessor.startOffset, createSimpleFunctionCall(accessor, source.symbol, superQualifierSymbol) ) @@ -270,7 +270,7 @@ class CachedSyntheticDeclarations(private val context: JvmBackendContext) { val maybeDispatchReceiver = if (targetField.isStatic) null else IrGetValueImpl(accessor.startOffset, accessor.endOffset, accessor.valueParameters[0].symbol) - return IrExpressionBodyImpl( + return context.irFactory.createExpressionBody( accessor.startOffset, accessor.endOffset, IrGetFieldImpl( accessor.startOffset, accessor.endOffset, @@ -332,7 +332,7 @@ class CachedSyntheticDeclarations(private val context: JvmBackendContext) { accessor.startOffset, accessor.endOffset, accessor.valueParameters[if (targetField.isStatic) 0 else 1].symbol ) - return IrExpressionBodyImpl( + return context.irFactory.createExpressionBody( accessor.startOffset, accessor.endOffset, IrSetFieldImpl( accessor.startOffset, accessor.endOffset, diff --git a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrExpressionBodyImpl.kt b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrExpressionBodyImpl.kt index f352f8e5019..295cb785f87 100644 --- a/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrExpressionBodyImpl.kt +++ b/compiler/ir/ir.tree/src/org/jetbrains/kotlin/ir/expressions/impl/IrExpressionBodyImpl.kt @@ -16,19 +16,18 @@ package org.jetbrains.kotlin.ir.expressions.impl +import org.jetbrains.kotlin.ir.IrImplementationDetail import org.jetbrains.kotlin.ir.declarations.IrFactory import org.jetbrains.kotlin.ir.declarations.impl.IrFactoryImpl import org.jetbrains.kotlin.ir.expressions.IrExpression import org.jetbrains.kotlin.ir.expressions.IrExpressionBody -class IrExpressionBodyImpl( +class IrExpressionBodyImpl @IrImplementationDetail constructor( override val startOffset: Int, override val endOffset: Int, override var expression: IrExpression, ) : IrExpressionBody() { - constructor(expression: IrExpression) : this(expression.startOffset, expression.endOffset, expression) - override val factory: IrFactory get() = IrFactoryImpl } diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/cenum/CEnumClassGenerator.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/cenum/CEnumClassGenerator.kt index c6084bcf1ba..e75de06d8c1 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/cenum/CEnumClassGenerator.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/ir/interop/cenum/CEnumClassGenerator.kt @@ -129,15 +129,17 @@ internal class CEnumClassGenerator( ) val constructorSymbol = symbolTable.descriptorExtension.referenceConstructor(enumDescriptor.unsubstitutedPrimaryConstructor!!) postLinkageSteps.add { - enumEntry.initializerExpression = IrExpressionBodyImpl(IrEnumConstructorCallImpl( - SYNTHETIC_OFFSET, SYNTHETIC_OFFSET, - type = irBuiltIns.unitType, - symbol = constructorSymbol, - typeArgumentsCount = 0, - valueArgumentsCount = constructorSymbol.owner.valueParameters.size - ).also { - it.putValueArgument(0, extractEnumEntryValue(entryDescriptor)) - }) + enumEntry.initializerExpression = context.irFactory.createExpressionBody( + IrEnumConstructorCallImpl( + SYNTHETIC_OFFSET, SYNTHETIC_OFFSET, + type = irBuiltIns.unitType, + symbol = constructorSymbol, + typeArgumentsCount = 0, + valueArgumentsCount = constructorSymbol.owner.valueParameters.size, + ).also { + it.putValueArgument(0, extractEnumEntryValue(entryDescriptor)) + }, + ) } return enumEntry } diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/ExpectDeclarationsRemoving.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/ExpectDeclarationsRemoving.kt index c19bf078a47..41187bb9318 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/ExpectDeclarationsRemoving.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/ExpectDeclarationsRemoving.kt @@ -14,8 +14,8 @@ import org.jetbrains.kotlin.descriptors.MemberDescriptor import org.jetbrains.kotlin.ir.IrElement import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI import org.jetbrains.kotlin.ir.declarations.* +import org.jetbrains.kotlin.ir.declarations.impl.IrFactoryImpl import org.jetbrains.kotlin.ir.expressions.IrExpression -import org.jetbrains.kotlin.ir.expressions.impl.IrExpressionBodyImpl import org.jetbrains.kotlin.ir.symbols.* import org.jetbrains.kotlin.ir.util.* import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid @@ -83,7 +83,7 @@ internal class ExpectToActualDefaultValueCopier(private val irModule: IrModuleFr val actualForExpected = function.findActualForExpected() actualForExpected.valueParameters[index].defaultValue = - IrExpressionBodyImpl( + irModule.irBuiltins.irFactory.createExpressionBody( defaultValue.startOffset, defaultValue.endOffset, defaultValue.expression.remapExpectValueSymbols().patchDeclarationParents(actualForExpected) ) diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/InitializersLowering.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/InitializersLowering.kt index 91ea5bc4101..312e4502d07 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/InitializersLowering.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/InitializersLowering.kt @@ -81,7 +81,7 @@ internal class InitializersLowering(val context: CommonBackendContext) : ClassLo // We shall keep initializer for constants for compile-time instantiation. // We suppose that if the property is const, then its initializer is IrConst. // If this requirement isn't satisfied, then PropertyAccessorInlineLowering can fail. - declaration.initializer = if (isConst) IrExpressionBodyImpl(initExpression.shallowCopy()) else null + declaration.initializer = if (isConst) context.irFactory.createExpressionBody(initExpression.shallowCopy()) else null return declaration } diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/InteropLowering.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/InteropLowering.kt index 02184fdc990..a92978055b8 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/InteropLowering.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/InteropLowering.kt @@ -186,7 +186,7 @@ private class InteropLoweringPart1(val generationState: NativeGenerationState) : if (eager) annotations += buildSimpleAnnotation(context.irBuiltIns, startOffset, endOffset, context.ir.symbols.eagerInitialization.owner) - initializer = IrExpressionBodyImpl(startOffset, endOffset, expression) + initializer = context.irFactory.createExpressionBody(startOffset, endOffset, expression) } addChild(irField) } diff --git a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/TestProcessor.kt b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/TestProcessor.kt index 15d1e0bf3de..d8c35c38d3b 100644 --- a/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/TestProcessor.kt +++ b/kotlin-native/backend.native/compiler/ir/backend.native/src/org/jetbrains/kotlin/backend/konan/lower/TestProcessor.kt @@ -617,7 +617,7 @@ internal class TestProcessor (val context: Context) { annotations += buildSimpleAnnotation(context.irBuiltIns, startOffset, endOffset, context.ir.symbols.eagerInitialization.owner) annotations += buildSimpleAnnotation(context.irBuiltIns, startOffset, endOffset, context.ir.symbols.threadLocal.owner) statements.forEach { it.accept(SetDeclarationsParentVisitor, this) } - initializer = IrExpressionBodyImpl(SYNTHETIC_OFFSET, SYNTHETIC_OFFSET, + initializer = context.irFactory.createExpressionBody(SYNTHETIC_OFFSET, SYNTHETIC_OFFSET, IrCompositeImpl(SYNTHETIC_OFFSET, SYNTHETIC_OFFSET, context.irBuiltIns.unitType, null, statements) ) } diff --git a/plugins/atomicfu/atomicfu-compiler/src/org/jetbrains/kotlinx/atomicfu/compiler/backend/common/AbstractAtomicfuIrBuilder.kt b/plugins/atomicfu/atomicfu-compiler/src/org/jetbrains/kotlinx/atomicfu/compiler/backend/common/AbstractAtomicfuIrBuilder.kt index 9fd69d7fec3..659e1e9e949 100644 --- a/plugins/atomicfu/atomicfu-compiler/src/org/jetbrains/kotlinx/atomicfu/compiler/backend/common/AbstractAtomicfuIrBuilder.kt +++ b/plugins/atomicfu/atomicfu-compiler/src/org/jetbrains/kotlinx/atomicfu/compiler/backend/common/AbstractAtomicfuIrBuilder.kt @@ -81,7 +81,7 @@ abstract class AbstractAtomicfuIrBuilder( visibility = DescriptorVisibilities.PRIVATE origin = AbstractAtomicSymbols.ATOMICFU_GENERATED_FIELD }.apply { - initializer = initValue?.let { IrExpressionBodyImpl(it) } + initializer = initValue?.let(context.irFactory::createExpressionBody) this.annotations = annotations + atomicSymbols.volatileAnnotationConstructorCall this.parent = parentContainer } @@ -103,7 +103,7 @@ abstract class AbstractAtomicfuIrBuilder( visibility = DescriptorVisibilities.PRIVATE origin = AbstractAtomicSymbols.ATOMICFU_GENERATED_FIELD }.apply { - this.initializer = IrExpressionBodyImpl( + this.initializer = context.irFactory.createExpressionBody( newAtomicArray(arrayClass, size, dispatchReceiver) ) this.annotations = annotations @@ -150,7 +150,7 @@ abstract class AbstractAtomicfuIrBuilder( this.visibility = DescriptorVisibilities.PRIVATE origin = AbstractAtomicSymbols.ATOMICFU_GENERATED_FIELD }.apply { - initializer = IrExpressionBodyImpl( + initializer = context.irFactory.createExpressionBody( IrConstructorCallImpl.fromSymbolOwner( irClass.defaultType, irClass.primaryConstructor!!.symbol diff --git a/plugins/kotlinx-serialization/kotlinx-serialization.backend/src/org/jetbrains/kotlinx/serialization/compiler/backend/ir/IrBuilderWithPluginContext.kt b/plugins/kotlinx-serialization/kotlinx-serialization.backend/src/org/jetbrains/kotlinx/serialization/compiler/backend/ir/IrBuilderWithPluginContext.kt index a774864ad0e..52c1a53d95c 100644 --- a/plugins/kotlinx-serialization/kotlinx-serialization.backend/src/org/jetbrains/kotlinx/serialization/compiler/backend/ir/IrBuilderWithPluginContext.kt +++ b/plugins/kotlinx-serialization/kotlinx-serialization.backend/src/org/jetbrains/kotlinx/serialization/compiler/backend/ir/IrBuilderWithPluginContext.kt @@ -180,7 +180,7 @@ interface IrBuilderWithPluginContext { field.startOffset, field.endOffset ) - field.initializer = IrExpressionBodyImpl(builder.initializer()) + field.initializer = factory.createExpressionBody(builder.initializer()) field.annotations += createAnnotationCallWithoutArgs(compilerContext.jvmFieldClassSymbol) } }