Hack attributes for continuation of suspend function in SAM-adapter

This commit is contained in:
Ilmir Usmanov
2020-08-11 00:10:17 +02:00
parent 2e131b870a
commit d861373c6d
6 changed files with 58 additions and 0 deletions
@@ -0,0 +1,27 @@
// WITH_RUNTIME
// WITH_COROUTINES
// TARGET_BACKEND: JVM
// IGNORE_BACKEND: JVM
// IGNORE_BACKEND_FIR: JVM_IR
import helpers.*
import kotlin.coroutines.*
fun interface Action {
suspend fun run()
}
suspend fun runAction(a: Action) {
a.run()
}
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
fun box(): String {
var res = "FAIL"
builder {
runAction {
res = "OK"
}
}
return res
}