fun useSuspend(fn: SuspendFunction0<Unit>) {
}

fun useSuspendNullable(fn: SuspendFunction0<Unit>?) {
}

fun useSuspendNestedNullable(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 = { // BLOCK
    local suspend fun foo1() {
      foo1()
    }

    ::foo1
  })
}

fun testSuspendWithArgs() {
  useSuspendInt(fn = { // BLOCK
    local suspend fun fooInt(p0: Int) {
      fooInt(x = p0)
    }

    ::fooInt
  })
}

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 testWithCoercionToUnit() {
  useSuspend(fn = { // BLOCK
    local suspend fun foo3() {
      foo3() /*~> Unit */
    }

    ::foo3
  })
}

fun testWithDefaults() {
  useSuspend(fn = { // BLOCK
    local suspend fun foo4() {
      foo4()
    }

    ::foo4
  })
}

fun testWithBoundReceiver() {
  useSuspend(fn = { // BLOCK
    local suspend fun C.bar() {
      receiver.bar()
    }

    C()::bar
  })
}

fun testNullableParam() {
  useSuspendNullable(fn = { // BLOCK
    local suspend fun foo1() {
      foo1()
    }

    ::foo1
  })
}

fun testNestedNullableParam() {
  useSuspendNestedNullable(fn = { // BLOCK
    local suspend fun foo1() {
      foo1()
    }

    ::foo1
  })
}
