diff --git a/compiler/testData/codegen/box/coroutines/featureIntersection/suspendFunction12.kt b/compiler/testData/codegen/box/coroutines/featureIntersection/suspendFunction12.kt new file mode 100644 index 00000000000..917ecf9b4f0 --- /dev/null +++ b/compiler/testData/codegen/box/coroutines/featureIntersection/suspendFunction12.kt @@ -0,0 +1,19 @@ +// IGNORE_BACKEND: JS_IR, JS +// IGNORE_BACKEND: JVM_IR +// WITH_RUNTIME +// WITH_COROUTINES +// LANGUAGE_VERSION: 1.2 + +import helpers.* +import kotlin.coroutines.* + +val lambda1 = { x: Any -> } as (Any) -> Unit +val suspendLambda0: suspend () -> Unit = {} + +fun box(): String { + assert(lambda1 is SuspendFunction0<*>) { "Failed: lambda1 !is SuspendFunction0<*>" } + assert(suspendLambda0 is Function1<*, *>) { "Failed: suspendLambda0 is Function1<*, *>" } + assert(suspendLambda0 is SuspendFunction0<*>) { "Failed: suspendLambda0 is SuspendFunction0<*>" } + + return "OK" +} \ No newline at end of file diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 37f70d2bdf3..94fa77e7993 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -6510,6 +6510,11 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendDestructuringInLambdas.kt", "kotlin.coroutines"); } + @TestMetadata("suspendFunction12.kt") + public void testSuspendFunction12() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendFunction12.kt"); + } + @TestMetadata("suspendFunctionIsAs.kt") public void testSuspendFunctionIsAs() throws Exception { runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendFunctionIsAs.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 1e404d523e3..fd151886e8e 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -6510,6 +6510,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendDestructuringInLambdas.kt", "kotlin.coroutines"); } + @TestMetadata("suspendFunction12.kt") + public void testSuspendFunction12() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendFunction12.kt"); + } + @TestMetadata("suspendFunctionIsAs.kt") public void testSuspendFunctionIsAs() throws Exception { runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendFunctionIsAs.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 5b57805a349..1feee0bda70 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -6510,6 +6510,11 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendDestructuringInLambdas.kt", "kotlin.coroutines"); } + @TestMetadata("suspendFunction12.kt") + public void testSuspendFunction12() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendFunction12.kt"); + } + @TestMetadata("suspendFunctionIsAs.kt") public void testSuspendFunctionIsAs() throws Exception { runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendFunctionIsAs.kt"); diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/IrJsCodegenBoxTestGenerated.java index ff037d6e7c7..0ab8aac97cc 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/IrJsCodegenBoxTestGenerated.java @@ -5665,6 +5665,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendDestructuringInLambdas.kt", "kotlin.coroutines.experimental"); } + @TestMetadata("suspendFunction12.kt") + public void testSuspendFunction12() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendFunction12.kt"); + } + @TestMetadata("suspendFunctionIsAs.kt") public void testSuspendFunctionIsAs() throws Exception { runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendFunctionIsAs.kt"); @@ -12979,11 +12984,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { public static class PrimitiveCompanion extends AbstractIrJsCodegenBoxTest { private void runTest(String testDataFilePath) throws Exception { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath); - } + } public void testAllFilesPresentInPrimitiveCompanion() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/objects/companionObjectAccess/primitiveCompanion"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS_IR, true); - } + } @TestMetadata("byteCompanionObject.kt") public void testByteCompanionObject() throws Exception { 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 631a543c008..74279c4c8c4 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 @@ -6220,6 +6220,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/featureIntersection/suspendDestructuringInLambdas.kt", "kotlin.coroutines"); } + @TestMetadata("suspendFunction12.kt") + public void testSuspendFunction12() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendFunction12.kt"); + } + @TestMetadata("suspendFunctionIsAs.kt") public void testSuspendFunctionIsAs() throws Exception { runTest("compiler/testData/codegen/box/coroutines/featureIntersection/suspendFunctionIsAs.kt"); @@ -14039,11 +14044,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { public static class PrimitiveCompanion extends AbstractJsCodegenBoxTest { private void runTest(String testDataFilePath) throws Exception { KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath); - } + } public void testAllFilesPresentInPrimitiveCompanion() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/objects/companionObjectAccess/primitiveCompanion"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true); - } + } @TestMetadata("byteCompanionObject.kt") public void testByteCompanionObject() throws Exception { diff --git a/libraries/stdlib/coroutines/jvm/src/kotlin/coroutines/jvm/internal/ContinuationImpl.kt b/libraries/stdlib/coroutines/jvm/src/kotlin/coroutines/jvm/internal/ContinuationImpl.kt index 3cff90891d8..3a9f31bb9a7 100644 --- a/libraries/stdlib/coroutines/jvm/src/kotlin/coroutines/jvm/internal/ContinuationImpl.kt +++ b/libraries/stdlib/coroutines/jvm/src/kotlin/coroutines/jvm/internal/ContinuationImpl.kt @@ -126,7 +126,7 @@ internal object CompletedContinuation : Continuation { } @SinceKotlin("1.3") -// To distinguish suspend function types from ordinary function types all suspend function type shall implement this interface +// To distinguish suspend function types from ordinary function types all suspend function types shall implement this interface internal interface SuspendFunction @SinceKotlin("1.3")