diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsBoxTestGenerated.java index 4fbbdc1c9f6..48ecea61e85 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsBoxTestGenerated.java @@ -872,6 +872,12 @@ public class FirJsBoxTestGenerated extends AbstractFirJsBoxTest { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box/coroutines"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true); } + @Test + @TestMetadata("boxingUnboxingInsideTheSuspendFunction.kt") + public void testBoxingUnboxingInsideTheSuspendFunction() throws Exception { + runTest("js/js.translator/testData/box/coroutines/boxingUnboxingInsideTheSuspendFunction.kt"); + } + @Test @TestMetadata("debugStatement.kt") public void testDebugStatement() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6BoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6BoxTestGenerated.java index d87a4ea57b2..ed0071d167b 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6BoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/fir/FirJsES6BoxTestGenerated.java @@ -872,6 +872,12 @@ public class FirJsES6BoxTestGenerated extends AbstractFirJsES6BoxTest { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box/coroutines"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } + @Test + @TestMetadata("boxingUnboxingInsideTheSuspendFunction.kt") + public void testBoxingUnboxingInsideTheSuspendFunction() throws Exception { + runTest("js/js.translator/testData/box/coroutines/boxingUnboxingInsideTheSuspendFunction.kt"); + } + @Test @TestMetadata("debugStatement.kt") public void testDebugStatement() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrBoxJsES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrBoxJsES6TestGenerated.java index a80f0a62e1e..2a957b1a7e8 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrBoxJsES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrBoxJsES6TestGenerated.java @@ -872,6 +872,12 @@ public class IrBoxJsES6TestGenerated extends AbstractIrBoxJsES6Test { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box/coroutines"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } + @Test + @TestMetadata("boxingUnboxingInsideTheSuspendFunction.kt") + public void testBoxingUnboxingInsideTheSuspendFunction() throws Exception { + runTest("js/js.translator/testData/box/coroutines/boxingUnboxingInsideTheSuspendFunction.kt"); + } + @Test @TestMetadata("debugStatement.kt") public void testDebugStatement() throws Exception { diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrBoxJsTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrBoxJsTestGenerated.java index e7ce8bf74a0..3745ca4d8bb 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrBoxJsTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/IrBoxJsTestGenerated.java @@ -872,6 +872,12 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("js/js.translator/testData/box/coroutines"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.JS_IR, true); } + @Test + @TestMetadata("boxingUnboxingInsideTheSuspendFunction.kt") + public void testBoxingUnboxingInsideTheSuspendFunction() throws Exception { + runTest("js/js.translator/testData/box/coroutines/boxingUnboxingInsideTheSuspendFunction.kt"); + } + @Test @TestMetadata("debugStatement.kt") public void testDebugStatement() throws Exception { diff --git a/js/js.translator/testData/box/coroutines/boxingUnboxingInsideTheSuspendFunction.kt b/js/js.translator/testData/box/coroutines/boxingUnboxingInsideTheSuspendFunction.kt new file mode 100644 index 00000000000..fe3814024d3 --- /dev/null +++ b/js/js.translator/testData/box/coroutines/boxingUnboxingInsideTheSuspendFunction.kt @@ -0,0 +1,37 @@ +// WITH_STDLIB +// EXPECTED_REACHABLE_NODES: 1292 +// KT-60785 +// Ignored until the rr/vgrechko/accidental-reification-2 will be merged +// IGNORE_BACKEND: JS_IR, JS_IR_ES6 + +import kotlin.coroutines.* +import kotlin.coroutines.intrinsics.* + +value class SomeValue(val a: String) { + override fun toString() = when (a) { + "fa" -> "O" + "il" -> "K" + else -> "" + } +} + +suspend fun foo() = mapOf(SomeValue("fa") to SomeValue("il")) + +fun builder(c: suspend () -> Unit) { + c.startCoroutine(object : Continuation { + override val context = EmptyCoroutineContext + override fun resumeWith(result: Result) {} + }) +} + +fun box(): String { + var result = "" + + builder { + for ((k, v) in foo()) { + result += "$k$v" + } + } + + return result +} \ No newline at end of file