[BE JVM] KT-51352 Do not mix extension and context receivers in suspends

This commit is contained in:
Anastasia.Shadrina
2022-02-17 21:48:42 +07:00
committed by teamcity
parent 47f0a84c7a
commit 4bc7b0c366
4 changed files with 52 additions and 0 deletions
@@ -0,0 +1,39 @@
// !LANGUAGE: +ContextReceivers
// TARGET_BACKEND: JVM_IR
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_COROUTINES
// WITH_STDLIB
// FIR status: context receivers aren't yet supported
import helpers.*
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*
class Context {
fun c() = "O"
}
class Extension {
fun e() = "K"
}
context(Context)
suspend fun Extension.suspendingTest() = c() + e()
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
fun box(): String {
var result = "fail"
builder {
with(Extension()) {
with(Context()) {
result = suspendingTest()
}
}
}
return result
}