JVM_IR: Also check attributes for suspendImpls when generating continuation

Otherwise, it would not generate continuations for overloads.
This commit is contained in:
Ilmir Usmanov
2019-12-27 16:04:36 +01:00
parent d17afddaa9
commit 4d9d62ad12
9 changed files with 94 additions and 3 deletions
@@ -0,0 +1,43 @@
// IGNORE_BACKEND_FIR: JVM_IR
// WITH_RUNTIME
// WITH_COROUTINES
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
import COROUTINES_PACKAGE.intrinsics.*
open class A(val v: String) {
suspend fun suspendThere(v: String): String = suspendCoroutineUninterceptedOrReturn { x ->
x.resume(v)
COROUTINE_SUSPENDED
}
open suspend fun suspendHere(): String = suspendThere("O") + suspendThere(v)
}
class B(v: String) : A(v) {
override suspend fun suspendHere(): String = super.suspendHere() + suspendThere("56")
suspend fun suspendHere(s: String): String = super.suspendHere() + suspendThere(s)
}
fun builder(c: suspend A.() -> Unit) {
c.startCoroutine(B("K"), EmptyContinuation)
}
fun box(): String {
var result = ""
builder {
result = suspendHere()
}
if (result != "OK56") return "fail 1: $result"
builder {
result = (this as B).suspendHere("OK")
}
if (result != "OKOK") return "fail 2: $result"
return "OK"
}