From 3d473f608e3b6d2c390633ed5f74faa9ed303ad1 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Tue, 5 Dec 2017 12:55:53 +0300 Subject: [PATCH] Add more tests for for-in-array #KT-21354 Fixed Target versions 1.2.20 #KT-21321 Fixed Target versions 1.2.20 --- ...ArrayWithArrayPropertyUpdatedInLoopBody.kt | 0 ...rInArrayWithArrayVarUpdatedInLoopBody12.kt | 0 ...rInArrayWithArrayVarUpdatedInLoopBody13.kt | 0 ...forInDelegatedPropertyUpdatedInLoopBody.kt | 17 +++ .../forInArray/forInFieldUpdatedInLoopBody.kt | 16 +++ .../{ => forInArray}/forIntArray.kt | 0 .../{ => forInArray}/forNullableIntArray.kt | 0 .../{ => forInArray}/forPrimitiveIntArray.kt | 0 .../forInFieldUpdatedInLoopBodyBefore13.kt | 15 +++ .../ir/IrBlackBoxCodegenTestGenerated.java | 93 ++++++++++------ .../DiagnosticsTestWithStdLibGenerated.java | 6 + ...ticsTestWithStdLibUsingJavacGenerated.java | 6 + .../codegen/BlackBoxCodegenTestGenerated.java | 93 ++++++++++------ .../LightAnalysisModeTestGenerated.java | 93 ++++++++++------ .../semantics/JsCodegenBoxTestGenerated.java | 105 +++++++++++------- 15 files changed, 294 insertions(+), 150 deletions(-) rename compiler/testData/codegen/box/{ranges => controlStructures/forInArray}/forInArrayWithArrayPropertyUpdatedInLoopBody.kt (100%) rename compiler/testData/codegen/box/{ranges => controlStructures/forInArray}/forInArrayWithArrayVarUpdatedInLoopBody12.kt (100%) rename compiler/testData/codegen/box/{ranges => controlStructures/forInArray}/forInArrayWithArrayVarUpdatedInLoopBody13.kt (100%) create mode 100644 compiler/testData/codegen/box/controlStructures/forInArray/forInDelegatedPropertyUpdatedInLoopBody.kt create mode 100644 compiler/testData/codegen/box/controlStructures/forInArray/forInFieldUpdatedInLoopBody.kt rename compiler/testData/codegen/box/controlStructures/{ => forInArray}/forIntArray.kt (100%) rename compiler/testData/codegen/box/controlStructures/{ => forInArray}/forNullableIntArray.kt (100%) rename compiler/testData/codegen/box/controlStructures/{ => forInArray}/forPrimitiveIntArray.kt (100%) create mode 100644 compiler/testData/diagnostics/testsWithStdLib/forInArrayLoop/forInFieldUpdatedInLoopBodyBefore13.kt diff --git a/compiler/testData/codegen/box/ranges/forInArrayWithArrayPropertyUpdatedInLoopBody.kt b/compiler/testData/codegen/box/controlStructures/forInArray/forInArrayWithArrayPropertyUpdatedInLoopBody.kt similarity index 100% rename from compiler/testData/codegen/box/ranges/forInArrayWithArrayPropertyUpdatedInLoopBody.kt rename to compiler/testData/codegen/box/controlStructures/forInArray/forInArrayWithArrayPropertyUpdatedInLoopBody.kt diff --git a/compiler/testData/codegen/box/ranges/forInArrayWithArrayVarUpdatedInLoopBody12.kt b/compiler/testData/codegen/box/controlStructures/forInArray/forInArrayWithArrayVarUpdatedInLoopBody12.kt similarity index 100% rename from compiler/testData/codegen/box/ranges/forInArrayWithArrayVarUpdatedInLoopBody12.kt rename to compiler/testData/codegen/box/controlStructures/forInArray/forInArrayWithArrayVarUpdatedInLoopBody12.kt diff --git a/compiler/testData/codegen/box/ranges/forInArrayWithArrayVarUpdatedInLoopBody13.kt b/compiler/testData/codegen/box/controlStructures/forInArray/forInArrayWithArrayVarUpdatedInLoopBody13.kt similarity index 100% rename from compiler/testData/codegen/box/ranges/forInArrayWithArrayVarUpdatedInLoopBody13.kt rename to compiler/testData/codegen/box/controlStructures/forInArray/forInArrayWithArrayVarUpdatedInLoopBody13.kt diff --git a/compiler/testData/codegen/box/controlStructures/forInArray/forInDelegatedPropertyUpdatedInLoopBody.kt b/compiler/testData/codegen/box/controlStructures/forInArray/forInDelegatedPropertyUpdatedInLoopBody.kt new file mode 100644 index 00000000000..4807578c574 --- /dev/null +++ b/compiler/testData/codegen/box/controlStructures/forInArray/forInDelegatedPropertyUpdatedInLoopBody.kt @@ -0,0 +1,17 @@ +class Del(var x: T) { + operator fun getValue(thisRef: Any?, kProp: Any) = x + + operator fun setValue(thisRef: Any?, kProp: Any, value: T) { + x = value + } +} + +fun box(): String { + var xs by Del(intArrayOf(1, 2, 3)) + var sum = 0 + for (x in xs) { + sum = sum * 10 + x + xs = intArrayOf(4, 5, 6) + } + return if (sum == 123) "OK" else "Fail: $sum" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/controlStructures/forInArray/forInFieldUpdatedInLoopBody.kt b/compiler/testData/codegen/box/controlStructures/forInArray/forInFieldUpdatedInLoopBody.kt new file mode 100644 index 00000000000..592ba5119db --- /dev/null +++ b/compiler/testData/codegen/box/controlStructures/forInArray/forInFieldUpdatedInLoopBody.kt @@ -0,0 +1,16 @@ +var xs: IntArray = intArrayOf(1, 2, 3) + get() = field + set(ys) { + var sum = 0 + for (x in field) { + sum = sum * 10 + x + field = intArrayOf(4, 5, 6) + } + if (sum != 123) throw AssertionError("sum=$sum") + field = ys + } + +fun box(): String { + xs = intArrayOf() + return "OK" +} \ No newline at end of file diff --git a/compiler/testData/codegen/box/controlStructures/forIntArray.kt b/compiler/testData/codegen/box/controlStructures/forInArray/forIntArray.kt similarity index 100% rename from compiler/testData/codegen/box/controlStructures/forIntArray.kt rename to compiler/testData/codegen/box/controlStructures/forInArray/forIntArray.kt diff --git a/compiler/testData/codegen/box/controlStructures/forNullableIntArray.kt b/compiler/testData/codegen/box/controlStructures/forInArray/forNullableIntArray.kt similarity index 100% rename from compiler/testData/codegen/box/controlStructures/forNullableIntArray.kt rename to compiler/testData/codegen/box/controlStructures/forInArray/forNullableIntArray.kt diff --git a/compiler/testData/codegen/box/controlStructures/forPrimitiveIntArray.kt b/compiler/testData/codegen/box/controlStructures/forInArray/forPrimitiveIntArray.kt similarity index 100% rename from compiler/testData/codegen/box/controlStructures/forPrimitiveIntArray.kt rename to compiler/testData/codegen/box/controlStructures/forInArray/forPrimitiveIntArray.kt diff --git a/compiler/testData/diagnostics/testsWithStdLib/forInArrayLoop/forInFieldUpdatedInLoopBodyBefore13.kt b/compiler/testData/diagnostics/testsWithStdLib/forInArrayLoop/forInFieldUpdatedInLoopBodyBefore13.kt new file mode 100644 index 00000000000..134a2ccb6cb --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/forInArrayLoop/forInFieldUpdatedInLoopBodyBefore13.kt @@ -0,0 +1,15 @@ +// !LANGUAGE: -ProperForInArrayLoopRangeVariableAssignmentSemantic +// !DIAGNOSTICS: -UNUSED_VALUE +// SKIP_TXT + +var xs: IntArray = intArrayOf(1, 2, 3) + get() = field + set(ys) { + var sum = 0 + for (x in field) { + sum = sum * 10 + x + field = intArrayOf(4, 5, 6) + } + if (sum != 123) throw AssertionError("sum=$sum") + field = ys + } 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 14fbf38d72b..799c963df13 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 @@ -4721,12 +4721,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes doTest(fileName); } - @TestMetadata("forIntArray.kt") - public void testForIntArray() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forIntArray.kt"); - doTest(fileName); - } - @TestMetadata("forLoopMemberExtensionAll.kt") public void testForLoopMemberExtensionAll() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forLoopMemberExtensionAll.kt"); @@ -4745,18 +4739,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes doTest(fileName); } - @TestMetadata("forNullableIntArray.kt") - public void testForNullableIntArray() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forNullableIntArray.kt"); - doTest(fileName); - } - - @TestMetadata("forPrimitiveIntArray.kt") - public void testForPrimitiveIntArray() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forPrimitiveIntArray.kt"); - doTest(fileName); - } - @TestMetadata("forUserType.kt") public void testForUserType() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forUserType.kt"); @@ -5144,6 +5126,63 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes } } + @TestMetadata("compiler/testData/codegen/box/controlStructures/forInArray") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ForInArray extends AbstractIrBlackBoxCodegenTest { + public void testAllFilesPresentInForInArray() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/controlStructures/forInArray"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true); + } + + @TestMetadata("forInArrayWithArrayPropertyUpdatedInLoopBody.kt") + public void testForInArrayWithArrayPropertyUpdatedInLoopBody() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArray/forInArrayWithArrayPropertyUpdatedInLoopBody.kt"); + doTest(fileName); + } + + @TestMetadata("forInArrayWithArrayVarUpdatedInLoopBody12.kt") + public void testForInArrayWithArrayVarUpdatedInLoopBody12() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArray/forInArrayWithArrayVarUpdatedInLoopBody12.kt"); + doTest(fileName); + } + + @TestMetadata("forInArrayWithArrayVarUpdatedInLoopBody13.kt") + public void testForInArrayWithArrayVarUpdatedInLoopBody13() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArray/forInArrayWithArrayVarUpdatedInLoopBody13.kt"); + doTest(fileName); + } + + @TestMetadata("forInDelegatedPropertyUpdatedInLoopBody.kt") + public void testForInDelegatedPropertyUpdatedInLoopBody() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArray/forInDelegatedPropertyUpdatedInLoopBody.kt"); + doTest(fileName); + } + + @TestMetadata("forInFieldUpdatedInLoopBody.kt") + public void testForInFieldUpdatedInLoopBody() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArray/forInFieldUpdatedInLoopBody.kt"); + doTest(fileName); + } + + @TestMetadata("forIntArray.kt") + public void testForIntArray() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArray/forIntArray.kt"); + doTest(fileName); + } + + @TestMetadata("forNullableIntArray.kt") + public void testForNullableIntArray() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArray/forNullableIntArray.kt"); + doTest(fileName); + } + + @TestMetadata("forPrimitiveIntArray.kt") + public void testForPrimitiveIntArray() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArray/forPrimitiveIntArray.kt"); + doTest(fileName); + } + } + @TestMetadata("compiler/testData/codegen/box/controlStructures/returnsNothing") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -14549,24 +14588,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes doTest(fileName); } - @TestMetadata("forInArrayWithArrayPropertyUpdatedInLoopBody.kt") - public void testForInArrayWithArrayPropertyUpdatedInLoopBody() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInArrayWithArrayPropertyUpdatedInLoopBody.kt"); - doTest(fileName); - } - - @TestMetadata("forInArrayWithArrayVarUpdatedInLoopBody12.kt") - public void testForInArrayWithArrayVarUpdatedInLoopBody12() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInArrayWithArrayVarUpdatedInLoopBody12.kt"); - doTest(fileName); - } - - @TestMetadata("forInArrayWithArrayVarUpdatedInLoopBody13.kt") - public void testForInArrayWithArrayVarUpdatedInLoopBody13() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInArrayWithArrayVarUpdatedInLoopBody13.kt"); - doTest(fileName); - } - @TestMetadata("forInRangeLiteralWithMixedTypeBounds.kt") public void testForInRangeLiteralWithMixedTypeBounds() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInRangeLiteralWithMixedTypeBounds.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java index c96f87ea5db..becd7e5370a 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestWithStdLibGenerated.java @@ -1760,6 +1760,12 @@ public class DiagnosticsTestWithStdLibGenerated extends AbstractDiagnosticsTestW doTest(fileName); } + @TestMetadata("forInFieldUpdatedInLoopBodyBefore13.kt") + public void testForInFieldUpdatedInLoopBodyBefore13() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/forInArrayLoop/forInFieldUpdatedInLoopBodyBefore13.kt"); + doTest(fileName); + } + @TestMetadata("rangeLocalDelegatedPropertyAssignmentBefore13.kt") public void testRangeLocalDelegatedPropertyAssignmentBefore13() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/forInArrayLoop/rangeLocalDelegatedPropertyAssignmentBefore13.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java index ef8682e7034..16a331e6ac2 100644 --- a/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/checkers/javac/DiagnosticsTestWithStdLibUsingJavacGenerated.java @@ -1760,6 +1760,12 @@ public class DiagnosticsTestWithStdLibUsingJavacGenerated extends AbstractDiagno doTest(fileName); } + @TestMetadata("forInFieldUpdatedInLoopBodyBefore13.kt") + public void testForInFieldUpdatedInLoopBodyBefore13() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/forInArrayLoop/forInFieldUpdatedInLoopBodyBefore13.kt"); + doTest(fileName); + } + @TestMetadata("rangeLocalDelegatedPropertyAssignmentBefore13.kt") public void testRangeLocalDelegatedPropertyAssignmentBefore13() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/testsWithStdLib/forInArrayLoop/rangeLocalDelegatedPropertyAssignmentBefore13.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 0c9b1a55750..fea4dc37295 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -4721,12 +4721,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { doTest(fileName); } - @TestMetadata("forIntArray.kt") - public void testForIntArray() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forIntArray.kt"); - doTest(fileName); - } - @TestMetadata("forLoopMemberExtensionAll.kt") public void testForLoopMemberExtensionAll() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forLoopMemberExtensionAll.kt"); @@ -4745,18 +4739,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { doTest(fileName); } - @TestMetadata("forNullableIntArray.kt") - public void testForNullableIntArray() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forNullableIntArray.kt"); - doTest(fileName); - } - - @TestMetadata("forPrimitiveIntArray.kt") - public void testForPrimitiveIntArray() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forPrimitiveIntArray.kt"); - doTest(fileName); - } - @TestMetadata("forUserType.kt") public void testForUserType() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forUserType.kt"); @@ -5144,6 +5126,63 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { } } + @TestMetadata("compiler/testData/codegen/box/controlStructures/forInArray") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ForInArray extends AbstractBlackBoxCodegenTest { + public void testAllFilesPresentInForInArray() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/controlStructures/forInArray"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true); + } + + @TestMetadata("forInArrayWithArrayPropertyUpdatedInLoopBody.kt") + public void testForInArrayWithArrayPropertyUpdatedInLoopBody() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArray/forInArrayWithArrayPropertyUpdatedInLoopBody.kt"); + doTest(fileName); + } + + @TestMetadata("forInArrayWithArrayVarUpdatedInLoopBody12.kt") + public void testForInArrayWithArrayVarUpdatedInLoopBody12() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArray/forInArrayWithArrayVarUpdatedInLoopBody12.kt"); + doTest(fileName); + } + + @TestMetadata("forInArrayWithArrayVarUpdatedInLoopBody13.kt") + public void testForInArrayWithArrayVarUpdatedInLoopBody13() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArray/forInArrayWithArrayVarUpdatedInLoopBody13.kt"); + doTest(fileName); + } + + @TestMetadata("forInDelegatedPropertyUpdatedInLoopBody.kt") + public void testForInDelegatedPropertyUpdatedInLoopBody() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArray/forInDelegatedPropertyUpdatedInLoopBody.kt"); + doTest(fileName); + } + + @TestMetadata("forInFieldUpdatedInLoopBody.kt") + public void testForInFieldUpdatedInLoopBody() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArray/forInFieldUpdatedInLoopBody.kt"); + doTest(fileName); + } + + @TestMetadata("forIntArray.kt") + public void testForIntArray() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArray/forIntArray.kt"); + doTest(fileName); + } + + @TestMetadata("forNullableIntArray.kt") + public void testForNullableIntArray() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArray/forNullableIntArray.kt"); + doTest(fileName); + } + + @TestMetadata("forPrimitiveIntArray.kt") + public void testForPrimitiveIntArray() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArray/forPrimitiveIntArray.kt"); + doTest(fileName); + } + } + @TestMetadata("compiler/testData/codegen/box/controlStructures/returnsNothing") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -14549,24 +14588,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { doTest(fileName); } - @TestMetadata("forInArrayWithArrayPropertyUpdatedInLoopBody.kt") - public void testForInArrayWithArrayPropertyUpdatedInLoopBody() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInArrayWithArrayPropertyUpdatedInLoopBody.kt"); - doTest(fileName); - } - - @TestMetadata("forInArrayWithArrayVarUpdatedInLoopBody12.kt") - public void testForInArrayWithArrayVarUpdatedInLoopBody12() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInArrayWithArrayVarUpdatedInLoopBody12.kt"); - doTest(fileName); - } - - @TestMetadata("forInArrayWithArrayVarUpdatedInLoopBody13.kt") - public void testForInArrayWithArrayVarUpdatedInLoopBody13() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInArrayWithArrayVarUpdatedInLoopBody13.kt"); - doTest(fileName); - } - @TestMetadata("forInRangeLiteralWithMixedTypeBounds.kt") public void testForInRangeLiteralWithMixedTypeBounds() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInRangeLiteralWithMixedTypeBounds.kt"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 03fb3a59554..b20e01a2b27 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -4721,12 +4721,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes doTest(fileName); } - @TestMetadata("forIntArray.kt") - public void testForIntArray() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forIntArray.kt"); - doTest(fileName); - } - @TestMetadata("forLoopMemberExtensionAll.kt") public void testForLoopMemberExtensionAll() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forLoopMemberExtensionAll.kt"); @@ -4745,18 +4739,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes doTest(fileName); } - @TestMetadata("forNullableIntArray.kt") - public void testForNullableIntArray() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forNullableIntArray.kt"); - doTest(fileName); - } - - @TestMetadata("forPrimitiveIntArray.kt") - public void testForPrimitiveIntArray() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forPrimitiveIntArray.kt"); - doTest(fileName); - } - @TestMetadata("forUserType.kt") public void testForUserType() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forUserType.kt"); @@ -5144,6 +5126,63 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes } } + @TestMetadata("compiler/testData/codegen/box/controlStructures/forInArray") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ForInArray extends AbstractLightAnalysisModeTest { + public void testAllFilesPresentInForInArray() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/controlStructures/forInArray"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true); + } + + @TestMetadata("forInArrayWithArrayPropertyUpdatedInLoopBody.kt") + public void testForInArrayWithArrayPropertyUpdatedInLoopBody() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArray/forInArrayWithArrayPropertyUpdatedInLoopBody.kt"); + doTest(fileName); + } + + @TestMetadata("forInArrayWithArrayVarUpdatedInLoopBody12.kt") + public void testForInArrayWithArrayVarUpdatedInLoopBody12() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArray/forInArrayWithArrayVarUpdatedInLoopBody12.kt"); + doTest(fileName); + } + + @TestMetadata("forInArrayWithArrayVarUpdatedInLoopBody13.kt") + public void testForInArrayWithArrayVarUpdatedInLoopBody13() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArray/forInArrayWithArrayVarUpdatedInLoopBody13.kt"); + doTest(fileName); + } + + @TestMetadata("forInDelegatedPropertyUpdatedInLoopBody.kt") + public void testForInDelegatedPropertyUpdatedInLoopBody() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArray/forInDelegatedPropertyUpdatedInLoopBody.kt"); + doTest(fileName); + } + + @TestMetadata("forInFieldUpdatedInLoopBody.kt") + public void testForInFieldUpdatedInLoopBody() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArray/forInFieldUpdatedInLoopBody.kt"); + doTest(fileName); + } + + @TestMetadata("forIntArray.kt") + public void testForIntArray() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArray/forIntArray.kt"); + doTest(fileName); + } + + @TestMetadata("forNullableIntArray.kt") + public void testForNullableIntArray() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArray/forNullableIntArray.kt"); + doTest(fileName); + } + + @TestMetadata("forPrimitiveIntArray.kt") + public void testForPrimitiveIntArray() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArray/forPrimitiveIntArray.kt"); + doTest(fileName); + } + } + @TestMetadata("compiler/testData/codegen/box/controlStructures/returnsNothing") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -14549,24 +14588,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes doTest(fileName); } - @TestMetadata("forInArrayWithArrayPropertyUpdatedInLoopBody.kt") - public void testForInArrayWithArrayPropertyUpdatedInLoopBody() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInArrayWithArrayPropertyUpdatedInLoopBody.kt"); - doTest(fileName); - } - - @TestMetadata("forInArrayWithArrayVarUpdatedInLoopBody12.kt") - public void testForInArrayWithArrayVarUpdatedInLoopBody12() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInArrayWithArrayVarUpdatedInLoopBody12.kt"); - doTest(fileName); - } - - @TestMetadata("forInArrayWithArrayVarUpdatedInLoopBody13.kt") - public void testForInArrayWithArrayVarUpdatedInLoopBody13() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInArrayWithArrayVarUpdatedInLoopBody13.kt"); - doTest(fileName); - } - @TestMetadata("forInRangeLiteralWithMixedTypeBounds.kt") public void testForInRangeLiteralWithMixedTypeBounds() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInRangeLiteralWithMixedTypeBounds.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 5220b836dd1..2a7dde33631 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 @@ -5243,12 +5243,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { doTest(fileName); } - @TestMetadata("forIntArray.kt") - public void testForIntArray() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forIntArray.kt"); - doTest(fileName); - } - @TestMetadata("forLoopMemberExtensionAll.kt") public void testForLoopMemberExtensionAll() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forLoopMemberExtensionAll.kt"); @@ -5273,18 +5267,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that."); } - @TestMetadata("forNullableIntArray.kt") - public void testForNullableIntArray() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forNullableIntArray.kt"); - doTest(fileName); - } - - @TestMetadata("forPrimitiveIntArray.kt") - public void testForPrimitiveIntArray() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forPrimitiveIntArray.kt"); - doTest(fileName); - } - @TestMetadata("forUserType.kt") public void testForUserType() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forUserType.kt"); @@ -5714,6 +5696,69 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { } } + @TestMetadata("compiler/testData/codegen/box/controlStructures/forInArray") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class ForInArray extends AbstractJsCodegenBoxTest { + public void testAllFilesPresentInForInArray() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/controlStructures/forInArray"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true); + } + + @TestMetadata("forInArrayWithArrayPropertyUpdatedInLoopBody.kt") + public void testForInArrayWithArrayPropertyUpdatedInLoopBody() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArray/forInArrayWithArrayPropertyUpdatedInLoopBody.kt"); + doTest(fileName); + } + + @TestMetadata("forInArrayWithArrayVarUpdatedInLoopBody12.kt") + public void testForInArrayWithArrayVarUpdatedInLoopBody12() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArray/forInArrayWithArrayVarUpdatedInLoopBody12.kt"); + try { + doTest(fileName); + } + catch (Throwable ignore) { + return; + } + throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that."); + } + + @TestMetadata("forInArrayWithArrayVarUpdatedInLoopBody13.kt") + public void testForInArrayWithArrayVarUpdatedInLoopBody13() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArray/forInArrayWithArrayVarUpdatedInLoopBody13.kt"); + doTest(fileName); + } + + @TestMetadata("forInDelegatedPropertyUpdatedInLoopBody.kt") + public void testForInDelegatedPropertyUpdatedInLoopBody() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArray/forInDelegatedPropertyUpdatedInLoopBody.kt"); + doTest(fileName); + } + + @TestMetadata("forInFieldUpdatedInLoopBody.kt") + public void testForInFieldUpdatedInLoopBody() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArray/forInFieldUpdatedInLoopBody.kt"); + doTest(fileName); + } + + @TestMetadata("forIntArray.kt") + public void testForIntArray() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArray/forIntArray.kt"); + doTest(fileName); + } + + @TestMetadata("forNullableIntArray.kt") + public void testForNullableIntArray() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArray/forNullableIntArray.kt"); + doTest(fileName); + } + + @TestMetadata("forPrimitiveIntArray.kt") + public void testForPrimitiveIntArray() throws Exception { + String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/controlStructures/forInArray/forPrimitiveIntArray.kt"); + doTest(fileName); + } + } + @TestMetadata("compiler/testData/codegen/box/controlStructures/returnsNothing") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -15821,30 +15866,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { doTest(fileName); } - @TestMetadata("forInArrayWithArrayPropertyUpdatedInLoopBody.kt") - public void testForInArrayWithArrayPropertyUpdatedInLoopBody() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInArrayWithArrayPropertyUpdatedInLoopBody.kt"); - doTest(fileName); - } - - @TestMetadata("forInArrayWithArrayVarUpdatedInLoopBody12.kt") - public void testForInArrayWithArrayVarUpdatedInLoopBody12() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInArrayWithArrayVarUpdatedInLoopBody12.kt"); - try { - doTest(fileName); - } - catch (Throwable ignore) { - return; - } - throw new AssertionError("Looks like this test can be unmuted. Remove IGNORE_BACKEND directive for that."); - } - - @TestMetadata("forInArrayWithArrayVarUpdatedInLoopBody13.kt") - public void testForInArrayWithArrayVarUpdatedInLoopBody13() throws Exception { - String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInArrayWithArrayVarUpdatedInLoopBody13.kt"); - doTest(fileName); - } - @TestMetadata("forInRangeLiteralWithMixedTypeBounds.kt") public void testForInRangeLiteralWithMixedTypeBounds() throws Exception { String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/box/ranges/forInRangeLiteralWithMixedTypeBounds.kt");