JVM_IR: mark direct uses of inline lambdas as conditionally suspend
They may or may not be inlined later. IDK how the test passes when both modules are compiled with the old backend - perhaps this has something to do with the fact that when `f` is compiled with the IR backend, the call to `x()` is followed by `pop` and `getstatic kotlin/Unit.INSTANCE`? This is probably why the original issue in kotlinx.coroutines reports that everything works fine with kotlinx-coroutines-core:1.4.3. ^KT-46879 Fixed ^KT-48801 Fixed
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
// WITH_COROUTINES
|
||||
// WITH_RUNTIME
|
||||
// IGNORE_BACKEND_MULTI_MODULE: JVM_MULTI_MODULE_OLD_AGAINST_IR
|
||||
// FILE: test.kt
|
||||
package test
|
||||
|
||||
inline suspend fun f(crossinline x: suspend () -> Unit) =
|
||||
object { suspend fun foo() = x() }.foo()
|
||||
|
||||
// FILE: main.kt
|
||||
import test.*
|
||||
import kotlin.coroutines.*
|
||||
import helpers.*
|
||||
|
||||
inline suspend fun g(crossinline x: suspend () -> Unit) =
|
||||
f(x)
|
||||
|
||||
var result: String = "fail"
|
||||
|
||||
inline suspend fun h(crossinline x: suspend () -> String) =
|
||||
g { result = x() }
|
||||
|
||||
fun box(): String {
|
||||
suspend { h { "OK" } }.startCoroutine(EmptyContinuation)
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user