diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/AddContinuationLowering.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/AddContinuationLowering.kt index 5e9b54469ed..67ad8abcc87 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/AddContinuationLowering.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/lower/AddContinuationLowering.kt @@ -560,13 +560,13 @@ private class AddContinuationLowering(private val context: JvmBackendContext) : copyBodyFrom(function) copyAttributes(function) } - functionsToAdd[function.parentAsClass] = mutableSetOf(newFunction) + registerNewFunction(function.parentAsClass, newFunction) } val newFunction = if (function.isOverridable) { // Create static method for the suspend state machine method so that reentering the method // does not lead to virtual dispatch to the wrong method. - functionsToAdd.getOrPut(function.parentAsClass) { mutableSetOf() }.add(function) + registerNewFunction(function.parentAsClass, function) createStaticSuspendImpl(function) } else function @@ -602,6 +602,10 @@ private class AddContinuationLowering(private val context: JvmBackendContext) : }) } + private fun registerNewFunction(container: IrClass, function: IrFunction) { + functionsToAdd.getOrPut(container) { mutableSetOf() }.add(function) + } + private fun markSuspendLambdas(irElement: IrElement): Pair, List> { val suspendLambdas = arrayListOf() val inlineLambdas = mutableSetOf() diff --git a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectSeveralFunctions.kt b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectSeveralFunctions.kt index bc882d77405..d3ae1435f04 100644 --- a/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectSeveralFunctions.kt +++ b/compiler/testData/codegen/boxInline/suspend/stateMachine/innerObjectSeveralFunctions.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND_MULTI_MODULE: JVM_IR // FILE: inlined.kt // COMMON_COROUTINES_TEST // WITH_RUNTIME diff --git a/compiler/testData/codegen/boxInline/suspend/stateMachine/oneInlineTwoCaptures.kt b/compiler/testData/codegen/boxInline/suspend/stateMachine/oneInlineTwoCaptures.kt index 24978d8f08f..85fce7eea6a 100644 --- a/compiler/testData/codegen/boxInline/suspend/stateMachine/oneInlineTwoCaptures.kt +++ b/compiler/testData/codegen/boxInline/suspend/stateMachine/oneInlineTwoCaptures.kt @@ -1,5 +1,3 @@ -// IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND_MULTI_MODULE: JVM_IR // COMMON_COROUTINES_TEST // WITH_RUNTIME // WITH_COROUTINES