100 lines
1.2 KiB
Plaintext
Vendored
100 lines
1.2 KiB
Plaintext
Vendored
fun useSuspend(fn: SuspendFunction0<Unit>) {
|
|
}
|
|
|
|
fun useSuspendInt(fn: SuspendFunction1<Int, Unit>) {
|
|
}
|
|
|
|
suspend fun foo0() {
|
|
}
|
|
|
|
fun foo1() {
|
|
}
|
|
|
|
fun fooInt(x: Int) {
|
|
}
|
|
|
|
fun foo2(vararg xs: Int) {
|
|
}
|
|
|
|
fun foo3(): Int {
|
|
return 42
|
|
}
|
|
|
|
fun foo4(i: Int = 42) {
|
|
}
|
|
|
|
class C {
|
|
constructor() /* primary */ {
|
|
super/*Any*/()
|
|
/* <init>() */
|
|
|
|
}
|
|
|
|
fun bar() {
|
|
}
|
|
|
|
}
|
|
|
|
fun testLambda() {
|
|
useSuspend(fn = local suspend fun <anonymous>() {
|
|
foo1()
|
|
}
|
|
)
|
|
}
|
|
|
|
fun testNoCoversion() {
|
|
useSuspend(fn = ::foo0)
|
|
}
|
|
|
|
fun testSuspendPlain() {
|
|
useSuspend(fn = local suspend fun foo1() {
|
|
foo1()
|
|
}
|
|
)
|
|
}
|
|
|
|
fun testSuspendWithArgs() {
|
|
useSuspendInt(fn = local suspend fun fooInt(p0: Int) {
|
|
fooInt(x = p0)
|
|
}
|
|
)
|
|
}
|
|
|
|
fun testWithVararg() {
|
|
useSuspend(fn = local suspend fun foo2() {
|
|
foo2()
|
|
}
|
|
)
|
|
}
|
|
|
|
fun testWithVarargMapped() {
|
|
useSuspendInt(fn = local suspend fun foo2(p0: Int) {
|
|
foo2(xs = [p0])
|
|
}
|
|
)
|
|
}
|
|
|
|
fun testWithCoercionToUnit() {
|
|
useSuspend(fn = local suspend fun foo3() {
|
|
foo3()
|
|
}
|
|
)
|
|
}
|
|
|
|
fun testWithDefaults() {
|
|
useSuspend(fn = local suspend fun foo4() {
|
|
foo4()
|
|
}
|
|
)
|
|
}
|
|
|
|
fun testWithBoundReceiver() {
|
|
useSuspend(fn = { // BLOCK
|
|
local suspend fun C.bar() {
|
|
receiver.bar()
|
|
}
|
|
|
|
C()::bar
|
|
})
|
|
}
|