Files
kotlin-fork/compiler/testData/codegen/box/closures/capturedVarsOptimization/kt44347.kt
T
2021-01-15 10:33:11 +03:00

22 lines
427 B
Kotlin
Vendored

// WITH_RUNTIME
import kotlin.coroutines.*
fun launch(block: suspend (Long) -> String): String {
var result = ""
block.startCoroutine(0L, Continuation(EmptyCoroutineContext) { result = it.getOrThrow() })
return result
}
suspend fun g() {}
class C {
suspend fun f(i: Long): String {
var x = 0
listOf<Int>().map { x }
g()
return "OK"
}
}
fun box(): String = launch(C()::f)