test(KT-51066): fixate behavior of value classes in composition with suspend lambdas.
This commit is contained in:
@@ -790,6 +790,12 @@ public class BoxJsTestGenerated extends AbstractBoxJsTest {
|
||||
runTest("js/js.translator/testData/box/coroutines/debugStatement.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lambdaWithValueClass.kt")
|
||||
public void testLambdaWithValueClass() throws Exception {
|
||||
runTest("js/js.translator/testData/box/coroutines/lambdaWithValueClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("localVarOptimization.kt")
|
||||
public void testLocalVarOptimization() throws Exception {
|
||||
|
||||
+6
@@ -790,6 +790,12 @@ public class IrBoxJsTestGenerated extends AbstractIrBoxJsTest {
|
||||
runTest("js/js.translator/testData/box/coroutines/debugStatement.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("lambdaWithValueClass.kt")
|
||||
public void testLambdaWithValueClass() throws Exception {
|
||||
runTest("js/js.translator/testData/box/coroutines/lambdaWithValueClass.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("localVarOptimization.kt")
|
||||
public void testLocalVarOptimization() throws Exception {
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
// EXPECTED_REACHABLE_NODES: 1282
|
||||
// WITH_STDLIB
|
||||
package foo
|
||||
|
||||
import kotlin.coroutines.*
|
||||
import kotlin.coroutines.intrinsics.*
|
||||
|
||||
value class Res(val value: String)
|
||||
|
||||
suspend fun bar(): Res {
|
||||
val lambda: suspend () -> Res = { Res("OK") }
|
||||
return lambda.invoke()
|
||||
}
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
c.startCoroutine(object : Continuation<Unit> {
|
||||
override val context = EmptyCoroutineContext
|
||||
|
||||
override fun resumeWith(result: Result<Unit>) {}
|
||||
})
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var result = ""
|
||||
|
||||
builder {
|
||||
result = bar().toString().substring(10, 12)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user