From f8f2be3d9fb08cfeba779fe15ea5419894f3fb3d Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Fri, 25 Sep 2020 14:44:21 +0200 Subject: [PATCH] Minor, improve test on suspend invoke function reference Add WITH_RUNTIME to enable it for the old backend, check the generated function reference methods by starting the coroutine. --- .../coroutines/suspendFunctionMethodReference.kt | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/compiler/testData/codegen/box/coroutines/suspendFunctionMethodReference.kt b/compiler/testData/codegen/box/coroutines/suspendFunctionMethodReference.kt index 41f588731e6..a75eb869d8d 100644 --- a/compiler/testData/codegen/box/coroutines/suspendFunctionMethodReference.kt +++ b/compiler/testData/codegen/box/coroutines/suspendFunctionMethodReference.kt @@ -1,11 +1,19 @@ -// IGNORE_BACKEND: JVM +// WITH_RUNTIME +// WITH_COROUTINES // IGNORE_BACKEND_FIR: JVM_IR -fun f(a: suspend () -> Unit): String { +import kotlin.coroutines.* +import helpers.* + +fun f(a: suspend () -> Unit) { val f = a::invoke - return "OK" + f.startCoroutine(EmptyContinuation()) } fun box(): String { - return f {} + var result = "" + f { + result = "OK" + } + return result }