Files
kotlin-fork/compiler/testData/codegen/boxInline/suspend/inlinePassthrough.kt
T
Ivan Kylchik c7435ba760 Replace all occurrences of WITH_RUNTIME with WITH_STDLIB
We are going to deprecate `WITH_RUNTIME` directive. The main reason
behind this change is that `WITH_STDLIB` directive better describes
its meaning, specifically it will add kotlin stdlib to test's classpath.
2021-11-17 15:26:38 +03:00

26 lines
590 B
Kotlin
Vendored

// WITH_COROUTINES
// WITH_STDLIB
// IGNORE_BACKEND_MULTI_MODULE: JVM_MULTI_MODULE_OLD_AGAINST_IR
// FILE: test.kt
package test
inline suspend fun f(crossinline x: suspend () -> Unit) =
object { suspend fun foo() = x() }.foo()
// FILE: main.kt
import test.*
import kotlin.coroutines.*
import helpers.*
inline suspend fun g(crossinline x: suspend () -> Unit) =
f(x)
var result: String = "fail"
inline suspend fun h(crossinline x: suspend () -> String) =
g { result = x() }
fun box(): String {
suspend { h { "OK" } }.startCoroutine(EmptyContinuation)
return result
}