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 e53ba3e92da..28a892cc1e9 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 @@ -9902,6 +9902,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt"); } + @Test + @TestMetadata("varargCallFromSuspend.kt") + public void testVarargCallFromSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varargCallFromSuspend.kt"); + } + @Nested @TestMetadata("compiler/testData/codegen/box/coroutines/bridges") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/testData/codegen/box/coroutines/varargCallFromSuspend.kt b/compiler/testData/codegen/box/coroutines/varargCallFromSuspend.kt new file mode 100644 index 00000000000..4f15ff68635 --- /dev/null +++ b/compiler/testData/codegen/box/coroutines/varargCallFromSuspend.kt @@ -0,0 +1,72 @@ +// WITH_RUNTIME + +import kotlin.coroutines.* + +var failure = false + +suspend fun foo() { + if ((baz( + bar() + ))[0] != 5 + ) failure = true + + val baz = baz( + bar(), + bar2(), + bar3() + ) + if (baz[0] != 5 || baz[1] != 6 || baz[2] != 7) failure = true + + val arrayOf = arrayOf( + bar(), + bar2(), + bar3() + ) + if (arrayOf[0] != 5 || arrayOf[1] != 6 || arrayOf[2] != 7) failure = true + + val baz1 = baz( + *arrayOf( + bar3(), + bar2(), + bar() + ) + ) + if (baz1[0] != 7 || baz1[1] != 6 || baz1[2] != 5) failure = true + + val baz2 = baz( + *arrayOf( + bar3(), + bar2(), + bar() + ) + ) + if (baz2[0] != 7 || baz2[1] != 6 || baz2[2] != 5) failure = true + + val baz3 = bar4( + *baz( + bar2(), + bar(), + bar3() + ) + ) + if (baz3[0] != 6 || baz3[1] != 5 || baz3[2] != 7) failure = true + + val bah = bah(101, bar(), *intArrayOf(bar3(), bar2()), 8) + if (bah[0] != 5 || bah[1] != 7 || bah[2] != 6 || bah[3] != 8 || bah[4] != 101) failure = true +} + +fun baz(vararg elements: T): Array = elements + +suspend fun bar() = 5 +suspend fun bar2() = 6 +suspend fun bar3() = 7 + +suspend fun bar4(vararg elements: T) = elements + +fun bah(index: Int, vararg elements: Int): List = elements.toList() + index + +fun box(): String { + ::foo.startCoroutine(Continuation(EmptyCoroutineContext) { it.getOrThrow() }) + + return if (!failure) "OK" else "FAILURE" +} \ No newline at end of file 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 5f5b90ea3ba..3b69fc796b3 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 @@ -9794,6 +9794,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt"); } + @Test + @TestMetadata("varargCallFromSuspend.kt") + public void testVarargCallFromSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varargCallFromSuspend.kt"); + } + @Nested @TestMetadata("compiler/testData/codegen/box/coroutines/bridges") @TestDataPath("$PROJECT_ROOT") 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 fbfe521a0c1..eaa87507749 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 @@ -9902,6 +9902,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt"); } + @Test + @TestMetadata("varargCallFromSuspend.kt") + public void testVarargCallFromSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varargCallFromSuspend.kt"); + } + @Nested @TestMetadata("compiler/testData/codegen/box/coroutines/bridges") @TestDataPath("$PROJECT_ROOT") diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 7e0ae7e0c06..65a75cff46d 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -7670,6 +7670,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt"); } + @TestMetadata("varargCallFromSuspend.kt") + public void testVarargCallFromSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varargCallFromSuspend.kt"); + } + @TestMetadata("compiler/testData/codegen/box/coroutines/bridges") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) 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 56715f19774..16f7dfb0456 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 @@ -6819,6 +6819,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes runTest("compiler/testData/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt"); } + @TestMetadata("varargCallFromSuspend.kt") + public void testVarargCallFromSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varargCallFromSuspend.kt"); + } + @TestMetadata("compiler/testData/codegen/box/coroutines/bridges") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) 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 25d2c4d003d..79d2d27bb3a 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 @@ -6225,6 +6225,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt"); } + @TestMetadata("varargCallFromSuspend.kt") + public void testVarargCallFromSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varargCallFromSuspend.kt"); + } + @TestMetadata("compiler/testData/codegen/box/coroutines/bridges") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) 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 7794cd46425..cd1148e8b56 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 @@ -6225,6 +6225,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/coroutines/varValueConflictsWithTableSameSort.kt"); } + @TestMetadata("varargCallFromSuspend.kt") + public void testVarargCallFromSuspend() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/varargCallFromSuspend.kt"); + } + @TestMetadata("compiler/testData/codegen/box/coroutines/bridges") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)