diff --git a/compiler/testData/diagnostics/tests/coroutines/irrelevantSuspendDeclarations.kt b/compiler/testData/diagnostics/tests/coroutines/irrelevantSuspendDeclarations.kt index d1d80285304..91df56b8371 100644 --- a/compiler/testData/diagnostics/tests/coroutines/irrelevantSuspendDeclarations.kt +++ b/compiler/testData/diagnostics/tests/coroutines/irrelevantSuspendDeclarations.kt @@ -8,7 +8,7 @@ class A { suspend fun suspendHere(a: Int) = 1 } -fun builder(c: @Suspend() (Controller.() -> Unit)) {} +fun builder(c: suspend Controller.() -> Unit) {} fun test() { builder { diff --git a/compiler/testData/diagnostics/tests/coroutines/irrelevantSuspendDeclarations.txt b/compiler/testData/diagnostics/tests/coroutines/irrelevantSuspendDeclarations.txt index 4f63452723d..b37036408f0 100644 --- a/compiler/testData/diagnostics/tests/coroutines/irrelevantSuspendDeclarations.txt +++ b/compiler/testData/diagnostics/tests/coroutines/irrelevantSuspendDeclarations.txt @@ -1,6 +1,6 @@ package -public fun builder(/*0*/ c: @kotlin.coroutines.Suspend() (Controller.() -> kotlin.Unit)): kotlin.Unit +public fun builder(/*0*/ c: suspend Controller.() -> kotlin.Unit): kotlin.Unit public fun test(): kotlin.Unit public final class A { diff --git a/compiler/testData/diagnostics/tests/coroutines/lambdaExpectedType.kt b/compiler/testData/diagnostics/tests/coroutines/lambdaExpectedType.kt index 9a82f372b55..089e83bf94a 100644 --- a/compiler/testData/diagnostics/tests/coroutines/lambdaExpectedType.kt +++ b/compiler/testData/diagnostics/tests/coroutines/lambdaExpectedType.kt @@ -1,26 +1,26 @@ // !CHECK_TYPE // !DIAGNOSTICS: -UNUSED_PARAMETER -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_VARIABLE -fun builder(c: @Suspend() (() -> Int)) = 1 -fun genericBuilder(c: @Suspend() (() -> T)): T = null!! -fun unitBuilder(c: @Suspend() (() -> Unit)) = 1 -fun emptyBuilder(c: @Suspend() (() -> Unit)) = 1 +fun builder(c: suspend () -> Int) = 1 +fun genericBuilder(c: suspend () -> T): T = null!! +fun unitBuilder(c: suspend () -> Unit) = 1 +fun emptyBuilder(c: suspend () -> Unit) = 1 fun manyArgumentsBuilder( - c1: @Suspend() (() -> Unit), - c2: @Suspend() (() -> T), - c3: @Suspend() (() -> Int) + c1: suspend () -> Unit, + c2: suspend () -> T, + c3: suspend () -> Int ):T = null!! -fun severalParamsInLambda(c: @Suspend() ((String, Int) -> Unit)) {} +fun severalParamsInLambda(c: suspend (String, Int) -> Unit) {} fun foo() { builder({ 1 }) builder { 1 } val x = { 1 } - builder(x) - builder({1} as (@Suspend() (() -> Int))) + builder(x) + builder({1} as (suspend () -> Int)) var i: Int = 1 i = genericBuilder({ 1 }) @@ -30,7 +30,7 @@ fun foo() { genericBuilder { "" } val y = { 1 } - genericBuilder(y) + genericBuilder(y) unitBuilder {} unitBuilder { 1 } diff --git a/compiler/testData/diagnostics/tests/coroutines/lambdaExpectedType.txt b/compiler/testData/diagnostics/tests/coroutines/lambdaExpectedType.txt index bcfe94cb8c7..24980f1ceaa 100644 --- a/compiler/testData/diagnostics/tests/coroutines/lambdaExpectedType.txt +++ b/compiler/testData/diagnostics/tests/coroutines/lambdaExpectedType.txt @@ -1,9 +1,9 @@ package -public fun builder(/*0*/ c: @kotlin.coroutines.Suspend () -> kotlin.Int): kotlin.Int -public fun emptyBuilder(/*0*/ c: @kotlin.coroutines.Suspend () -> kotlin.Unit): kotlin.Int +public fun builder(/*0*/ c: suspend () -> kotlin.Int): kotlin.Int +public fun emptyBuilder(/*0*/ c: suspend () -> kotlin.Unit): kotlin.Int public fun foo(): kotlin.Unit -public fun genericBuilder(/*0*/ c: @kotlin.coroutines.Suspend () -> T): T -public fun manyArgumentsBuilder(/*0*/ c1: @kotlin.coroutines.Suspend () -> kotlin.Unit, /*1*/ c2: @kotlin.coroutines.Suspend () -> T, /*2*/ c3: @kotlin.coroutines.Suspend () -> kotlin.Int): T -public fun severalParamsInLambda(/*0*/ c: @kotlin.coroutines.Suspend (kotlin.String, kotlin.Int) -> kotlin.Unit): kotlin.Unit -public fun unitBuilder(/*0*/ c: @kotlin.coroutines.Suspend () -> kotlin.Unit): kotlin.Int +public fun genericBuilder(/*0*/ c: suspend () -> T): T +public fun manyArgumentsBuilder(/*0*/ c1: suspend () -> kotlin.Unit, /*1*/ c2: suspend () -> T, /*2*/ c3: suspend () -> kotlin.Int): T +public fun severalParamsInLambda(/*0*/ c: suspend (kotlin.String, kotlin.Int) -> kotlin.Unit): kotlin.Unit +public fun unitBuilder(/*0*/ c: suspend () -> kotlin.Unit): kotlin.Int diff --git a/compiler/testData/diagnostics/tests/coroutines/nonLocalSuspension.kt b/compiler/testData/diagnostics/tests/coroutines/nonLocalSuspension.kt index bbdd60f8bab..8a81b8f9c03 100644 --- a/compiler/testData/diagnostics/tests/coroutines/nonLocalSuspension.kt +++ b/compiler/testData/diagnostics/tests/coroutines/nonLocalSuspension.kt @@ -3,7 +3,7 @@ suspend fun suspendHere() = 1 suspend fun another(a: T) = 1 -fun builder(c: @Suspend() (() -> Unit)) { } +fun builder(c: suspend () -> Unit) { } inline fun run(x: () -> Unit) {} diff --git a/compiler/testData/diagnostics/tests/coroutines/nonLocalSuspension.txt b/compiler/testData/diagnostics/tests/coroutines/nonLocalSuspension.txt index da08922ec51..034bd5d1b4d 100644 --- a/compiler/testData/diagnostics/tests/coroutines/nonLocalSuspension.txt +++ b/compiler/testData/diagnostics/tests/coroutines/nonLocalSuspension.txt @@ -1,7 +1,7 @@ package public suspend fun another(/*0*/ a: T): kotlin.Int -public fun builder(/*0*/ c: @kotlin.coroutines.Suspend () -> kotlin.Unit): kotlin.Unit +public fun builder(/*0*/ c: suspend () -> kotlin.Unit): kotlin.Unit public fun foo(): kotlin.Unit public fun noinline(/*0*/ x: () -> kotlin.Unit): kotlin.Unit public inline fun run(/*0*/ x: () -> kotlin.Unit): kotlin.Unit diff --git a/compiler/testData/diagnostics/tests/coroutines/suspendExternalFunctions.kt b/compiler/testData/diagnostics/tests/coroutines/suspendExternalFunctions.kt index aa61d4bcf84..29a2b3f4ee5 100644 --- a/compiler/testData/diagnostics/tests/coroutines/suspendExternalFunctions.kt +++ b/compiler/testData/diagnostics/tests/coroutines/suspendExternalFunctions.kt @@ -15,7 +15,7 @@ suspend fun String.stringReceiver(y: Int) = 1.0 suspend fun Any.anyReceiver(y: Int) = 1.0 -fun builder(c: @Suspend() (() -> Unit)) {} +fun builder(c: suspend () -> Unit) {} fun test() { builder { diff --git a/compiler/testData/diagnostics/tests/coroutines/suspendExternalFunctions.txt b/compiler/testData/diagnostics/tests/coroutines/suspendExternalFunctions.txt index 237c65801a1..c4373e3befe 100644 --- a/compiler/testData/diagnostics/tests/coroutines/suspendExternalFunctions.txt +++ b/compiler/testData/diagnostics/tests/coroutines/suspendExternalFunctions.txt @@ -2,7 +2,7 @@ package public suspend fun await(/*0*/ f: () -> V): V public suspend fun await(/*0*/ f: kotlin.Int): V -public fun builder(/*0*/ c: @kotlin.coroutines.Suspend () -> kotlin.Unit): kotlin.Unit +public fun builder(/*0*/ c: suspend () -> kotlin.Unit): kotlin.Unit public suspend fun noParams(): kotlin.Unit public suspend fun severalParams(/*0*/ x: kotlin.String, /*1*/ y: kotlin.Int): kotlin.Double public fun test(): kotlin.Unit diff --git a/compiler/testData/diagnostics/tests/coroutines/suspendFunctionType/functionVsSuspendFunction.kt b/compiler/testData/diagnostics/tests/coroutines/suspendFunctionType/functionVsSuspendFunction.kt index 002aa48783f..7e979a0c646 100644 --- a/compiler/testData/diagnostics/tests/coroutines/suspendFunctionType/functionVsSuspendFunction.kt +++ b/compiler/testData/diagnostics/tests/coroutines/suspendFunctionType/functionVsSuspendFunction.kt @@ -11,6 +11,7 @@ fun test2(fn: () -> Unit) = useSuspendFn(fn) fun test3(sfn: suspend () -> Unit) = useSuspendFn(sfn) fun test4(): suspend () -> Unit = useSuspendFn {} +fun test5() = useSuspendFn {} fun test5(sfn: suspend () -> Unit) = ambiguous(sfn) fun test6(fn: () -> Unit) = ambiguous(fn) diff --git a/compiler/testData/diagnostics/tests/coroutines/suspendFunctionType/functionVsSuspendFunction.txt b/compiler/testData/diagnostics/tests/coroutines/suspendFunctionType/functionVsSuspendFunction.txt index 4fe679f46b6..28400cf7689 100644 --- a/compiler/testData/diagnostics/tests/coroutines/suspendFunctionType/functionVsSuspendFunction.txt +++ b/compiler/testData/diagnostics/tests/coroutines/suspendFunctionType/functionVsSuspendFunction.txt @@ -6,6 +6,7 @@ public fun test1(/*0*/ sfn: suspend () -> kotlin.Unit): () -> kotlin.Unit public fun test2(/*0*/ fn: () -> kotlin.Unit): suspend () -> kotlin.Unit public fun test3(/*0*/ sfn: suspend () -> kotlin.Unit): suspend () -> kotlin.Unit public fun test4(): suspend () -> kotlin.Unit +public fun test5(): suspend () -> kotlin.Unit public fun test5(/*0*/ sfn: suspend () -> kotlin.Unit): suspend () -> kotlin.Unit public fun test6(/*0*/ fn: () -> kotlin.Unit): () -> kotlin.Unit public fun test7(): () -> kotlin.Unit diff --git a/compiler/testData/diagnostics/tests/coroutines/suspendFunctionType/inference2.kt b/compiler/testData/diagnostics/tests/coroutines/suspendFunctionType/inference2.kt index 2133e72a5d3..fd9954a43b6 100644 --- a/compiler/testData/diagnostics/tests/coroutines/suspendFunctionType/inference2.kt +++ b/compiler/testData/diagnostics/tests/coroutines/suspendFunctionType/inference2.kt @@ -2,4 +2,4 @@ fun withS2(x: T1, sfn1: suspend (T1) -> T2, sfn2: suspend (T2) -> Unit): T2 = null!! -val test1 = withS2(100, { "" }, { }) \ No newline at end of file +val test1 = withS2(100, { it.toLong().toString() }, { it.length }) \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/coroutines/suspendFunctions.kt b/compiler/testData/diagnostics/tests/coroutines/suspendFunctions.kt index b8dabfb7abb..28d0e41966a 100644 --- a/compiler/testData/diagnostics/tests/coroutines/suspendFunctions.kt +++ b/compiler/testData/diagnostics/tests/coroutines/suspendFunctions.kt @@ -13,7 +13,7 @@ class Controller { suspend fun severalParams(x: String, y: Int) = 1.0 } -fun builder(c: @Suspend() (Controller.() -> Unit)) {} +fun builder(c: suspend Controller.() -> Unit) {} fun test() { builder { diff --git a/compiler/testData/diagnostics/tests/coroutines/suspendFunctions.txt b/compiler/testData/diagnostics/tests/coroutines/suspendFunctions.txt index 20190d4f6bb..9d99d49a29d 100644 --- a/compiler/testData/diagnostics/tests/coroutines/suspendFunctions.txt +++ b/compiler/testData/diagnostics/tests/coroutines/suspendFunctions.txt @@ -1,6 +1,6 @@ package -public fun builder(/*0*/ c: @kotlin.coroutines.Suspend() (Controller.() -> kotlin.Unit)): kotlin.Unit +public fun builder(/*0*/ c: suspend Controller.() -> kotlin.Unit): kotlin.Unit public fun test(): kotlin.Unit public final class Controller { diff --git a/compiler/testData/diagnostics/tests/coroutines/suspendWithCurrentContinuation.kt b/compiler/testData/diagnostics/tests/coroutines/suspendWithCurrentContinuation.kt index c3ff92a1f18..eb156286629 100644 --- a/compiler/testData/diagnostics/tests/coroutines/suspendWithCurrentContinuation.kt +++ b/compiler/testData/diagnostics/tests/coroutines/suspendWithCurrentContinuation.kt @@ -2,9 +2,9 @@ // !CHECK_TYPE class Controller { suspend fun noParams(): Unit = suspendWithCurrentContinuation { - if (hashCode() % 2 == 0) { + if (hashCode() % 2 == 0) { it.resume(Unit) - Suspend + SUSPENDED } else { Unit @@ -21,7 +21,7 @@ class Controller { } } -fun builder(c: @Suspend() (Controller.() -> Unit)) {} +fun builder(c: suspend Controller.() -> Unit) {} fun test() { builder { diff --git a/compiler/testData/diagnostics/tests/coroutines/suspendWithCurrentContinuation.txt b/compiler/testData/diagnostics/tests/coroutines/suspendWithCurrentContinuation.txt index 1980ddc9dd3..0521533712d 100644 --- a/compiler/testData/diagnostics/tests/coroutines/suspendWithCurrentContinuation.txt +++ b/compiler/testData/diagnostics/tests/coroutines/suspendWithCurrentContinuation.txt @@ -1,6 +1,6 @@ package -public fun builder(/*0*/ c: @kotlin.coroutines.Suspend() (Controller.() -> kotlin.Unit)): kotlin.Unit +public fun builder(/*0*/ c: suspend Controller.() -> kotlin.Unit): kotlin.Unit public fun test(): kotlin.Unit public final class Controller { diff --git a/compiler/testData/diagnostics/tests/coroutines/tryCatchLambda.kt b/compiler/testData/diagnostics/tests/coroutines/tryCatchLambda.kt index 3fd4d3561f3..7810750a94f 100644 --- a/compiler/testData/diagnostics/tests/coroutines/tryCatchLambda.kt +++ b/compiler/testData/diagnostics/tests/coroutines/tryCatchLambda.kt @@ -1,7 +1,7 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_VARIABLE suspend fun await(f: V): V = f -fun genericBuilder(c: @Suspend() (() -> T)): T = null!! +fun genericBuilder(c: suspend () -> T): T = null!! fun foo() { var result = "" diff --git a/compiler/testData/diagnostics/tests/coroutines/tryCatchLambda.txt b/compiler/testData/diagnostics/tests/coroutines/tryCatchLambda.txt index fc5aed7a1de..1be3cb3e3af 100644 --- a/compiler/testData/diagnostics/tests/coroutines/tryCatchLambda.txt +++ b/compiler/testData/diagnostics/tests/coroutines/tryCatchLambda.txt @@ -2,4 +2,4 @@ package public suspend fun await(/*0*/ f: V): V public fun foo(): kotlin.Unit -public fun genericBuilder(/*0*/ c: @kotlin.coroutines.Suspend () -> T): T +public fun genericBuilder(/*0*/ c: suspend () -> T): T diff --git a/compiler/testData/diagnostics/tests/coroutines/unsupported.kt b/compiler/testData/diagnostics/tests/coroutines/unsupported.kt index 34776a1d912..d1a55519576 100644 --- a/compiler/testData/diagnostics/tests/coroutines/unsupported.kt +++ b/compiler/testData/diagnostics/tests/coroutines/unsupported.kt @@ -3,7 +3,7 @@ suspend fun suspendHere(): String = "OK" -fun builder(c: @Suspend() (() -> Unit)) { +fun builder(c: suspend () -> Unit) { } diff --git a/compiler/testData/diagnostics/tests/coroutines/unsupported.txt b/compiler/testData/diagnostics/tests/coroutines/unsupported.txt index 8f476b871dd..9ca783c969d 100644 --- a/compiler/testData/diagnostics/tests/coroutines/unsupported.txt +++ b/compiler/testData/diagnostics/tests/coroutines/unsupported.txt @@ -1,5 +1,5 @@ package public fun box(): kotlin.String -public fun builder(/*0*/ c: @kotlin.coroutines.Suspend () -> kotlin.Unit): kotlin.Unit +public fun builder(/*0*/ c: suspend () -> kotlin.Unit): kotlin.Unit public suspend fun suspendHere(): kotlin.String