diff --git a/compiler/testData/builtin-classes/default/kotlin-coroutines.txt b/compiler/testData/builtin-classes/default/kotlin-coroutines.txt index 045b92f3468..35a212fc704 100644 --- a/compiler/testData/builtin-classes/default/kotlin-coroutines.txt +++ b/compiler/testData/builtin-classes/default/kotlin-coroutines.txt @@ -2,10 +2,6 @@ package-fragment kotlin.coroutines @kotlin.SinceKotlin(version = "1.1") public inline suspend fun suspendWithCurrentContinuation(/*0*/ body: (kotlin.coroutines.Continuation) -> kotlin.Any?): T -@kotlin.SinceKotlin(version = "1.1") @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.CLASS}) @kotlin.annotation.Retention(value = AnnotationRetention.BINARY) public final annotation class AllowSuspendExtensions : kotlin.Annotation { - /*primary*/ public constructor AllowSuspendExtensions() -} - @kotlin.SinceKotlin(version = "1.1") public interface Continuation { public abstract fun resume(/*0*/ data: P): kotlin.Unit public abstract fun resumeWithException(/*0*/ exception: kotlin.Throwable): kotlin.Unit diff --git a/compiler/testData/codegen/box/coroutines/multiModule/suspendExtension.kt b/compiler/testData/codegen/box/coroutines/multiModule/suspendExtension.kt deleted file mode 100644 index 19b79261a3a..00000000000 --- a/compiler/testData/codegen/box/coroutines/multiModule/suspendExtension.kt +++ /dev/null @@ -1,53 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -// MODULE: controller -// FILE: controller.kt -package lib - -import kotlin.coroutines.* - -@AllowSuspendExtensions -class Controller { - suspend fun String.suspendHere(): String = suspendWithCurrentContinuation { x -> - x.resume(this) - SUSPENDED - } - - inline suspend fun String.inlineSuspendHere(): String = suspendHere() -} - -suspend fun Controller.suspendExtension(v: String): String = v.suspendHere() - -inline suspend fun Controller.inlineSuspendExtension(v: String) = v.inlineSuspendHere() - -// MODULE: main(controller) -// FILE: main.kt -import lib.* -import kotlin.coroutines.* - -suspend fun Controller.localSuspendExtension(v: String) = v.suspendHere() - -inline suspend fun Controller.localInlineSuspendExtension(v: String) = v.inlineSuspendHere() - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), EmptyContinuation) -} - -fun box(): String { - var result = "" - - builder { - if ("56".suspendHere() != "56") throw RuntimeException("fail 1") - if ("28".inlineSuspendHere() != "28") throw RuntimeException("fail 2") - - if (suspendExtension("123") != "123") throw RuntimeException("fail 3") - if (inlineSuspendExtension("234") != "234") throw RuntimeException("fail 4") - - if (localSuspendExtension("9123") != "9123") throw RuntimeException("fail 5") - if (localInlineSuspendExtension("9234") != "9234") throw RuntimeException("fail 6") - - result = "OK" - } - - return result -} diff --git a/compiler/testData/codegen/box/coroutines/suspendExtension.kt b/compiler/testData/codegen/box/coroutines/suspendExtension.kt deleted file mode 100644 index 5a5baa2a4f7..00000000000 --- a/compiler/testData/codegen/box/coroutines/suspendExtension.kt +++ /dev/null @@ -1,35 +0,0 @@ -// WITH_RUNTIME -// WITH_COROUTINES -import kotlin.coroutines.* - -@AllowSuspendExtensions -class Controller { - suspend fun String.suspendHere(): String = suspendWithCurrentContinuation { x -> - x.resume(this) - SUSPENDED - } - - inline suspend fun String.inlineSuspendHere(): String = suspendHere() -} - -suspend fun Controller.suspendExtension(v: String): String = v.suspendHere() - -inline suspend fun Controller.inlineSuspendExtension(v: String): String = v.inlineSuspendHere() - -fun builder(c: suspend Controller.() -> Unit) { - c.startCoroutine(Controller(), EmptyContinuation) -} - -fun box(): String { - var result = "" - - builder { - if ("56".suspendHere() != "56") throw RuntimeException("fail 1") - if ("28".inlineSuspendHere() != "28") throw RuntimeException("fail 2") - - if (suspendExtension("123") != "123") throw RuntimeException("fail 3") - result = inlineSuspendExtension("OK") - } - - return result -} diff --git a/compiler/testData/codegen/light-analysis/coroutines/multiModule/suspendExtension.txt b/compiler/testData/codegen/light-analysis/coroutines/multiModule/suspendExtension.txt deleted file mode 100644 index 7c4535393f6..00000000000 --- a/compiler/testData/codegen/light-analysis/coroutines/multiModule/suspendExtension.txt +++ /dev/null @@ -1,33 +0,0 @@ -public final class CoroutineUtilKt { - public final static @org.jetbrains.annotations.NotNull method handleExceptionContinuation(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function1): kotlin.coroutines.Continuation - public final static @org.jetbrains.annotations.NotNull method handleResultContinuation(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function1): kotlin.coroutines.Continuation -} - - -public final class EmptyContinuation { - public final static field INSTANCE: EmptyContinuation - private method (): void - public method resume(@org.jetbrains.annotations.Nullable p0: java.lang.Object): void - public method resumeWithException(@org.jetbrains.annotations.NotNull p0: java.lang.Throwable): void -} - - -public final class MainKt { - public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String - public final static method builder(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function2): void - public final static @org.jetbrains.annotations.Nullable method localInlineSuspendExtension(@org.jetbrains.annotations.NotNull p0: lib.Controller, @org.jetbrains.annotations.NotNull p1: java.lang.String, @org.jetbrains.annotations.NotNull p2: kotlin.coroutines.Continuation): java.lang.Object - public final static @org.jetbrains.annotations.Nullable method localSuspendExtension(@org.jetbrains.annotations.NotNull p0: lib.Controller, @org.jetbrains.annotations.NotNull p1: java.lang.String, @org.jetbrains.annotations.NotNull p2: kotlin.coroutines.Continuation): java.lang.Object -} - -@kotlin.coroutines.AllowSuspendExtensions -public final class lib/Controller { - public method (): void - public final @org.jetbrains.annotations.Nullable method inlineSuspendHere(@org.jetbrains.annotations.NotNull p0: java.lang.String, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object - public final @org.jetbrains.annotations.Nullable method suspendHere(@org.jetbrains.annotations.NotNull p0: java.lang.String, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object -} - - -public final class lib/ControllerKt { - public final static @org.jetbrains.annotations.Nullable method inlineSuspendExtension(@org.jetbrains.annotations.NotNull p0: lib.Controller, @org.jetbrains.annotations.NotNull p1: java.lang.String, @org.jetbrains.annotations.NotNull p2: kotlin.coroutines.Continuation): java.lang.Object - public final static @org.jetbrains.annotations.Nullable method suspendExtension(@org.jetbrains.annotations.NotNull p0: lib.Controller, @org.jetbrains.annotations.NotNull p1: java.lang.String, @org.jetbrains.annotations.NotNull p2: kotlin.coroutines.Continuation): java.lang.Object -} diff --git a/compiler/testData/codegen/light-analysis/coroutines/suspendExtension.txt b/compiler/testData/codegen/light-analysis/coroutines/suspendExtension.txt deleted file mode 100644 index efd7bd408fa..00000000000 --- a/compiler/testData/codegen/light-analysis/coroutines/suspendExtension.txt +++ /dev/null @@ -1,28 +0,0 @@ -@kotlin.coroutines.AllowSuspendExtensions -public final class Controller { - public method (): void - public final @org.jetbrains.annotations.Nullable method inlineSuspendHere(@org.jetbrains.annotations.NotNull p0: java.lang.String, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object - public final @org.jetbrains.annotations.Nullable method suspendHere(@org.jetbrains.annotations.NotNull p0: java.lang.String, @org.jetbrains.annotations.NotNull p1: kotlin.coroutines.Continuation): java.lang.Object -} - - -public final class CoroutineUtilKt { - public final static @org.jetbrains.annotations.NotNull method handleExceptionContinuation(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function1): kotlin.coroutines.Continuation - public final static @org.jetbrains.annotations.NotNull method handleResultContinuation(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function1): kotlin.coroutines.Continuation -} - - -public final class EmptyContinuation { - public final static field INSTANCE: EmptyContinuation - private method (): void - public method resume(@org.jetbrains.annotations.Nullable p0: java.lang.Object): void - public method resumeWithException(@org.jetbrains.annotations.NotNull p0: java.lang.Throwable): void -} - - -public final class SuspendExtensionKt { - public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String - public final static method builder(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function2): void - public final static @org.jetbrains.annotations.Nullable method inlineSuspendExtension(@org.jetbrains.annotations.NotNull p0: Controller, @org.jetbrains.annotations.NotNull p1: java.lang.String, @org.jetbrains.annotations.NotNull p2: kotlin.coroutines.Continuation): java.lang.Object - public final static @org.jetbrains.annotations.Nullable method suspendExtension(@org.jetbrains.annotations.NotNull p0: Controller, @org.jetbrains.annotations.NotNull p1: java.lang.String, @org.jetbrains.annotations.NotNull p2: kotlin.coroutines.Continuation): java.lang.Object -} diff --git a/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index f43b75ca8ed..7b30e3d47a4 100644 --- a/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-ir-jvm/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -4727,12 +4727,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes doTest(fileName); } - @TestMetadata("suspendExtension.kt") - public void testSuspendExtension() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/suspendExtension.kt"); - doTest(fileName); - } - @TestMetadata("suspendFromInlineLambda.kt") public void testSuspendFromInlineLambda() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/suspendFromInlineLambda.kt"); @@ -4938,12 +4932,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/multiModule/simple.kt"); doTest(fileName); } - - @TestMetadata("suspendExtension.kt") - public void testSuspendExtension() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/multiModule/suspendExtension.kt"); - doTest(fileName); - } } @TestMetadata("compiler/testData/codegen/box/coroutines/stackUnwinding") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index fd5cb72ca43..d2dbfbe5e7c 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -4727,12 +4727,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { doTest(fileName); } - @TestMetadata("suspendExtension.kt") - public void testSuspendExtension() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/suspendExtension.kt"); - doTest(fileName); - } - @TestMetadata("suspendFromInlineLambda.kt") public void testSuspendFromInlineLambda() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/suspendFromInlineLambda.kt"); @@ -4938,12 +4932,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/multiModule/simple.kt"); doTest(fileName); } - - @TestMetadata("suspendExtension.kt") - public void testSuspendExtension() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/multiModule/suspendExtension.kt"); - doTest(fileName); - } } @TestMetadata("compiler/testData/codegen/box/coroutines/stackUnwinding") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeCodegenTestGenerated.java index 4a627200c30..5cff60e9d65 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeCodegenTestGenerated.java @@ -4727,12 +4727,6 @@ public class LightAnalysisModeCodegenTestGenerated extends AbstractLightAnalysis doTest(fileName); } - @TestMetadata("suspendExtension.kt") - public void testSuspendExtension() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/suspendExtension.kt"); - doTest(fileName); - } - @TestMetadata("suspendFromInlineLambda.kt") public void testSuspendFromInlineLambda() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/suspendFromInlineLambda.kt"); @@ -4938,12 +4932,6 @@ public class LightAnalysisModeCodegenTestGenerated extends AbstractLightAnalysis String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/multiModule/simple.kt"); doTest(fileName); } - - @TestMetadata("suspendExtension.kt") - public void testSuspendExtension() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/multiModule/suspendExtension.kt"); - doTest(fileName); - } } @TestMetadata("compiler/testData/codegen/box/coroutines/stackUnwinding") diff --git a/core/builtins/src/kotlin/coroutines/Coroutines.kt b/core/builtins/src/kotlin/coroutines/Coroutines.kt index 7ec2ed1a745..8d9785b2412 100644 --- a/core/builtins/src/kotlin/coroutines/Coroutines.kt +++ b/core/builtins/src/kotlin/coroutines/Coroutines.kt @@ -33,15 +33,6 @@ public interface Continuation { public fun resumeWithException(exception: Throwable) } - -/** - * Specifies that suspend extensions with a receiver based on corresponding controller class are allowed to be declared - */ -@SinceKotlin("1.1") -@Target(AnnotationTarget.CLASS) -@Retention(AnnotationRetention.BINARY) -public annotation class AllowSuspendExtensions - /** * This value can be used as a return value of [kotlin.coroutines.maySuspendWithCurrentContinuation] `body` argument to state that * the execution was suspended and will not return any result immediately. diff --git a/idea/testData/hierarchy/withLib/annotation/Annotation_verification.xml b/idea/testData/hierarchy/withLib/annotation/Annotation_verification.xml index 45b641a70b2..bce7cb6bab1 100644 --- a/idea/testData/hierarchy/withLib/annotation/Annotation_verification.xml +++ b/idea/testData/hierarchy/withLib/annotation/Annotation_verification.xml @@ -50,7 +50,6 @@ - diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index da036956875..0afe6ef1df0 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -5538,12 +5538,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { doTest(fileName); } - @TestMetadata("suspendExtension.kt") - public void testSuspendExtension() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/suspendExtension.kt"); - doTest(fileName); - } - @TestMetadata("suspendFromInlineLambda.kt") public void testSuspendFromInlineLambda() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/suspendFromInlineLambda.kt"); @@ -5743,12 +5737,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/multiModule/simple.kt"); doTest(fileName); } - - @TestMetadata("suspendExtension.kt") - public void testSuspendExtension() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/coroutines/multiModule/suspendExtension.kt"); - doTest(fileName); - } } @TestMetadata("compiler/testData/codegen/box/coroutines/stackUnwinding") diff --git a/libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-runtime.txt b/libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-runtime.txt index 50ac420fc09..dd161382e9c 100644 --- a/libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-runtime.txt +++ b/libraries/tools/binary-compatibility-validator/reference-public-api/kotlin-runtime.txt @@ -179,9 +179,6 @@ public abstract class kotlin/collections/ShortIterator : java/util/Iterator, kot public fun remove ()V } -public abstract interface annotation class kotlin/coroutines/AllowSuspendExtensions : java/lang/annotation/Annotation { -} - public abstract interface class kotlin/coroutines/Continuation { public abstract fun resume (Ljava/lang/Object;)V public abstract fun resumeWithException (Ljava/lang/Throwable;)V