JVM_IR KT-47984 don't move inplace arguments with suspension points
This commit is contained in:
committed by
TeamCityServer
parent
9acdcc7590
commit
9be941def2
+25
@@ -0,0 +1,25 @@
|
||||
// IGNORE_BACKEND: WASM
|
||||
// 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()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user