Fix some coroutine tests
This commit is contained in:
+5
-2
@@ -1,10 +1,13 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// COMMON_COROUTINES_TEST
|
||||
import helpers.*
|
||||
import COROUTINES_PACKAGE.*
|
||||
import COROUTINES_PACKAGE.intrinsics.*
|
||||
import helpers.ContinuationAdapter
|
||||
import kotlin.coroutines.*
|
||||
import kotlin.coroutines.intrinsics.COROUTINE_SUSPENDED
|
||||
|
||||
fun runCustomLambdaAsCoroutine(e: Throwable? = null, x: (Continuation<String>) -> Any?): String {
|
||||
var result = "fail"
|
||||
|
||||
+8
-27
@@ -1,21 +1,13 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// IGNORE_BACKEND: JS_IR, JS, NATIVE
|
||||
// WITH_REFLECT
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
|
||||
import kotlin.reflect.full.*
|
||||
// COMMON_COROUTINES_TEST
|
||||
import helpers.*
|
||||
import kotlin.coroutines.*
|
||||
import COROUTINES_PACKAGE.*
|
||||
import COROUTINES_PACKAGE.intrinsics.*
|
||||
|
||||
class A {
|
||||
suspend fun foo(
|
||||
p00: Long = 0, p01: A = A(), p02: A = A(), p03: A = A(), p04: A = A(), p05: A = A(), p06: A = A(), p07: A = A(), p08: A = A(), p09: A = A(),
|
||||
p10: A = A(), p11: A = A(), p12: A = A(), p13: A = A(), p14: A = A(), p15: A = A(), p16: A = A(), p17: A = A(), p18: A = A(), p19: A = A(),
|
||||
p20: A = A(), p21: A = A(), p22: A = A(), p23: A = A(), p24: A = A(), p25: A = A(), p26: A = A(), p27: A = A(), p28: A = A(), p29: String
|
||||
): String {
|
||||
return p29 + p00
|
||||
}
|
||||
}
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
@@ -42,30 +34,19 @@ suspend fun expectsLambdaWithArity22(c: suspend (Int, Int, Int, Int, Int, Int, I
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val a = A()
|
||||
var res = "FAIL 1"
|
||||
builder {
|
||||
res = A::foo.callSuspend(a, 1L, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, "OK")
|
||||
}
|
||||
if (res != "OK1") return res
|
||||
res = "FAIL 2"
|
||||
builder {
|
||||
res = A::foo.callSuspendBy(mapOf(A::foo.parameters.first() to A(), A::foo.parameters.last() to "OK")) as String
|
||||
}
|
||||
if (res != "OK0") return res
|
||||
res = "FAIL 3"
|
||||
builder {
|
||||
res = expectsLambdaWithBigArity { _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, s -> s }
|
||||
}
|
||||
if (res != "OK") return res
|
||||
res = "FAIL 4"
|
||||
res = "FAIL 2"
|
||||
builder {
|
||||
res = expectsLambdaWithArity21 {
|
||||
i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, s -> s
|
||||
}
|
||||
}
|
||||
if (res != "OK") return res
|
||||
res = "FAIL 5"
|
||||
res = "FAIL 3"
|
||||
builder {
|
||||
res = expectsLambdaWithArity22 {
|
||||
i1, i2, i3, i4, i5, i6, i7, i8, i9, i10, i11, i12, i13, i14, i15, i16, i17, i18, i19, i20, i21, s -> s
|
||||
|
||||
+22
-16
@@ -1,12 +1,18 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// IGNORE_BACKEND: NATIVE
|
||||
// IGNORE_BACKEND: JS_IR, JS
|
||||
// IGNORE_BACKEND: JS
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
|
||||
import helpers.*
|
||||
import kotlin.coroutines.*
|
||||
|
||||
fun check(condition: Boolean, msg: () -> Unit) {
|
||||
if (!condition) {
|
||||
throw AssertionError(msg())
|
||||
}
|
||||
}
|
||||
|
||||
fun fn1(x: Any) {}
|
||||
suspend fun suspendFn0() {}
|
||||
|
||||
@@ -41,25 +47,25 @@ fun box(): String {
|
||||
val localFun1 = ::local1 as Any
|
||||
val suspendLocalFun0 = ::suspendLocal0 as Any
|
||||
|
||||
assert(f1 !is SuspendFunction0<*>) { "Failed: f1 !is SuspendFunction0<*>" }
|
||||
assert(sf0 is SuspendFunction0<*>) { "Failed: f1 is SuspendFunction0<*>" }
|
||||
assert(sf0 is Function1<*, *>) { "Failed: suspendF0 is Function1<*, *>" }
|
||||
check(f1 !is SuspendFunction0<*>) { "Failed: f1 !is SuspendFunction0<*>" }
|
||||
check(sf0 is SuspendFunction0<*>) { "Failed: f1 is SuspendFunction0<*>" }
|
||||
check(sf0 is Function1<*, *>) { "Failed: suspendF0 is Function1<*, *>" }
|
||||
|
||||
assert(lambda1 !is SuspendFunction0<*>) { "Failed: lambda1 !is SuspendFunction0<*>" }
|
||||
assert(suspendLambda0 is Function1<*, *>) { "Failed: suspendLambda0 is Function1<*, *>" }
|
||||
assert(suspendLambda0 is SuspendFunction0<*>) { "Failed: suspendLambda0 is SuspendFunction0<*>" }
|
||||
check(lambda1 !is SuspendFunction0<*>) { "Failed: lambda1 !is SuspendFunction0<*>" }
|
||||
check(suspendLambda0 is Function1<*, *>) { "Failed: suspendLambda0 is Function1<*, *>" }
|
||||
check(suspendLambda0 is SuspendFunction0<*>) { "Failed: suspendLambda0 is SuspendFunction0<*>" }
|
||||
|
||||
assert(localFun1 !is SuspendFunction0<*>) { "Failed: localFun1 !is SuspendFunction0<*, *>" }
|
||||
assert(suspendLocalFun0 is Function1<*, *>) { "Failed: suspendLocalFun0 is Function1<*, *>" }
|
||||
assert(suspendLocalFun0 is SuspendFunction0<*>) { "Failed: suspendLocalFun0 is SuspendFunction0<*>" }
|
||||
check(localFun1 !is SuspendFunction0<*>) { "Failed: localFun1 !is SuspendFunction0<*, *>" }
|
||||
check(suspendLocalFun0 is Function1<*, *>) { "Failed: suspendLocalFun0 is Function1<*, *>" }
|
||||
check(suspendLocalFun0 is SuspendFunction0<*>) { "Failed: suspendLocalFun0 is SuspendFunction0<*>" }
|
||||
|
||||
assert(ef !is SuspendFunction1<*, *>) { "Failed: ef !is SuspendFunction1<*, *>" }
|
||||
assert(sef is SuspendFunction1<*, *>) { "Failed: sef is SuspendFunction1<*, *>" }
|
||||
assert(sef is Function2<*, *, *>) { "Failed: sef is Function2<*, *, *>" }
|
||||
check(ef !is SuspendFunction1<*, *>) { "Failed: ef !is SuspendFunction1<*, *>" }
|
||||
check(sef is SuspendFunction1<*, *>) { "Failed: sef is SuspendFunction1<*, *>" }
|
||||
check(sef is Function2<*, *, *>) { "Failed: sef is Function2<*, *, *>" }
|
||||
|
||||
assert(afoo !is SuspendFunction1<*, *>) { "afoo !is SuspendFunction1<*, *>" }
|
||||
assert(safoo is Function2<*, *, *>) { "safoo is Function2<*, *, *>" }
|
||||
assert(safoo is SuspendFunction1<*, *>) { "asfoo is SuspendFunction1<*, *>" }
|
||||
check(afoo !is SuspendFunction1<*, *>) { "afoo !is SuspendFunction1<*, *>" }
|
||||
check(safoo is Function2<*, *, *>) { "safoo is Function2<*, *, *>" }
|
||||
check(safoo is SuspendFunction1<*, *>) { "asfoo is SuspendFunction1<*, *>" }
|
||||
|
||||
checkReified<suspend () -> Unit> {}
|
||||
|
||||
|
||||
+4
-4
@@ -1,12 +1,12 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// IGNORE_BACKEND: JS_IR
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
// IGNORE_BACKEND: JVM_IR, JS_IR
|
||||
// IGNORE_BACKEND: JVM, JS, NATIVE
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
|
||||
// COMMON_COROUTINES_TEST
|
||||
import helpers.*
|
||||
import kotlin.coroutines.experimental.*
|
||||
import COROUTINES_PACKAGE.*
|
||||
import COROUTINES_PACKAGE.intrinsics.*
|
||||
|
||||
suspend fun callLocal(): String {
|
||||
val local = suspend fun() = "OK"
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_REFLECT
|
||||
// WITH_COROUTINES
|
||||
|
||||
import helpers.*
|
||||
import kotlin.coroutines.*
|
||||
import kotlin.coroutines.intrinsics.*
|
||||
import kotlin.reflect.full.*
|
||||
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
class A {
|
||||
suspend fun foo(
|
||||
p00: Long = 0, p01: A = A(), p02: A = A(), p03: A = A(), p04: A = A(), p05: A = A(), p06: A = A(), p07: A = A(), p08: A = A(), p09: A = A(),
|
||||
p10: A = A(), p11: A = A(), p12: A = A(), p13: A = A(), p14: A = A(), p15: A = A(), p16: A = A(), p17: A = A(), p18: A = A(), p19: A = A(),
|
||||
p20: A = A(), p21: A = A(), p22: A = A(), p23: A = A(), p24: A = A(), p25: A = A(), p26: A = A(), p27: A = A(), p28: A = A(), p29: String
|
||||
): String {
|
||||
return p29 + p00
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val a = A()
|
||||
var res = "FAIL 1"
|
||||
builder {
|
||||
res = A::foo.callSuspend(a, 1L, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, a, "OK")
|
||||
}
|
||||
if (res != "OK1") return res
|
||||
res = "FAIL 2"
|
||||
builder {
|
||||
res = A::foo.callSuspendBy(mapOf(A::foo.parameters.first() to A(), A::foo.parameters.last() to "OK")) as String
|
||||
}
|
||||
if (res != "OK0") return res
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Vendored
-1
@@ -4,7 +4,6 @@
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// COMMON_COROUTINES_TEST
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
import helpers.*
|
||||
import COROUTINES_PACKAGE.*
|
||||
import COROUTINES_PACKAGE.intrinsics.*
|
||||
|
||||
Reference in New Issue
Block a user