// WITH_RUNTIME // WITH_COROUTINES import helpers.* import kotlin.coroutines.experimental.* import kotlin.coroutines.experimental.intrinsics.* suspend fun suspendThere(v: Any?): String = suspendCoroutineOrReturn { x -> x.resume(v?.toString() ?: "") COROUTINE_SUSPENDED } class A(val arg: T) { var result = "" inline suspend fun foo() { result = suspendThere(arg) } } fun builder(c: suspend () -> Unit) { c.startCoroutine(EmptyContinuation) } fun box(): String { val a = A("OK") builder { a.foo() } return a.result }