From 1a21affe1de2cab142a1d85fdacce1ae8ec5df7f Mon Sep 17 00:00:00 2001 From: Dmitrii Gridin Date: Wed, 16 Aug 2023 17:10:53 +0200 Subject: [PATCH] [LL FIR] add test for 'for' on top level in script ^KT-61260 --- .../testdata/nonLocalDeclarationAnchors/topLevelFor.kts | 3 +++ .../testdata/nonLocalDeclarationAnchors/topLevelFor.txt | 4 ++++ .../fir/ScriptNonLocalDeclarationAnchorTestGenerated.java | 6 ++++++ 3 files changed, 13 insertions(+) create mode 100644 analysis/low-level-api-fir/testdata/nonLocalDeclarationAnchors/topLevelFor.kts create mode 100644 analysis/low-level-api-fir/testdata/nonLocalDeclarationAnchors/topLevelFor.txt diff --git a/analysis/low-level-api-fir/testdata/nonLocalDeclarationAnchors/topLevelFor.kts b/analysis/low-level-api-fir/testdata/nonLocalDeclarationAnchors/topLevelFor.kts new file mode 100644 index 00000000000..b3e350ea570 --- /dev/null +++ b/analysis/low-level-api-fir/testdata/nonLocalDeclarationAnchors/topLevelFor.kts @@ -0,0 +1,3 @@ +for ((index, _) in emptyList().withIndex()) { + +} diff --git a/analysis/low-level-api-fir/testdata/nonLocalDeclarationAnchors/topLevelFor.txt b/analysis/low-level-api-fir/testdata/nonLocalDeclarationAnchors/topLevelFor.txt new file mode 100644 index 00000000000..4b906e90aeb --- /dev/null +++ b/analysis/low-level-api-fir/testdata/nonLocalDeclarationAnchors/topLevelFor.txt @@ -0,0 +1,4 @@ +/* anchor --> */for (/* anchor --> */(index, _)/* <-- */ in emptyList().withIndex()) { + +} +/* <-- */ diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/ScriptNonLocalDeclarationAnchorTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/ScriptNonLocalDeclarationAnchorTestGenerated.java index 5a91caf7383..b618803268d 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/ScriptNonLocalDeclarationAnchorTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/ScriptNonLocalDeclarationAnchorTestGenerated.java @@ -41,4 +41,10 @@ public class ScriptNonLocalDeclarationAnchorTestGenerated extends AbstractScript public void testStatements() throws Exception { runTest("analysis/low-level-api-fir/testdata/nonLocalDeclarationAnchors/statements.kts"); } + + @Test + @TestMetadata("topLevelFor.kts") + public void testTopLevelFor() throws Exception { + runTest("analysis/low-level-api-fir/testdata/nonLocalDeclarationAnchors/topLevelFor.kts"); + } }