JVM_IR KT-50277 skip temporary var elimination on inline suspend lambda

This commit is contained in:
Dmitry Petrov
2021-12-15 14:41:56 +03:00
committed by Space
parent 6807ed6642
commit ab9747ed6d
7 changed files with 54 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
// WITH_STDLIB
// WITH_COROUTINES
// TARGET_BACKEND: JVM
import helpers.*
import kotlin.coroutines.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
suspend fun g(): Int = 42
suspend fun f(block: suspend (a: Int) -> Unit) {
listOf(0).map { block(g()) }
}
fun box(): String {
var result = "Failed"
builder {
f { result = "OK" }
}
return result
}