Files
kotlin/compiler/testData/codegen/box/coroutines/inlineFunInGenericClass.kt
Roman Artemev efec82c0eb Update test data
* add new tests for coroutines
 * add copy of some tests without dependency on stdlib
2018-08-08 18:33:41 +03:00

34 lines
637 B
Kotlin
Vendored

// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
suspend fun suspendThere(v: Any?): String = suspendCoroutineUninterceptedOrReturn { x ->
x.resume(v?.toString() ?: "<empty>")
COROUTINE_SUSPENDED
}
class A<T>(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<String>("OK")
builder {
a.foo()
}
return a.result
}