25 lines
495 B
Kotlin
Vendored
25 lines
495 B
Kotlin
Vendored
// WITH_RUNTIME
|
|
|
|
import kotlin.coroutines.*
|
|
|
|
fun runs(f: suspend () -> String): String {
|
|
var result: String? = null
|
|
f.startCoroutine(
|
|
Continuation(EmptyCoroutineContext) {
|
|
result = it.getOrThrow()
|
|
}
|
|
)
|
|
return result ?: "Fail"
|
|
}
|
|
|
|
suspend fun suspendListOf(s: String) = listOf(s)
|
|
|
|
val strings: MutableCollection<String> = ArrayList()
|
|
|
|
fun box(): String {
|
|
return runs {
|
|
strings += suspendListOf("OK")
|
|
strings.iterator().next()
|
|
}
|
|
}
|