Files
kotlin/compiler/testData/codegen/box/funInterface/suspendFunInterfaceConversionCodegen.kt
2020-02-04 16:14:29 +03:00

28 lines
532 B
Kotlin
Vendored

// !LANGUAGE: +NewInference +FunctionalInterfaceConversion +SamConversionPerArgument +SamConversionForKotlinFunctions
// IGNORE_BACKEND_FIR: JVM_IR
// IGNORE_BACKEND: JS, JS_IR
// WITH_COROUTINES
// WITH_RUNTIME
import helpers.*
import kotlin.coroutines.startCoroutine
fun interface SuspendRunnable {
suspend fun invoke()
}
fun run(r: SuspendRunnable) {
r::invoke.startCoroutine(EmptyContinuation)
}
var result = "initial"
suspend fun bar() {
result = "OK"
}
fun box(): String {
run(::bar)
return result
}