Files
kotlin-fork/compiler/testData/codegen/box/extensionFunctions/contextReceivers/useFromAnotherModuleSuspending.kt
T
2022-04-06 16:05:39 +00:00

31 lines
538 B
Kotlin
Vendored

// !LANGUAGE: +ContextReceivers
// TARGET_BACKEND: JVM_IR
// WITH_STDLIB
// WITH_COROUTINES
// MODULE: lib
// FILE: A.kt
package a
context(String)
suspend fun f() = this@String
// MODULE: main(lib)
// FILE: B.kt
import helpers.*
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*
fun box(): String {
var result: String = "fail"
val block: suspend () -> String = {
with("OK") { a.f() }
}
block.startCoroutine(handleResultContinuation { value ->
result = value
})
return result
}