diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java index 3e2fb2e5769..e53ba3e92da 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java @@ -9776,6 +9776,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsSupertype.kt"); } + @Test + @TestMetadata("suspendFunctionAsSupertypeCall.kt") + public void testSuspendFunctionAsSupertypeCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsSupertypeCall.kt"); + } + @Test @TestMetadata("suspendFunctionMethodReference.kt") public void testSuspendFunctionMethodReference() throws Exception { diff --git a/compiler/testData/codegen/box/coroutines/suspendFunctionAsSupertypeCall.kt b/compiler/testData/codegen/box/coroutines/suspendFunctionAsSupertypeCall.kt new file mode 100644 index 00000000000..007076cb804 --- /dev/null +++ b/compiler/testData/codegen/box/coroutines/suspendFunctionAsSupertypeCall.kt @@ -0,0 +1,48 @@ +// WITH_RUNTIME +// !LANGUAGE: +SuspendFunctionAsSupertype + +import kotlin.coroutines.* + +var failure: String? = "FAIL ILLEGAL STATE" + +class SuspendNoneUnit: suspend () -> Unit { + override suspend fun invoke() { + failure = null + } +} + +class SuspendIntString: suspend (Int) -> String { + override suspend fun invoke(p: Int): String { + failure = if (p == 7) null else "FAIL CONDITION" + return "OK" + } +} + +fun suspendNoneUnit(): String? { + failure = "FAIL INHERITED 2" + val a = suspend { + val snu = SuspendNoneUnit() + snu() + } + a.startCoroutine(Continuation(EmptyCoroutineContext) { it.getOrThrow() }) + return failure +} + +fun suspendIntString(): String? { + failure = "FAIL INHERITED 3" + val a = suspend { + val sis = SuspendIntString() + sis(7) + } + a.startCoroutine(Continuation(EmptyCoroutineContext) { it.getOrThrow() }) + return failure +} + +fun box(): String { + val failures = listOfNotNull( + suspendNoneUnit(), + suspendIntString() + ) + + return if (failures.isNotEmpty()) failures.joinToString("\n") else "OK" +} diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index bfecb7b16c1..5f5b90ea3ba 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -9668,6 +9668,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsSupertype.kt"); } + @Test + @TestMetadata("suspendFunctionAsSupertypeCall.kt") + public void testSuspendFunctionAsSupertypeCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsSupertypeCall.kt"); + } + @Test @TestMetadata("suspendFunctionMethodReference.kt") public void testSuspendFunctionMethodReference() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index c0556b0333a..fbfe521a0c1 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -9776,6 +9776,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsSupertype.kt"); } + @Test + @TestMetadata("suspendFunctionAsSupertypeCall.kt") + public void testSuspendFunctionAsSupertypeCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsSupertypeCall.kt"); + } + @Test @TestMetadata("suspendFunctionMethodReference.kt") public void testSuspendFunctionMethodReference() throws Exception { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index d8526b62441..7e0ae7e0c06 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -7565,6 +7565,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/coroutines/suspendFunImportedFromObject.kt"); } + @TestMetadata("suspendFunctionAsSupertypeCall.kt") + public void testSuspendFunctionAsSupertypeCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsSupertypeCall.kt"); + } + @TestMetadata("suspendFunctionMethodReference.kt") public void testSuspendFunctionMethodReference() throws Exception { runTest("compiler/testData/codegen/box/coroutines/suspendFunctionMethodReference.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index d24754a368d..56715f19774 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -6729,6 +6729,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsSupertype.kt"); } + @TestMetadata("suspendFunctionAsSupertypeCall.kt") + public void testSuspendFunctionAsSupertypeCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsSupertypeCall.kt"); + } + @TestMetadata("suspendFunctionMethodReference.kt") public void testSuspendFunctionMethodReference() throws Exception { runTest("compiler/testData/codegen/box/coroutines/suspendFunctionMethodReference.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 693cbb3a1d7..25d2c4d003d 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -6135,6 +6135,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsSupertype.kt"); } + @TestMetadata("suspendFunctionAsSupertypeCall.kt") + public void testSuspendFunctionAsSupertypeCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsSupertypeCall.kt"); + } + @TestMetadata("suspendFunctionMethodReference.kt") public void testSuspendFunctionMethodReference() throws Exception { runTest("compiler/testData/codegen/box/coroutines/suspendFunctionMethodReference.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index bc4d0767233..7794cd46425 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -6135,6 +6135,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsSupertype.kt"); } + @TestMetadata("suspendFunctionAsSupertypeCall.kt") + public void testSuspendFunctionAsSupertypeCall() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsSupertypeCall.kt"); + } + @TestMetadata("suspendFunctionMethodReference.kt") public void testSuspendFunctionMethodReference() throws Exception { runTest("compiler/testData/codegen/box/coroutines/suspendFunctionMethodReference.kt");