diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineTransformerMethodVisitor.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineTransformerMethodVisitor.kt index 22a1a8f26e7..a3f58607bf0 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineTransformerMethodVisitor.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/coroutines/CoroutineTransformerMethodVisitor.kt @@ -76,6 +76,9 @@ class CoroutineTransformerMethodVisitor( if (isForNamedFunction) getLastParameterIndex(methodNode.desc, methodNode.access) else 0 ) + // If there are in-place argument and call markers around suspend call, they end up in separate + // states of state-machine, leading to AnalyzerError. + InplaceArgumentsMethodTransformer().transform(containingClassInternalName, methodNode) FixStackMethodTransformer().transform(containingClassInternalName, methodNode) val suspensionPoints = collectSuspensionPoints(methodNode) RedundantLocalsEliminationMethodTransformer(suspensionPoints) diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java index 7caf445320f..81661153005 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java @@ -13565,6 +13565,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/coroutines/varSpilling/debugMode/if.kt"); } + @Test + @TestMetadata("inlineOnly.kt") + public void testInlineOnly() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/debugMode/inlineOnly.kt"); + } + @Test @TestMetadata("nullCleanup.kt") public void testNullCleanup() throws Exception { diff --git a/compiler/testData/codegen/box/coroutines/varSpilling/debugMode/inlineOnly.kt b/compiler/testData/codegen/box/coroutines/varSpilling/debugMode/inlineOnly.kt new file mode 100644 index 00000000000..665bc70b3b3 --- /dev/null +++ b/compiler/testData/codegen/box/coroutines/varSpilling/debugMode/inlineOnly.kt @@ -0,0 +1,23 @@ +// WITH_STDLIB +// FULL_JDK +// TARGET_BACKEND: JVM_IR +// IGNORE_BACKEND: JVM +// IGNORE_BACKEND: ANDROID + +import kotlin.coroutines.* + +@Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER") +@kotlin.internal.InlineOnly +inline fun f(a: Int): Int = a + +fun box(): String { + var res = "FAIL" + suspend { + f(0) + res = "OK" + suspendCoroutine {} + }.startCoroutine(Continuation(EmptyCoroutineContext) { + it.getOrThrow() + }) + return res +} \ No newline at end of file diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index 40b88487bfa..267a2e73403 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -13565,6 +13565,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/coroutines/varSpilling/debugMode/if.kt"); } + @Test + @TestMetadata("inlineOnly.kt") + public void testInlineOnly() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varSpilling/debugMode/inlineOnly.kt"); + } + @Test @TestMetadata("nullCleanup.kt") public void testNullCleanup() throws Exception {