[Tests] Add tests with default params and suspending contextual function

This commit is contained in:
Anastasiya Shadrina
2021-11-10 18:38:42 +07:00
committed by TeamCityServer
parent cd2fbfed2e
commit 2e97e78e6a
4 changed files with 75 additions and 0 deletions
@@ -0,0 +1,31 @@
// !LANGUAGE: +ContextReceivers
// TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
// 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
}