diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/declarationsInPropertyInit.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/declarationsInPropertyInit.kt new file mode 100644 index 00000000000..da2bb45093c --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/declarationsInPropertyInit.kt @@ -0,0 +1,11 @@ +class A { + val a = run { + class X() + + val y = 10 + } +} + +inline fun run(block: () -> R): R { + return block() +} diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/enumClass.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/enumClass.kt new file mode 100644 index 00000000000..b99dbb7821e --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/enumClass.kt @@ -0,0 +1,13 @@ +enum class A { + X, + Y, + Z + + ; + + fun foo(){} + + val x = 10 + + fun bar() = 10 +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/enumClassWithBody.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/enumClassWithBody.kt new file mode 100644 index 00000000000..54f1ec2b39a --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/enumClassWithBody.kt @@ -0,0 +1,13 @@ +enum class A { + X { + fun localInX() = 1 + }, + Y { + override fun foo() {} + }, + Z, + + ; + + open fun foo() {} +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/initBlock.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/initBlock.kt new file mode 100644 index 00000000000..07c97eca54f --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/initBlock.kt @@ -0,0 +1,6 @@ +class A { + 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/diagnosticTraversalCounter/localDeclarationsInAccessor.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/localDeclarationsInAccessor.kt new file mode 100644 index 00000000000..38c74929bc4 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/localDeclarationsInAccessor.kt @@ -0,0 +1,32 @@ +class Outer { + val i: Int = 1 + get() { + class Inner { + var i: Int = 2 + get() { + field++ + return field + } + val j: Int = 3 + get() { + field = 42 + return field + } + + fun innerMember() { + field++ + } + } + return field + } + + val j: Int = 4 + get() { + fun local() { + field++ + field++ + } + local() + return field + } +} diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/memberTypeAlias.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/memberTypeAlias.kt new file mode 100644 index 00000000000..08dbb4268c9 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/memberTypeAlias.kt @@ -0,0 +1,3 @@ +class A { + typealias X = Int +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/nestedClasesWithFun.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/nestedClasesWithFun.kt new file mode 100644 index 00000000000..e41b4f8d32d --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/nestedClasesWithFun.kt @@ -0,0 +1,7 @@ +class A { + fun y() {} + + class B { + fun x() {} + } +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/propertyAccessors.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/propertyAccessors.kt new file mode 100644 index 00000000000..d23c2044635 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/propertyAccessors.kt @@ -0,0 +1,15 @@ +var x: Int = 10 + get() = field + set(value) { + println(1) + field = value + } + +class X { + var y: Int = 10 + get() = field + set(value) { + println(2) + field = value + } +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/typeAlias.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/typeAlias.kt new file mode 100644 index 00000000000..11f7fbd6d31 --- /dev/null +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/typeAlias.kt @@ -0,0 +1 @@ +typealias A = 10 \ 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/diagnostic/DiagnosticTraversalCounterTestGenerated.java b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/diagnostic/DiagnosticTraversalCounterTestGenerated.java index 0970f7b32e0..0642d704747 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/diagnostic/DiagnosticTraversalCounterTestGenerated.java +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/diagnostic/DiagnosticTraversalCounterTestGenerated.java @@ -34,11 +34,36 @@ public class DiagnosticTraversalCounterTestGenerated extends AbstractDiagnosticT runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/constructor.kt"); } + @TestMetadata("declarationsInPropertyInit.kt") + public void testDeclarationsInPropertyInit() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/declarationsInPropertyInit.kt"); + } + + @TestMetadata("enumClass.kt") + public void testEnumClass() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/enumClass.kt"); + } + + @TestMetadata("enumClassWithBody.kt") + public void testEnumClassWithBody() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/enumClassWithBody.kt"); + } + @TestMetadata("functionalType.kt") public void testFunctionalType() throws Exception { runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/functionalType.kt"); } + @TestMetadata("initBlock.kt") + public void testInitBlock() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/initBlock.kt"); + } + + @TestMetadata("localDeclarationsInAccessor.kt") + public void testLocalDeclarationsInAccessor() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/localDeclarationsInAccessor.kt"); + } + @TestMetadata("localFunctionWithImplicitType.kt") public void testLocalFunctionWithImplicitType() throws Exception { runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/localFunctionWithImplicitType.kt"); @@ -59,6 +84,11 @@ public class DiagnosticTraversalCounterTestGenerated extends AbstractDiagnosticT runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/memberProperties.kt"); } + @TestMetadata("memberTypeAlias.kt") + public void testMemberTypeAlias() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/memberTypeAlias.kt"); + } + @TestMetadata("multipleTopLevelClasses.kt") public void testMultipleTopLevelClasses() throws Exception { runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/multipleTopLevelClasses.kt"); @@ -79,6 +109,16 @@ public class DiagnosticTraversalCounterTestGenerated extends AbstractDiagnosticT runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/nestedClases.kt"); } + @TestMetadata("nestedClasesWithFun.kt") + public void testNestedClasesWithFun() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/nestedClasesWithFun.kt"); + } + + @TestMetadata("propertyAccessors.kt") + public void testPropertyAccessors() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/propertyAccessors.kt"); + } + @TestMetadata("propertyWithGetterAndSetter.kt") public void testPropertyWithGetterAndSetter() throws Exception { runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/propertyWithGetterAndSetter.kt"); @@ -88,4 +128,9 @@ public class DiagnosticTraversalCounterTestGenerated extends AbstractDiagnosticT public void testSecondaryConstructor() throws Exception { runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/secondaryConstructor.kt"); } + + @TestMetadata("typeAlias.kt") + public void testTypeAlias() throws Exception { + runTest("idea/idea-frontend-fir/idea-fir-low-level-api/testdata/diagnosticTraversalCounter/typeAlias.kt"); + } }