mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-16 15:53:55 +00:00
34 lines
618 B
Kotlin
Vendored
34 lines
618 B
Kotlin
Vendored
// IGNORE_BACKEND: JVM_IR
|
|
// WITH_RUNTIME
|
|
// WITH_COROUTINES
|
|
// COMMON_COROUTINES_TEST
|
|
import helpers.*
|
|
import COROUTINES_PACKAGE.*
|
|
import COROUTINES_PACKAGE.intrinsics.*
|
|
|
|
|
|
suspend fun suspendHere(): String = suspendCoroutineUninterceptedOrReturn { x ->
|
|
x.resume("OK")
|
|
COROUTINE_SUSPENDED
|
|
}
|
|
|
|
fun builder(c: suspend () -> Unit) {
|
|
var isCompleted = false
|
|
c.startCoroutine(handleResultContinuation {
|
|
isCompleted = true
|
|
})
|
|
if (!isCompleted) throw RuntimeException("fail")
|
|
}
|
|
|
|
fun box(): String {
|
|
builder {
|
|
"OK"
|
|
}
|
|
|
|
builder {
|
|
suspendHere()
|
|
}
|
|
|
|
return "OK"
|
|
}
|