Fix wrong state-machine generation if inner object is retransformed

during inlining.
 #KT-29492 Fixed
This commit is contained in:
Ilmir Usmanov
2019-03-12 17:49:31 +03:00
parent 7b97c2a42a
commit 1c2b8e6fad
19 changed files with 481 additions and 55 deletions
@@ -0,0 +1,48 @@
// IGNORE_BACKEND: JVM_IR
// COMMON_COROUTINES_TEST
// WITH_RUNTIME
// WITH_COROUTINES
// CHECK_STATE_MACHINE
// FILE: inline.kt
import helpers.*
interface SuspendRunnable {
suspend fun run()
}
class R : SuspendRunnable {
override suspend fun run() {
val sr: SuspendRunnable = inlineMe2 {
StateMachineChecker.suspendHere()
StateMachineChecker.suspendHere()
}
sr.run()
}
inline fun inlineMe2(crossinline c: suspend () -> Unit) = object : SuspendRunnable {
override suspend fun run() {
c()
c()
}
}
}
// FILE: box.kt
// COMMON_COROUTINES_TEST
import helpers.*
import COROUTINES_PACKAGE.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(CheckStateMachineContinuation)
}
fun box(): String {
builder {
R().run()
}
StateMachineChecker.check(numberOfSuspensions = 4)
return "OK"
}