diff --git a/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/JvmMultiFieldValueClassLowering.kt b/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/JvmMultiFieldValueClassLowering.kt index 3b1da6a1fad..b2d45746ef9 100644 --- a/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/JvmMultiFieldValueClassLowering.kt +++ b/compiler/ir/backend.jvm/lower/src/org/jetbrains/kotlin/backend/jvm/lower/JvmMultiFieldValueClassLowering.kt @@ -1423,6 +1423,13 @@ private fun findNearestBlocksForVariables(variables: Set, body: Bloc } override fun visitBlock(expression: IrBlock) { + // This is a workaround. + // We process IrInlinedFunctionBlock on codegen in a special way by processing composite blocks with arguments evaluation first. + // Thus, we don't want IrInlinedFunctionBlock to contain variable declarations before this composite blocks. + // That is why we move variable declarations from IrInlinedFunctionBlock to the outer block. + if (expression is IrInlinedFunctionBlock) { + return super.visitBlock(expression) + } currentStackElement()?.let { childrenBlocks.getOrPut(it) { mutableListOf() }.add(Block(expression)) } stack.add(Block(expression)) super.visitBlock(expression) diff --git a/compiler/testData/codegen/box/valueClasses/functionReferences.kt b/compiler/testData/codegen/box/valueClasses/functionReferences.kt index a01f0662482..495d136418b 100644 --- a/compiler/testData/codegen/box/valueClasses/functionReferences.kt +++ b/compiler/testData/codegen/box/valueClasses/functionReferences.kt @@ -2,7 +2,6 @@ // WITH_STDLIB // WITH_COROUTINES // TARGET_BACKEND: JVM_IR -// IGNORE_INLINER: IR // LANGUAGE: +ValueClasses // FIR_IDENTICAL