Files
2024-02-16 10:19:38 +00:00

145 lines
1.8 KiB
Kotlin
Vendored

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