Add test for default lambda inlining in suspend inline

This commit is contained in:
Mikhael Bogdanov
2019-11-20 12:39:44 +01:00
parent a92afc5a89
commit d28ec1d449
7 changed files with 83 additions and 0 deletions
@@ -0,0 +1,38 @@
// IGNORE_BACKEND: JVM_IR
// IGNORE_BACKEND_MULTI_MODULE: JVM_IR
// FILE: test.kt
// COMMON_COROUTINES_TEST
// WITH_RUNTIME
// WITH_COROUTINES
// NO_CHECK_LAMBDA_INLINING
import COROUTINES_PACKAGE.*
import helpers.*
class Controller {
var res = "FAIL 1"
}
val defaultController = Controller()
suspend inline fun test(controller: Controller, c: () -> Unit = { controller.res = "OK" }) {
c()
}
// FILE: box.kt
// COMMON_COROUTINES_TEST
import COROUTINES_PACKAGE.*
import helpers.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
fun box() : String {
builder() {
test(defaultController)
}
return defaultController.res
}