[K/JS] Process JS-specific returnable blocks before the state machine building

^KT-60785 Fixed
^KT-63207 Fixed
This commit is contained in:
Artem Kobzar
2023-11-16 13:25:51 +00:00
committed by Space Team
parent 36452b5db7
commit 890fbd6b0b
15 changed files with 75 additions and 10 deletions
@@ -962,6 +962,12 @@ public class FirJsBoxTestGenerated extends AbstractFirJsBoxTest {
runTest("js/js.translator/testData/box/coroutines/suspendInvokeWithSuspendKlassRef.kt");
}
@Test
@TestMetadata("suspendLambdaWithValueClass.kt")
public void testSuspendLambdaWithValueClass() throws Exception {
runTest("js/js.translator/testData/box/coroutines/suspendLambdaWithValueClass.kt");
}
@Test
@TestMetadata("suspendMethodWithSuperCall.kt")
public void testSuspendMethodWithSuperCall() throws Exception {
@@ -962,6 +962,12 @@ public class FirJsES6BoxTestGenerated extends AbstractFirJsES6BoxTest {
runTest("js/js.translator/testData/box/coroutines/suspendInvokeWithSuspendKlassRef.kt");
}
@Test
@TestMetadata("suspendLambdaWithValueClass.kt")
public void testSuspendLambdaWithValueClass() throws Exception {
runTest("js/js.translator/testData/box/coroutines/suspendLambdaWithValueClass.kt");
}
@Test
@TestMetadata("suspendMethodWithSuperCall.kt")
public void testSuspendMethodWithSuperCall() throws Exception {
@@ -962,6 +962,12 @@ public class IrBoxJsES6TestGenerated extends AbstractIrBoxJsES6Test {
runTest("js/js.translator/testData/box/coroutines/suspendInvokeWithSuspendKlassRef.kt");
}
@Test
@TestMetadata("suspendLambdaWithValueClass.kt")
public void testSuspendLambdaWithValueClass() throws Exception {
runTest("js/js.translator/testData/box/coroutines/suspendLambdaWithValueClass.kt");
}
@Test
@TestMetadata("suspendMethodWithSuperCall.kt")
public void testSuspendMethodWithSuperCall() throws Exception {
@@ -962,6 +962,12 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
runTest("js/js.translator/testData/box/coroutines/suspendInvokeWithSuspendKlassRef.kt");
}
@Test
@TestMetadata("suspendLambdaWithValueClass.kt")
public void testSuspendLambdaWithValueClass() throws Exception {
runTest("js/js.translator/testData/box/coroutines/suspendLambdaWithValueClass.kt");
}
@Test
@TestMetadata("suspendMethodWithSuperCall.kt")
public void testSuspendMethodWithSuperCall() throws Exception {
@@ -1,8 +1,6 @@
// 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.*
@@ -0,0 +1,43 @@
// WITH_STDLIB
// WITH_COROUTINES
// IGNORE_BACKEND: JS
import helpers.*
import kotlin.coroutines.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(object : Continuation<Unit> {
override val context = EmptyCoroutineContext
override fun resumeWith(result: Result<Unit>) {
result.getOrThrow()
}
})
}
fun box(): String {
val a: suspend () -> Unit = {
mapOf(
0x0000000000000000UL to 0x0000000000000000UL
).forEach { (base: ULong) ->
0x0000000000000000UL.ror(2)
base.ror(1)
}
}
val b: () -> Unit = {
mapOf(
0x0000000000000000UL to 0x0000000000000000UL
).forEach { (base: ULong) ->
0x0000000000000000UL.ror(2)
base.ror(1)
}
}
builder {
a()
b()
}
return "OK"
}
infix fun ULong.ror(shift: Int): ULong = this shr shift
+1 -2
View File
@@ -15,5 +15,4 @@ suspend fun bar(): Unit {
}
// LINES(JS): 39 4 4 4 7 5 5 45 45 5 93 45 5 5 6 4 4 4 9 15 9 9 9 * 9 15 10 10 11 11 11 11 11 * 11 12 12 13 13 13 13 13 13 13 14 14 * 9 15 9 9 9 9
// LINES(JS_IR): 4 4 * 93 3 45 45 7 7 6 9 9 * 9 * 9 * 10 10 * 11 * 11 12 12 * 13 * 13 14 14 15 15
// LINES(JS_IR): 4 4 * 9 9 * 4 * 4 * 19 5 5 * 19 * 19 19 * 19 19 * 6 6 * 19 * 19 * 4 * 9 * 9 * 10 10 * 11 * 11 12 12 * 13 * 13 14 14 15 15