fun produceFun(): Function0 { return local fun () { return Unit } } fun testExtAsExt(fn: @ExtensionFunctionType Function1) { useSuspendExt(sfn = { // BLOCK local suspend fun @ExtensionFunctionType Function1.suspendConversion0(p0: Int) { callee.invoke(p1 = p0) } fn::suspendConversion0 }) } fun testExtAsExtT(fn: @ExtensionFunctionType Function1) { useSuspendExtT(sfn = { // BLOCK local suspend fun @ExtensionFunctionType Function1.suspendConversion0(p0: Int) { callee.invoke(p1 = p0) } fn::suspendConversion0 }) } fun testExtAsSimple(fn: @ExtensionFunctionType Function1) { useSuspendArg(sfn = { // BLOCK local suspend fun Function1.suspendConversion0(p0: Int) { callee.invoke(p1 = p0) } fn::suspendConversion0 }) } fun testExtAsSimpleT(fn: @ExtensionFunctionType Function1) { useSuspendArgT(sfn = { // BLOCK local suspend fun Function1.suspendConversion0(p0: Int) { callee.invoke(p1 = p0) } fn::suspendConversion0 }) } fun testExtSAsExtT(fn: @ExtensionFunctionType Function1) { useSuspendExtT(sfn = { // BLOCK local suspend fun @ExtensionFunctionType Function1.suspendConversion0(p0: S) { callee.invoke(p1 = p0) } fn::suspendConversion0 }) } fun testExtSAsSimpleT(fn: @ExtensionFunctionType Function1) { useSuspendArgT(sfn = { // BLOCK local suspend fun Function1.suspendConversion0(p0: S) { callee.invoke(p1 = p0) } fn::suspendConversion0 }) } fun testIntersectionVsSuspendConversion(x: T) where T : Function0, T : SuspendFunction0 { useSuspend(sfn = x) } fun testSimple(fn: Function0) { useSuspend(sfn = { // BLOCK local suspend fun Function0.suspendConversion0() { callee.invoke() } fn::suspendConversion0 }) } fun testSimpleAsExt(fn: Function1) { useSuspendExt(sfn = { // BLOCK local suspend fun @ExtensionFunctionType Function1.suspendConversion0(p0: Int) { callee.invoke(p1 = p0) } fn::suspendConversion0 }) } fun testSimpleAsExtT(fn: Function1) { useSuspendExtT(sfn = { // BLOCK local suspend fun @ExtensionFunctionType Function1.suspendConversion0(p0: Int) { callee.invoke(p1 = p0) } fn::suspendConversion0 }) } fun testSimpleAsSimpleT(fn: Function1) { useSuspendArgT(sfn = { // BLOCK local suspend fun Function1.suspendConversion0(p0: Int) { callee.invoke(p1 = p0) } fn::suspendConversion0 }) } fun testSimpleNonVal() { useSuspend(sfn = { // BLOCK local suspend fun Function0.suspendConversion0() { callee.invoke() } produceFun()::suspendConversion0 }) } fun testSimpleSAsExtT(fn: Function1) { useSuspendExtT(sfn = { // BLOCK local suspend fun @ExtensionFunctionType Function1.suspendConversion0(p0: S) { callee.invoke(p1 = p0) } fn::suspendConversion0 }) } fun testSimpleSAsSimpleT(fn: Function1) { useSuspendArgT(sfn = { // BLOCK local suspend fun Function1.suspendConversion0(p0: S) { callee.invoke(p1 = p0) } fn::suspendConversion0 }) } fun testSmartCastOnVarVsSuspendConversion(a: Function0) { var b: Function0 = a b as SuspendFunction0 /*~> Unit */ useSuspend(sfn = b /*as SuspendFunction0 */) } fun testSmartCastOnVarWithSuspendConversion(a: Any) { var b: Any = a b as Function0 /*~> Unit */ useSuspend(sfn = { // BLOCK local suspend fun Function0.suspendConversion0() { callee.invoke() } b /*as Function0 */::suspendConversion0 }) } fun testSmartCastVsSuspendConversion(a: Function0) { a as SuspendFunction0 /*~> Unit */ useSuspend(sfn = a /*as SuspendFunction0 */) } fun testSmartCastWithSuspendConversion(a: Any) { a as Function0 /*~> Unit */ useSuspend(sfn = { // BLOCK local suspend fun Function0.suspendConversion0() { callee.invoke() } a /*as Function0 */::suspendConversion0 }) } fun useSuspend(sfn: SuspendFunction0) { } fun useSuspendArg(sfn: SuspendFunction1) { } fun useSuspendArgT(sfn: SuspendFunction1) { } fun useSuspendExt(sfn: @ExtensionFunctionType SuspendFunction1) { } fun useSuspendExtT(sfn: @ExtensionFunctionType SuspendFunction1) { }