diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/declarationsInPropertyInit.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/declarationsInPropertyInit.kt new file mode 100644 index 00000000000..74956002a3a --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/declarationsInPropertyInit.kt @@ -0,0 +1,11 @@ +class A {/* NonReanalyzableDeclarationStructureElement */ + val a = run { + class X() + + val y = 10 + }/* NonReanalyzableDeclarationStructureElement */ +} + +inline fun run(block: () -> R): R {/* ReanalyzableFunctionStructureElement */ + return block() +} diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/enumClass.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/enumClass.kt new file mode 100644 index 00000000000..9d56482d170 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/enumClass.kt @@ -0,0 +1,13 @@ +enum class A {/* NonReanalyzableDeclarationStructureElement */ + X, + Y, + Z + + ; + + fun foo(){/* ReanalyzableFunctionStructureElement */} + + val x = 10/* NonReanalyzableDeclarationStructureElement */ + + fun bar() = 10/* NonReanalyzableDeclarationStructureElement */ +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/enumClassWithBody.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/enumClassWithBody.kt new file mode 100644 index 00000000000..0fcad0b00cb --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/enumClassWithBody.kt @@ -0,0 +1,13 @@ +enum class A {/* NonReanalyzableDeclarationStructureElement */ + X { + fun localInX() = 1 + }, + Y { + override fun foo() {} + }, + Z, + + ; + + open fun foo() {/* ReanalyzableFunctionStructureElement */} +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/initBlock.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/initBlock.kt new file mode 100644 index 00000000000..0e61f144c65 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/initBlock.kt @@ -0,0 +1,6 @@ +class A {/* NonReanalyzableDeclarationStructureElement */ + init { + val x = 10 + class B + } +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/propertyAccessors.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/propertyAccessors.kt new file mode 100644 index 00000000000..46d04abfcdc --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/propertyAccessors.kt @@ -0,0 +1,13 @@ +var x: Int = 10/* ReanalyzablePropertyStructureElement */ + get() = field + set(value) { + field = value + } + +class X {/* NonReanalyzableDeclarationStructureElement */ + var y: Int = 10/* ReanalyzablePropertyStructureElement */ + get() = field + set(value) { + field = value + } +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/typeAlias.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/typeAlias.kt new file mode 100644 index 00000000000..892ad16ba56 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/typeAlias.kt @@ -0,0 +1 @@ +typealias A = 10/* NonReanalyzableDeclarationStructureElement */ \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/AbstractFileStructureTest.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/AbstractFileStructureTest.kt index c130c2980fd..cf432a507d1 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/AbstractFileStructureTest.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/AbstractFileStructureTest.kt @@ -57,6 +57,9 @@ abstract class AbstractFileStructureTest : KotlinLightCodeInsightFixtureTestCase ktDeclaration.parent.addAfter(comment, ktDeclaration) } } + is KtTypeAlias -> { + ktDeclaration.addAfter(comment, ktDeclaration.getTypeReference()) + } else -> error("Unsupported declaration $ktDeclaration") } } diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureTestGenerated.java b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureTestGenerated.java index ad4960da0da..88ee06ba5f9 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureTestGenerated.java +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/file/structure/FileStructureTestGenerated.java @@ -39,6 +39,26 @@ public class FileStructureTestGenerated extends AbstractFileStructureTest { runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/classMemberProperty.kt"); } + @TestMetadata("declarationsInPropertyInit.kt") + public void testDeclarationsInPropertyInit() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/declarationsInPropertyInit.kt"); + } + + @TestMetadata("enumClass.kt") + public void testEnumClass() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/enumClass.kt"); + } + + @TestMetadata("enumClassWithBody.kt") + public void testEnumClassWithBody() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/enumClassWithBody.kt"); + } + + @TestMetadata("initBlock.kt") + public void testInitBlock() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/initBlock.kt"); + } + @TestMetadata("localClass.kt") public void testLocalClass() throws Exception { runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/localClass.kt"); @@ -59,6 +79,11 @@ public class FileStructureTestGenerated extends AbstractFileStructureTest { runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/nestedClasses.kt"); } + @TestMetadata("propertyAccessors.kt") + public void testPropertyAccessors() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/propertyAccessors.kt"); + } + @TestMetadata("topLevelExpressionBodyFunWithType.kt") public void testTopLevelExpressionBodyFunWithType() throws Exception { runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelExpressionBodyFunWithType.kt"); @@ -83,4 +108,9 @@ public class FileStructureTestGenerated extends AbstractFileStructureTest { public void testTopLevelUnitFun() throws Exception { runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/topLevelUnitFun.kt"); } + + @TestMetadata("typeAlias.kt") + public void testTypeAlias() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/fileStructure/typeAlias.kt"); + } }