Check for COROUTINE_SUSPENDED inside callable reference
#KT-41429 Fixed
This commit is contained in:
+30
@@ -0,0 +1,30 @@
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
// IGNORE_BACKEND: JS_IR_ES6
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
|
||||
import helpers.*
|
||||
import kotlin.coroutines.*
|
||||
|
||||
inline class R(val x: Any)
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
suspend fun <T> call(fn: suspend () -> T) = fn()
|
||||
|
||||
fun useR(r: R) = if (r.x == "OK") "OK" else "fail: $r"
|
||||
|
||||
var c: Continuation<R>? = null
|
||||
|
||||
suspend fun ok() = suspendCoroutine<R> { c = it }
|
||||
|
||||
fun box(): String {
|
||||
var res: String = "fail"
|
||||
builder {
|
||||
res = useR(call(::ok))
|
||||
}
|
||||
c?.resume(R("OK"))
|
||||
return res
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
import helpers.*
|
||||
import kotlin.coroutines.*
|
||||
|
||||
Reference in New Issue
Block a user