mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 00:21:47 +00:00
26 lines
471 B
Kotlin
Vendored
26 lines
471 B
Kotlin
Vendored
// !LANGUAGE: +NewInference +FunctionInterfaceConversion +SamConversionPerArgument +SamConversionForKotlinFunctions
|
|
// 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
|
|
}
|