diff --git a/compiler/testData/codegen/box/coroutines/controlFlow/kt22694_1_2.kt b/compiler/testData/codegen/box/coroutines/controlFlow/kt22694_1_2.kt new file mode 100644 index 00000000000..4ac60d3f709 --- /dev/null +++ b/compiler/testData/codegen/box/coroutines/controlFlow/kt22694_1_2.kt @@ -0,0 +1,48 @@ +// IGNORE_BACKEND: JS_IR +// IGNORE_BACKEND: JVM_IR +// WITH_RUNTIME +// WITH_COROUTINES +// LANGUAGE_VERSION: 1.2 +import helpers.* +import kotlin.coroutines.experimental.* + +enum class Foo(vararg expected: String) { + A("start", "A", "end"), + B("start", "BCD", "end"), + C("start", "BCD", "end"), + D("start", "BCD", "end"), + E("start", "E", "end"), + F("start", "end"); + + val expected = expected.toList() +} + +fun box(): String { + for (c in Foo.values()) { + val actual = getSequence(c).toList() + if (actual != c.expected) { + return "FAIL: -- ${c.expected} != $actual" + } + } + + return "OK" +} + +fun getSequence(a: Foo) = + buildSequence { + yield("start") + when (a) { + Foo.A -> { + yield("A") + } + Foo.B, + Foo.C, + Foo.D-> { + yield("BCD") + } + Foo.E-> { + yield("E") + } + } + yield("end") + } \ No newline at end of file diff --git a/compiler/testData/codegen/box/coroutines/controlFlow/kt22694.kt b/compiler/testData/codegen/box/coroutines/controlFlow/kt22694_1_3.kt similarity index 94% rename from compiler/testData/codegen/box/coroutines/controlFlow/kt22694.kt rename to compiler/testData/codegen/box/coroutines/controlFlow/kt22694_1_3.kt index 0f2ec3d03cc..c25e21cf557 100644 --- a/compiler/testData/codegen/box/coroutines/controlFlow/kt22694.kt +++ b/compiler/testData/codegen/box/coroutines/controlFlow/kt22694_1_3.kt @@ -2,9 +2,9 @@ // IGNORE_BACKEND: JVM_IR // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST +// LANGUAGE_VERSION: 1.3 import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* enum class Foo(vararg expected: String) { A("start", "A", "end"), diff --git a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine_1_2.kt b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine_1_2.kt new file mode 100644 index 00000000000..f4e8a8dfe83 --- /dev/null +++ b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine_1_2.kt @@ -0,0 +1,19 @@ +// IGNORE_BACKEND: JS_IR +// IGNORE_BACKEND: JVM_IR +// WITH_RUNTIME +// WITH_COROUTINES +// LANGUAGE_VERSION: 1.2 +import helpers.* +import kotlin.coroutines.experimental.* + +val f = run { + buildSequence { + if (true) { + yield("OK") + } + }.toList() +} + +fun box(): String { + return f[0] +} diff --git a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine.kt b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine_1_3.kt similarity index 81% rename from compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine.kt rename to compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine_1_3.kt index dd88aef7ea1..2867e0ba9bc 100644 --- a/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine.kt +++ b/compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine_1_3.kt @@ -2,9 +2,9 @@ // IGNORE_BACKEND: JVM_IR // WITH_RUNTIME // WITH_COROUTINES -// COMMON_COROUTINES_TEST +// LANGUAGE_VERSION: 1.3 import helpers.* -import COROUTINES_PACKAGE.* +import kotlin.coroutines.* val f = run { sequence { diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 1a4f919837d..d71b0277d9b 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -6343,14 +6343,14 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/ifStatement.kt", "kotlin.coroutines"); } - @TestMetadata("kt22694.kt") + @TestMetadata("kt22694_1_2.kt") public void testKt22694_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/kt22694.kt", "kotlin.coroutines.experimental"); + runTest("compiler/testData/codegen/box/coroutines/controlFlow/kt22694_1_2.kt"); } - @TestMetadata("kt22694.kt") + @TestMetadata("kt22694_1_3.kt") public void testKt22694_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/kt22694.kt", "kotlin.coroutines"); + runTest("compiler/testData/codegen/box/coroutines/controlFlow/kt22694_1_3.kt"); } @TestMetadata("labeledWhile.kt") @@ -7554,14 +7554,14 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/handleException.kt", "kotlin.coroutines"); } - @TestMetadata("ifExpressionInsideCoroutine.kt") + @TestMetadata("ifExpressionInsideCoroutine_1_2.kt") public void testIfExpressionInsideCoroutine_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine.kt", "kotlin.coroutines.experimental"); + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine_1_2.kt"); } - @TestMetadata("ifExpressionInsideCoroutine.kt") + @TestMetadata("ifExpressionInsideCoroutine_1_3.kt") public void testIfExpressionInsideCoroutine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine.kt", "kotlin.coroutines"); + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine_1_3.kt"); } @TestMetadata("inlineTwoReceivers.kt") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 99a8f7c5797..bd3eab708fb 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -6343,14 +6343,14 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/ifStatement.kt", "kotlin.coroutines"); } - @TestMetadata("kt22694.kt") + @TestMetadata("kt22694_1_2.kt") public void testKt22694_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/kt22694.kt", "kotlin.coroutines.experimental"); + runTest("compiler/testData/codegen/box/coroutines/controlFlow/kt22694_1_2.kt"); } - @TestMetadata("kt22694.kt") + @TestMetadata("kt22694_1_3.kt") public void testKt22694_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/kt22694.kt", "kotlin.coroutines"); + runTest("compiler/testData/codegen/box/coroutines/controlFlow/kt22694_1_3.kt"); } @TestMetadata("labeledWhile.kt") @@ -7554,14 +7554,14 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/handleException.kt", "kotlin.coroutines"); } - @TestMetadata("ifExpressionInsideCoroutine.kt") + @TestMetadata("ifExpressionInsideCoroutine_1_2.kt") public void testIfExpressionInsideCoroutine_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine.kt", "kotlin.coroutines.experimental"); + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine_1_2.kt"); } - @TestMetadata("ifExpressionInsideCoroutine.kt") + @TestMetadata("ifExpressionInsideCoroutine_1_3.kt") public void testIfExpressionInsideCoroutine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine.kt", "kotlin.coroutines"); + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine_1_3.kt"); } @TestMetadata("inlineTwoReceivers.kt") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index 31972db3525..ad3a5a329a8 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -6343,14 +6343,14 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/ifStatement.kt", "kotlin.coroutines"); } - @TestMetadata("kt22694.kt") + @TestMetadata("kt22694_1_2.kt") public void testKt22694_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/kt22694.kt", "kotlin.coroutines.experimental"); + runTest("compiler/testData/codegen/box/coroutines/controlFlow/kt22694_1_2.kt"); } - @TestMetadata("kt22694.kt") + @TestMetadata("kt22694_1_3.kt") public void testKt22694_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/kt22694.kt", "kotlin.coroutines"); + runTest("compiler/testData/codegen/box/coroutines/controlFlow/kt22694_1_3.kt"); } @TestMetadata("labeledWhile.kt") @@ -7554,14 +7554,14 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/handleException.kt", "kotlin.coroutines"); } - @TestMetadata("ifExpressionInsideCoroutine.kt") + @TestMetadata("ifExpressionInsideCoroutine_1_2.kt") public void testIfExpressionInsideCoroutine_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine.kt", "kotlin.coroutines.experimental"); + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine_1_2.kt"); } - @TestMetadata("ifExpressionInsideCoroutine.kt") + @TestMetadata("ifExpressionInsideCoroutine_1_3.kt") public void testIfExpressionInsideCoroutine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine.kt", "kotlin.coroutines"); + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine_1_3.kt"); } @TestMetadata("inlineTwoReceivers.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 8f9cadd0586..c87f4c31619 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 @@ -5573,9 +5573,14 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/ifStatement.kt", "kotlin.coroutines"); } - @TestMetadata("kt22694.kt") + @TestMetadata("kt22694_1_2.kt") + public void testKt22694_1_2() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/controlFlow/kt22694_1_2.kt"); + } + + @TestMetadata("kt22694_1_3.kt") public void testKt22694_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/kt22694.kt", "kotlin.coroutines"); + runTest("compiler/testData/codegen/box/coroutines/controlFlow/kt22694_1_3.kt"); } @TestMetadata("labeledWhile.kt") @@ -6349,9 +6354,14 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/handleException.kt", "kotlin.coroutines"); } - @TestMetadata("ifExpressionInsideCoroutine.kt") + @TestMetadata("ifExpressionInsideCoroutine_1_2.kt") + public void testIfExpressionInsideCoroutine_1_2() throws Exception { + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine_1_2.kt"); + } + + @TestMetadata("ifExpressionInsideCoroutine_1_3.kt") public void testIfExpressionInsideCoroutine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine.kt", "kotlin.coroutines"); + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine_1_3.kt"); } @TestMetadata("inlineTwoReceivers.kt") 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 218e3ba95b5..77a50db9ca6 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 @@ -6053,14 +6053,14 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/ifStatement.kt", "kotlin.coroutines"); } - @TestMetadata("kt22694.kt") + @TestMetadata("kt22694_1_2.kt") public void testKt22694_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/kt22694.kt", "kotlin.coroutines.experimental"); + runTest("compiler/testData/codegen/box/coroutines/controlFlow/kt22694_1_2.kt"); } - @TestMetadata("kt22694.kt") + @TestMetadata("kt22694_1_3.kt") public void testKt22694_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/controlFlow/kt22694.kt", "kotlin.coroutines"); + runTest("compiler/testData/codegen/box/coroutines/controlFlow/kt22694_1_3.kt"); } @TestMetadata("labeledWhile.kt") @@ -7234,14 +7234,14 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/handleException.kt", "kotlin.coroutines"); } - @TestMetadata("ifExpressionInsideCoroutine.kt") + @TestMetadata("ifExpressionInsideCoroutine_1_2.kt") public void testIfExpressionInsideCoroutine_1_2() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine.kt", "kotlin.coroutines.experimental"); + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine_1_2.kt"); } - @TestMetadata("ifExpressionInsideCoroutine.kt") + @TestMetadata("ifExpressionInsideCoroutine_1_3.kt") public void testIfExpressionInsideCoroutine_1_3() throws Exception { - runTestWithPackageReplacement("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine.kt", "kotlin.coroutines"); + runTest("compiler/testData/codegen/box/coroutines/suspendFunctionAsCoroutine/ifExpressionInsideCoroutine_1_3.kt"); } @TestMetadata("inlineTwoReceivers.kt")