JVM_IR: reuse same bodies for suspend funs and $$forInline versions

This commit is contained in:
pyos
2020-03-04 13:37:20 +01:00
committed by Ilmir Usmanov
parent 8945d5a0df
commit 5ed845d0b4
16 changed files with 152 additions and 97 deletions
@@ -0,0 +1,25 @@
// WITH_RUNTIME
// WITH_COROUTINES
// IGNORE_BACKEND: JVM
// IGNORE_BACKEND_MULTI_MODULE: JVM
// NO_CHECK_LAMBDA_INLINING
// FILE: a.kt
inline suspend fun runReturning(lambda: suspend () -> Unit): Unit =
lambda()
inline suspend fun myRun(lambda: suspend () -> String): String {
runReturning { return lambda() }
return "fail: did not return from lambda"
}
// FILE: b.kt
import helpers.*
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*
fun box(): String {
var result = "fail"
suspend { result = myRun { "OK" } }.startCoroutine(EmptyContinuation)
return result
}