Files
kotlin-fork/compiler/testData/codegen/box/inlineArgsInPlace/suspensionPointInsideArgument.kt
T
2021-10-12 08:42:00 +03:00

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()
}
}