diff --git a/analysis/analysis-api-fe10/tests-gen/org/jetbrains/kotlin/analysis/api/fe10/test/cases/generated/cases/references/Fe10IdeNormalAnalysisSourceModuleReferenceResolveTestGenerated.java b/analysis/analysis-api-fe10/tests-gen/org/jetbrains/kotlin/analysis/api/fe10/test/cases/generated/cases/references/Fe10IdeNormalAnalysisSourceModuleReferenceResolveTestGenerated.java index 1542d1a90e9..1ba19847e7d 100644 --- a/analysis/analysis-api-fe10/tests-gen/org/jetbrains/kotlin/analysis/api/fe10/test/cases/generated/cases/references/Fe10IdeNormalAnalysisSourceModuleReferenceResolveTestGenerated.java +++ b/analysis/analysis-api-fe10/tests-gen/org/jetbrains/kotlin/analysis/api/fe10/test/cases/generated/cases/references/Fe10IdeNormalAnalysisSourceModuleReferenceResolveTestGenerated.java @@ -70,6 +70,12 @@ public class Fe10IdeNormalAnalysisSourceModuleReferenceResolveTestGenerated exte runTest("analysis/analysis-api/testData/referenceResolve/AnnotationOnFile.kt"); } + @Test + @TestMetadata("AnnotationOnFile2.kt") + public void testAnnotationOnFile2() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/AnnotationOnFile2.kt"); + } + @Test @TestMetadata("AnnotationOnFileWithImport.kt") public void testAnnotationOnFileWithImport() throws Exception { @@ -388,6 +394,30 @@ public class Fe10IdeNormalAnalysisSourceModuleReferenceResolveTestGenerated exte runTest("analysis/analysis-api/testData/referenceResolve/NotEqualsOperator.kt"); } + @Test + @TestMetadata("PackageFromAnnotationOnFile.kt") + public void testPackageFromAnnotationOnFile() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFile.kt"); + } + + @Test + @TestMetadata("PackageFromAnnotationOnFileWithUnresolvedReference.kt") + public void testPackageFromAnnotationOnFileWithUnresolvedReference() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFileWithUnresolvedReference.kt"); + } + + @Test + @TestMetadata("PackageFromAnnotationOnFunction.kt") + public void testPackageFromAnnotationOnFunction() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFunction.kt"); + } + + @Test + @TestMetadata("PackageFromAnnotationOnFunctionWithUnresolvedReference.kt") + public void testPackageFromAnnotationOnFunctionWithUnresolvedReference() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFunctionWithUnresolvedReference.kt"); + } + @Test @TestMetadata("PackageReference.kt") public void testPackageReference() throws Exception { @@ -769,12 +799,24 @@ public class Fe10IdeNormalAnalysisSourceModuleReferenceResolveTestGenerated exte runTest("analysis/analysis-api/testData/referenceResolve/danglingAnnotations/DanglingAnnotationsResolvedClass.kt"); } + @Test + @TestMetadata("DanglingAnnotationsResolvedFile.kt") + public void testDanglingAnnotationsResolvedFile() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/danglingAnnotations/DanglingAnnotationsResolvedFile.kt"); + } + @Test @TestMetadata("DanglingAnnotationsResolvedLocal.kt") public void testDanglingAnnotationsResolvedLocal() throws Exception { runTest("analysis/analysis-api/testData/referenceResolve/danglingAnnotations/DanglingAnnotationsResolvedLocal.kt"); } + @Test + @TestMetadata("DanglingAnnotationsResolvedPackageFile.kt") + public void testDanglingAnnotationsResolvedPackageFile() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/danglingAnnotations/DanglingAnnotationsResolvedPackageFile.kt"); + } + @Test @TestMetadata("DanglingAnnotationsResolvedTopLevel.kt") public void testDanglingAnnotationsResolvedTopLevel() throws Exception { diff --git a/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/references/FirIdeDependentAnalysisSourceModuleReferenceResolveTestGenerated.java b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/references/FirIdeDependentAnalysisSourceModuleReferenceResolveTestGenerated.java index 7b6fb24c1b9..78c1806d042 100644 --- a/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/references/FirIdeDependentAnalysisSourceModuleReferenceResolveTestGenerated.java +++ b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/references/FirIdeDependentAnalysisSourceModuleReferenceResolveTestGenerated.java @@ -70,6 +70,12 @@ public class FirIdeDependentAnalysisSourceModuleReferenceResolveTestGenerated ex runTest("analysis/analysis-api/testData/referenceResolve/AnnotationOnFile.kt"); } + @Test + @TestMetadata("AnnotationOnFile2.kt") + public void testAnnotationOnFile2() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/AnnotationOnFile2.kt"); + } + @Test @TestMetadata("AnnotationOnFileWithImport.kt") public void testAnnotationOnFileWithImport() throws Exception { @@ -388,6 +394,30 @@ public class FirIdeDependentAnalysisSourceModuleReferenceResolveTestGenerated ex runTest("analysis/analysis-api/testData/referenceResolve/NotEqualsOperator.kt"); } + @Test + @TestMetadata("PackageFromAnnotationOnFile.kt") + public void testPackageFromAnnotationOnFile() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFile.kt"); + } + + @Test + @TestMetadata("PackageFromAnnotationOnFileWithUnresolvedReference.kt") + public void testPackageFromAnnotationOnFileWithUnresolvedReference() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFileWithUnresolvedReference.kt"); + } + + @Test + @TestMetadata("PackageFromAnnotationOnFunction.kt") + public void testPackageFromAnnotationOnFunction() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFunction.kt"); + } + + @Test + @TestMetadata("PackageFromAnnotationOnFunctionWithUnresolvedReference.kt") + public void testPackageFromAnnotationOnFunctionWithUnresolvedReference() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFunctionWithUnresolvedReference.kt"); + } + @Test @TestMetadata("PackageReference.kt") public void testPackageReference() throws Exception { @@ -769,12 +799,24 @@ public class FirIdeDependentAnalysisSourceModuleReferenceResolveTestGenerated ex runTest("analysis/analysis-api/testData/referenceResolve/danglingAnnotations/DanglingAnnotationsResolvedClass.kt"); } + @Test + @TestMetadata("DanglingAnnotationsResolvedFile.kt") + public void testDanglingAnnotationsResolvedFile() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/danglingAnnotations/DanglingAnnotationsResolvedFile.kt"); + } + @Test @TestMetadata("DanglingAnnotationsResolvedLocal.kt") public void testDanglingAnnotationsResolvedLocal() throws Exception { runTest("analysis/analysis-api/testData/referenceResolve/danglingAnnotations/DanglingAnnotationsResolvedLocal.kt"); } + @Test + @TestMetadata("DanglingAnnotationsResolvedPackageFile.kt") + public void testDanglingAnnotationsResolvedPackageFile() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/danglingAnnotations/DanglingAnnotationsResolvedPackageFile.kt"); + } + @Test @TestMetadata("DanglingAnnotationsResolvedTopLevel.kt") public void testDanglingAnnotationsResolvedTopLevel() throws Exception { diff --git a/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/references/FirIdeNormalAnalysisLibrarySourceModuleReferenceResolveTestGenerated.java b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/references/FirIdeNormalAnalysisLibrarySourceModuleReferenceResolveTestGenerated.java index 4996ee9e196..54ac15807b2 100644 --- a/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/references/FirIdeNormalAnalysisLibrarySourceModuleReferenceResolveTestGenerated.java +++ b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/references/FirIdeNormalAnalysisLibrarySourceModuleReferenceResolveTestGenerated.java @@ -70,6 +70,12 @@ public class FirIdeNormalAnalysisLibrarySourceModuleReferenceResolveTestGenerate runTest("analysis/analysis-api/testData/referenceResolve/AnnotationOnFile.kt"); } + @Test + @TestMetadata("AnnotationOnFile2.kt") + public void testAnnotationOnFile2() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/AnnotationOnFile2.kt"); + } + @Test @TestMetadata("AnnotationOnFileWithImport.kt") public void testAnnotationOnFileWithImport() throws Exception { @@ -388,6 +394,30 @@ public class FirIdeNormalAnalysisLibrarySourceModuleReferenceResolveTestGenerate runTest("analysis/analysis-api/testData/referenceResolve/NotEqualsOperator.kt"); } + @Test + @TestMetadata("PackageFromAnnotationOnFile.kt") + public void testPackageFromAnnotationOnFile() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFile.kt"); + } + + @Test + @TestMetadata("PackageFromAnnotationOnFileWithUnresolvedReference.kt") + public void testPackageFromAnnotationOnFileWithUnresolvedReference() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFileWithUnresolvedReference.kt"); + } + + @Test + @TestMetadata("PackageFromAnnotationOnFunction.kt") + public void testPackageFromAnnotationOnFunction() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFunction.kt"); + } + + @Test + @TestMetadata("PackageFromAnnotationOnFunctionWithUnresolvedReference.kt") + public void testPackageFromAnnotationOnFunctionWithUnresolvedReference() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFunctionWithUnresolvedReference.kt"); + } + @Test @TestMetadata("PackageReference.kt") public void testPackageReference() throws Exception { @@ -741,12 +771,24 @@ public class FirIdeNormalAnalysisLibrarySourceModuleReferenceResolveTestGenerate runTest("analysis/analysis-api/testData/referenceResolve/danglingAnnotations/DanglingAnnotationsResolvedClass.kt"); } + @Test + @TestMetadata("DanglingAnnotationsResolvedFile.kt") + public void testDanglingAnnotationsResolvedFile() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/danglingAnnotations/DanglingAnnotationsResolvedFile.kt"); + } + @Test @TestMetadata("DanglingAnnotationsResolvedLocal.kt") public void testDanglingAnnotationsResolvedLocal() throws Exception { runTest("analysis/analysis-api/testData/referenceResolve/danglingAnnotations/DanglingAnnotationsResolvedLocal.kt"); } + @Test + @TestMetadata("DanglingAnnotationsResolvedPackageFile.kt") + public void testDanglingAnnotationsResolvedPackageFile() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/danglingAnnotations/DanglingAnnotationsResolvedPackageFile.kt"); + } + @Test @TestMetadata("DanglingAnnotationsResolvedTopLevel.kt") public void testDanglingAnnotationsResolvedTopLevel() throws Exception { diff --git a/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/references/FirIdeNormalAnalysisSourceModuleReferenceResolveTestGenerated.java b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/references/FirIdeNormalAnalysisSourceModuleReferenceResolveTestGenerated.java index 4305d1a8c0d..a7a1d2cb396 100644 --- a/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/references/FirIdeNormalAnalysisSourceModuleReferenceResolveTestGenerated.java +++ b/analysis/analysis-api-fir/tests-gen/org/jetbrains/kotlin/analysis/api/fir/test/cases/generated/cases/references/FirIdeNormalAnalysisSourceModuleReferenceResolveTestGenerated.java @@ -70,6 +70,12 @@ public class FirIdeNormalAnalysisSourceModuleReferenceResolveTestGenerated exten runTest("analysis/analysis-api/testData/referenceResolve/AnnotationOnFile.kt"); } + @Test + @TestMetadata("AnnotationOnFile2.kt") + public void testAnnotationOnFile2() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/AnnotationOnFile2.kt"); + } + @Test @TestMetadata("AnnotationOnFileWithImport.kt") public void testAnnotationOnFileWithImport() throws Exception { @@ -388,6 +394,30 @@ public class FirIdeNormalAnalysisSourceModuleReferenceResolveTestGenerated exten runTest("analysis/analysis-api/testData/referenceResolve/NotEqualsOperator.kt"); } + @Test + @TestMetadata("PackageFromAnnotationOnFile.kt") + public void testPackageFromAnnotationOnFile() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFile.kt"); + } + + @Test + @TestMetadata("PackageFromAnnotationOnFileWithUnresolvedReference.kt") + public void testPackageFromAnnotationOnFileWithUnresolvedReference() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFileWithUnresolvedReference.kt"); + } + + @Test + @TestMetadata("PackageFromAnnotationOnFunction.kt") + public void testPackageFromAnnotationOnFunction() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFunction.kt"); + } + + @Test + @TestMetadata("PackageFromAnnotationOnFunctionWithUnresolvedReference.kt") + public void testPackageFromAnnotationOnFunctionWithUnresolvedReference() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFunctionWithUnresolvedReference.kt"); + } + @Test @TestMetadata("PackageReference.kt") public void testPackageReference() throws Exception { @@ -769,12 +799,24 @@ public class FirIdeNormalAnalysisSourceModuleReferenceResolveTestGenerated exten runTest("analysis/analysis-api/testData/referenceResolve/danglingAnnotations/DanglingAnnotationsResolvedClass.kt"); } + @Test + @TestMetadata("DanglingAnnotationsResolvedFile.kt") + public void testDanglingAnnotationsResolvedFile() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/danglingAnnotations/DanglingAnnotationsResolvedFile.kt"); + } + @Test @TestMetadata("DanglingAnnotationsResolvedLocal.kt") public void testDanglingAnnotationsResolvedLocal() throws Exception { runTest("analysis/analysis-api/testData/referenceResolve/danglingAnnotations/DanglingAnnotationsResolvedLocal.kt"); } + @Test + @TestMetadata("DanglingAnnotationsResolvedPackageFile.kt") + public void testDanglingAnnotationsResolvedPackageFile() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/danglingAnnotations/DanglingAnnotationsResolvedPackageFile.kt"); + } + @Test @TestMetadata("DanglingAnnotationsResolvedTopLevel.kt") public void testDanglingAnnotationsResolvedTopLevel() throws Exception { diff --git a/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/references/FirStandaloneNormalAnalysisSourceModuleReferenceResolveTestGenerated.java b/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/references/FirStandaloneNormalAnalysisSourceModuleReferenceResolveTestGenerated.java index 74e96d82bb9..271ffaa0aa7 100644 --- a/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/references/FirStandaloneNormalAnalysisSourceModuleReferenceResolveTestGenerated.java +++ b/analysis/analysis-api-standalone/tests-gen/org/jetbrains/kotlin/analysis/api/standalone/fir/test/cases/generated/cases/references/FirStandaloneNormalAnalysisSourceModuleReferenceResolveTestGenerated.java @@ -70,6 +70,12 @@ public class FirStandaloneNormalAnalysisSourceModuleReferenceResolveTestGenerate runTest("analysis/analysis-api/testData/referenceResolve/AnnotationOnFile.kt"); } + @Test + @TestMetadata("AnnotationOnFile2.kt") + public void testAnnotationOnFile2() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/AnnotationOnFile2.kt"); + } + @Test @TestMetadata("AnnotationOnFileWithImport.kt") public void testAnnotationOnFileWithImport() throws Exception { @@ -388,6 +394,30 @@ public class FirStandaloneNormalAnalysisSourceModuleReferenceResolveTestGenerate runTest("analysis/analysis-api/testData/referenceResolve/NotEqualsOperator.kt"); } + @Test + @TestMetadata("PackageFromAnnotationOnFile.kt") + public void testPackageFromAnnotationOnFile() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFile.kt"); + } + + @Test + @TestMetadata("PackageFromAnnotationOnFileWithUnresolvedReference.kt") + public void testPackageFromAnnotationOnFileWithUnresolvedReference() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFileWithUnresolvedReference.kt"); + } + + @Test + @TestMetadata("PackageFromAnnotationOnFunction.kt") + public void testPackageFromAnnotationOnFunction() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFunction.kt"); + } + + @Test + @TestMetadata("PackageFromAnnotationOnFunctionWithUnresolvedReference.kt") + public void testPackageFromAnnotationOnFunctionWithUnresolvedReference() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFunctionWithUnresolvedReference.kt"); + } + @Test @TestMetadata("PackageReference.kt") public void testPackageReference() throws Exception { @@ -769,12 +799,24 @@ public class FirStandaloneNormalAnalysisSourceModuleReferenceResolveTestGenerate runTest("analysis/analysis-api/testData/referenceResolve/danglingAnnotations/DanglingAnnotationsResolvedClass.kt"); } + @Test + @TestMetadata("DanglingAnnotationsResolvedFile.kt") + public void testDanglingAnnotationsResolvedFile() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/danglingAnnotations/DanglingAnnotationsResolvedFile.kt"); + } + @Test @TestMetadata("DanglingAnnotationsResolvedLocal.kt") public void testDanglingAnnotationsResolvedLocal() throws Exception { runTest("analysis/analysis-api/testData/referenceResolve/danglingAnnotations/DanglingAnnotationsResolvedLocal.kt"); } + @Test + @TestMetadata("DanglingAnnotationsResolvedPackageFile.kt") + public void testDanglingAnnotationsResolvedPackageFile() throws Exception { + runTest("analysis/analysis-api/testData/referenceResolve/danglingAnnotations/DanglingAnnotationsResolvedPackageFile.kt"); + } + @Test @TestMetadata("DanglingAnnotationsResolvedTopLevel.kt") public void testDanglingAnnotationsResolvedTopLevel() throws Exception { diff --git a/analysis/analysis-api/testData/referenceResolve/AnnotationOnFile2.kt b/analysis/analysis-api/testData/referenceResolve/AnnotationOnFile2.kt new file mode 100644 index 00000000000..8833835afce --- /dev/null +++ b/analysis/analysis-api/testData/referenceResolve/AnnotationOnFile2.kt @@ -0,0 +1,4 @@ +@file:kotlin.Suppress("message") + +package foo + diff --git a/analysis/analysis-api/testData/referenceResolve/AnnotationOnFile2.txt b/analysis/analysis-api/testData/referenceResolve/AnnotationOnFile2.txt new file mode 100644 index 00000000000..b63dc256cd8 --- /dev/null +++ b/analysis/analysis-api/testData/referenceResolve/AnnotationOnFile2.txt @@ -0,0 +1,2 @@ +Resolved to: +0: (in kotlin.Suppress) constructor(vararg names: kotlin.String) diff --git a/analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFile.kt b/analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFile.kt new file mode 100644 index 00000000000..fed1c031c64 --- /dev/null +++ b/analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFile.kt @@ -0,0 +1,4 @@ +@file:kotlin.jvm.JvmName("Name") + +package foo + diff --git a/analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFile.txt b/analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFile.txt new file mode 100644 index 00000000000..6c2e5a4aa93 --- /dev/null +++ b/analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFile.txt @@ -0,0 +1,2 @@ +Resolved to: +0: package kotlin.jvm diff --git a/analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFileWithUnresolvedReference.kt b/analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFileWithUnresolvedReference.kt new file mode 100644 index 00000000000..78d06c80f32 --- /dev/null +++ b/analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFileWithUnresolvedReference.kt @@ -0,0 +1,5 @@ +@file:kotlin.jvm.JvmName23("Name") + +package foo + +// COMPILATION_ERRORS \ No newline at end of file diff --git a/analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFileWithUnresolvedReference.txt b/analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFileWithUnresolvedReference.txt new file mode 100644 index 00000000000..6c2e5a4aa93 --- /dev/null +++ b/analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFileWithUnresolvedReference.txt @@ -0,0 +1,2 @@ +Resolved to: +0: package kotlin.jvm diff --git a/analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFunction.kt b/analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFunction.kt new file mode 100644 index 00000000000..f9b363d759c --- /dev/null +++ b/analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFunction.kt @@ -0,0 +1,6 @@ +package foo + +@kotlin.jvm.JvmName("Name") +fun boo() { + +} \ No newline at end of file diff --git a/analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFunction.txt b/analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFunction.txt new file mode 100644 index 00000000000..6c2e5a4aa93 --- /dev/null +++ b/analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFunction.txt @@ -0,0 +1,2 @@ +Resolved to: +0: package kotlin.jvm diff --git a/analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFunctionWithUnresolvedReference.kt b/analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFunctionWithUnresolvedReference.kt new file mode 100644 index 00000000000..b2b0a2c2213 --- /dev/null +++ b/analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFunctionWithUnresolvedReference.kt @@ -0,0 +1,8 @@ +package foo + +@kotlin.jvm.JvmName2("Name") +fun boo() { + +} + +// COMPILATION_ERRORS \ No newline at end of file diff --git a/analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFunctionWithUnresolvedReference.txt b/analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFunctionWithUnresolvedReference.txt new file mode 100644 index 00000000000..6c2e5a4aa93 --- /dev/null +++ b/analysis/analysis-api/testData/referenceResolve/PackageFromAnnotationOnFunctionWithUnresolvedReference.txt @@ -0,0 +1,2 @@ +Resolved to: +0: package kotlin.jvm diff --git a/analysis/analysis-api/testData/referenceResolve/danglingAnnotations/DanglingAnnotationsResolvedFile.kt b/analysis/analysis-api/testData/referenceResolve/danglingAnnotations/DanglingAnnotationsResolvedFile.kt new file mode 100644 index 00000000000..df2ed343ed6 --- /dev/null +++ b/analysis/analysis-api/testData/referenceResolve/danglingAnnotations/DanglingAnnotationsResolvedFile.kt @@ -0,0 +1,2 @@ +// COMPILATION_ERRORS +@kotlin.jvm.JvmName("") diff --git a/analysis/analysis-api/testData/referenceResolve/danglingAnnotations/DanglingAnnotationsResolvedFile.txt b/analysis/analysis-api/testData/referenceResolve/danglingAnnotations/DanglingAnnotationsResolvedFile.txt new file mode 100644 index 00000000000..8beb496abd8 --- /dev/null +++ b/analysis/analysis-api/testData/referenceResolve/danglingAnnotations/DanglingAnnotationsResolvedFile.txt @@ -0,0 +1,2 @@ +Resolved to: +0: (in kotlin.jvm.JvmName) constructor(name: kotlin.String) diff --git a/analysis/analysis-api/testData/referenceResolve/danglingAnnotations/DanglingAnnotationsResolvedPackageFile.kt b/analysis/analysis-api/testData/referenceResolve/danglingAnnotations/DanglingAnnotationsResolvedPackageFile.kt new file mode 100644 index 00000000000..08e8c8c94ef --- /dev/null +++ b/analysis/analysis-api/testData/referenceResolve/danglingAnnotations/DanglingAnnotationsResolvedPackageFile.kt @@ -0,0 +1,2 @@ +// COMPILATION_ERRORS +@kotlin.jvm.JvmName("") diff --git a/analysis/analysis-api/testData/referenceResolve/danglingAnnotations/DanglingAnnotationsResolvedPackageFile.txt b/analysis/analysis-api/testData/referenceResolve/danglingAnnotations/DanglingAnnotationsResolvedPackageFile.txt new file mode 100644 index 00000000000..6c2e5a4aa93 --- /dev/null +++ b/analysis/analysis-api/testData/referenceResolve/danglingAnnotations/DanglingAnnotationsResolvedPackageFile.txt @@ -0,0 +1,2 @@ +Resolved to: +0: package kotlin.jvm diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/LLFirGlobalResolveComponents.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/LLFirGlobalResolveComponents.kt index cd0b1291968..4f39c9e6918 100644 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/LLFirGlobalResolveComponents.kt +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/LLFirGlobalResolveComponents.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.analysis.low.level.api.fir import com.intellij.openapi.project.Project import org.jetbrains.kotlin.analysis.low.level.api.fir.file.builder.LLFirLockProvider +import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.LLFirLazyResolveContractChecker internal class LLFirGlobalResolveComponents(val project: Project) { companion object { @@ -15,5 +16,6 @@ internal class LLFirGlobalResolveComponents(val project: Project) { } } - val lockProvider: LLFirLockProvider = LLFirLockProvider() + val checker: LLFirLazyResolveContractChecker = LLFirLazyResolveContractChecker() + val lockProvider: LLFirLockProvider = LLFirLockProvider(checker) } \ No newline at end of file diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/LLFirLazyDeclarationResolver.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/LLFirLazyDeclarationResolver.kt index c819d9aef8d..82f539fc716 100644 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/LLFirLazyDeclarationResolver.kt +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/LLFirLazyDeclarationResolver.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -34,6 +34,11 @@ internal class LLFirLazyDeclarationResolver : FirLazyDeclarationResolver() { val fir = symbol.fir as? FirRegularClass ?: return val session = fir.moduleData.session if (session !is LLFirResolvableModuleSession) return - // TODO: should be implemented in the context of KT-56543 + val moduleComponents = session.moduleComponents + moduleComponents.firModuleLazyDeclarationResolver.lazyResolveWithCallableMembers( + target = fir, + scopeSession = moduleComponents.scopeSessionProvider.getScopeSession(), + toPhase = toPhase, + ) } } diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/api/FirDesignation.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/api/FirDesignation.kt index 36a479d32da..b198c9fd99f 100644 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/api/FirDesignation.kt +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/api/FirDesignation.kt @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.analysis.low.level.api.fir.api import org.jetbrains.kotlin.analysis.low.level.api.fir.providers.nullableJavaSymbolProvider import org.jetbrains.kotlin.analysis.low.level.api.fir.sessions.LLFirLibraryOrLibrarySourceResolvableModuleSession import org.jetbrains.kotlin.analysis.low.level.api.fir.util.FirElementFinder +import org.jetbrains.kotlin.analysis.low.level.api.fir.util.containingClass import org.jetbrains.kotlin.analysis.low.level.api.fir.util.getContainingFile import org.jetbrains.kotlin.analysis.low.level.api.fir.util.withFirEntry import org.jetbrains.kotlin.analysis.utils.errors.buildErrorWithAttachment @@ -45,9 +46,6 @@ open class FirDesignation( val path: List, val target: FirElementWithResolveState, ) { - val firstNonFileDeclaration: FirElementWithResolveState - get() = path.firstOrNull() ?: target - fun toSequence(includeTarget: Boolean): Sequence = sequence { yieldAll(path) if (includeTarget) yield(target) @@ -96,6 +94,12 @@ private fun collectDesignationPath(target: FirElementWithResolveState): List { + val containingClassId = target.containingClass().symbol.classId + if (containingClassId.isLocal) return null + return collectDesignationPathWithContainingClass(target, containingClassId) + } + is FirErrorProperty -> { return if (target.diagnostic == ConeDestructuringDeclarationsOnTopLevel) emptyList() else null } diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/api/LowLevelFirApiFacadeForResolveOnAir.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/api/LowLevelFirApiFacadeForResolveOnAir.kt index 06229c4518e..86ee42b2072 100644 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/api/LowLevelFirApiFacadeForResolveOnAir.kt +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/api/LowLevelFirApiFacadeForResolveOnAir.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -8,7 +8,6 @@ package org.jetbrains.kotlin.analysis.low.level.api.fir.api import com.intellij.psi.PsiElement import com.intellij.psi.util.PsiTreeUtil import org.jetbrains.kotlin.analysis.low.level.api.fir.DeclarationCopyBuilder.withBodyFrom -import org.jetbrains.kotlin.analysis.low.level.api.fir.LLFirGlobalResolveComponents import org.jetbrains.kotlin.analysis.low.level.api.fir.LLFirResolveSessionDepended import org.jetbrains.kotlin.analysis.low.level.api.fir.element.builder.FileTowerProvider import org.jetbrains.kotlin.analysis.low.level.api.fir.element.builder.FirTowerContextProvider @@ -146,7 +145,11 @@ object LowLevelFirApiFacadeForResolveOnAir { val scopeSession = firResolveSession.getScopeSessionFor(session) firFile.lazyResolveToPhase(FirResolvePhase.IMPORTS) - val importingScopes = createImportingScopes(firFile, firFile.moduleData.session, scopeSession, useCaching = false) + return firFile.createTowerDataContext(scopeSession) + } + + private fun FirFile.createTowerDataContext(scopeSession: ScopeSession): FirTowerDataContext { + val importingScopes = createImportingScopes(this, moduleData.session, scopeSession, useCaching = false) val fileScopeElements = importingScopes.map { it.asTowerDataElement(isLocal = false) } return FirTowerDataContext().addNonLocalTowerDataElements(fileScopeElements) } @@ -195,6 +198,7 @@ object LowLevelFirApiFacadeForResolveOnAir { replacement: RawFirReplacement, firFile: FirFile, collector: FirTowerDataContextCollector? = null, + firResolveSession: LLFirResolvableResolveSession, ): FirAnnotation { val annotationCall = buildFileFirAnnotation( session = firFile.moduleData.session, @@ -211,14 +215,16 @@ object LowLevelFirApiFacadeForResolveOnAir { ?: buildErrorWithAttachment("FirFile session expected to be a resolvable session but was ${firFile.llFirSession::class.java}") { withEntry("firSession", firFile.llFirSession) { it.toString() } } - val declarationResolver = llFirResolvableSession.moduleComponents.firModuleLazyDeclarationResolver + val declarationResolver = llFirResolvableSession.moduleComponents.firModuleLazyDeclarationResolver declarationResolver.runLazyDesignatedOnAirResolveToBodyWithoutLock( FirDesignationWithFile(path = emptyList(), target = fileAnnotationsContainer, firFile), onAirCreatedDeclaration = true, collector ) + collector?.addFileContext(firFile, firFile.createTowerDataContext(firResolveSession.getScopeSessionFor(llFirResolvableSession))) + return annotationCall } @@ -240,6 +246,7 @@ object LowLevelFirApiFacadeForResolveOnAir { replacement = replacement, firFile = originalFirFile, collector = collector, + firResolveSession = firResolveSession, ) } else { error("Cannot find enclosing declaration for ${replacement.from.getElementTextInContext()}") @@ -247,9 +254,7 @@ object LowLevelFirApiFacadeForResolveOnAir { } val originalDeclaration = nonLocalDeclaration.getOrBuildFirOfType(firResolveSession) - val originalDesignation = originalDeclaration.collectDesignation() - val newDeclarationWithReplacement = RawFirNonLocalDeclarationBuilder.buildWithReplacement( session = originalDeclaration.moduleData.session, scopeProvider = originalDeclaration.moduleData.session.kotlinScopeProvider, @@ -259,41 +264,33 @@ object LowLevelFirApiFacadeForResolveOnAir { ) val isInBodyReplacement = isInBodyReplacement(nonLocalDeclaration, replacement) - - val globalResolveComponents = LLFirGlobalResolveComponents.getInstance(firResolveSession.project) - - return globalResolveComponents.lockProvider.withLock(originalFirFile) { - val copiedFirDeclaration = if (isInBodyReplacement) { - when (originalDeclaration) { - is FirSimpleFunction -> - originalDeclaration.withBodyFrom(newDeclarationWithReplacement as FirSimpleFunction) - is FirProperty -> - originalDeclaration.withBodyFrom(newDeclarationWithReplacement as FirProperty) - is FirRegularClass -> - originalDeclaration.withBodyFrom(newDeclarationWithReplacement as FirRegularClass) - is FirScript -> - originalDeclaration.withBodyFrom(newDeclarationWithReplacement as FirScript) - is FirTypeAlias -> newDeclarationWithReplacement - else -> error("Not supported type ${originalDeclaration::class.simpleName}") - } - } else newDeclarationWithReplacement - - val onAirDesignation = FirDesignationWithFile( - path = originalDesignation.path, - target = copiedFirDeclaration, - firFile = originalFirFile - ) - val resolvableSession = onAirDesignation.target.llFirResolvableSession - ?: error("Expected resolvable session") - resolvableSession.moduleComponents.firModuleLazyDeclarationResolver - .runLazyDesignatedOnAirResolveToBodyWithoutLock( - designation = onAirDesignation, - onAirCreatedDeclaration = onAirCreatedDeclaration, - towerDataContextCollector = collector, - ) - copiedFirDeclaration + val copiedFirDeclaration = if (isInBodyReplacement) { + when (originalDeclaration) { + is FirSimpleFunction -> originalDeclaration.withBodyFrom(newDeclarationWithReplacement as FirSimpleFunction) + is FirProperty -> originalDeclaration.withBodyFrom(newDeclarationWithReplacement as FirProperty) + is FirRegularClass -> originalDeclaration.withBodyFrom(newDeclarationWithReplacement as FirRegularClass) + is FirScript -> originalDeclaration.withBodyFrom(newDeclarationWithReplacement as FirScript) + is FirTypeAlias -> newDeclarationWithReplacement + else -> error("Not supported type ${originalDeclaration::class.simpleName}") + } + } else { + newDeclarationWithReplacement } + val onAirDesignation = FirDesignationWithFile( + path = originalDesignation.path, + target = copiedFirDeclaration, + firFile = originalFirFile + ) + + val resolvableSession = onAirDesignation.target.llFirResolvableSession ?: error("Expected resolvable session") + resolvableSession.moduleComponents.firModuleLazyDeclarationResolver.runLazyDesignatedOnAirResolveToBodyWithoutLock( + designation = onAirDesignation, + onAirCreatedDeclaration = onAirCreatedDeclaration, + towerDataContextCollector = collector, + ) + + return copiedFirDeclaration } private fun isInBodyReplacement(ktDeclaration: KtDeclaration, replacement: RawFirReplacement): Boolean { diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/api/targets/LLFirClassWithAllCallablesResolveTarget.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/api/targets/LLFirClassWithAllCallablesResolveTarget.kt new file mode 100644 index 00000000000..ecaf37ca9ca --- /dev/null +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/api/targets/LLFirClassWithAllCallablesResolveTarget.kt @@ -0,0 +1,35 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets + +import org.jetbrains.kotlin.fir.FirElementWithResolveState +import org.jetbrains.kotlin.fir.declarations.FirCallableDeclaration +import org.jetbrains.kotlin.fir.declarations.FirFile +import org.jetbrains.kotlin.fir.declarations.FirRegularClass + +/** + * [LLFirResolveTarget] representing a class with all callable members (functions and properties). + */ +class LLFirClassWithAllCallablesResolveTarget( + override val firFile: FirFile, + override val path: List, + val target: FirRegularClass, +) : LLFirResolveTarget() { + override fun forEachTarget(action: (FirElementWithResolveState) -> Unit) { + action(target) + forEachCallable(action) + } + + inline fun forEachCallable(action: (FirCallableDeclaration) -> Unit) { + for (member in target.declarations) { + if (member is FirCallableDeclaration) { + action(member) + } + } + } + + override fun toStringForTarget(): String = target.name.asString() +} diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/api/targets/LLFirClassWithAllMembersResolveTarget.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/api/targets/LLFirClassWithAllMembersResolveTarget.kt new file mode 100644 index 00000000000..308214c9950 --- /dev/null +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/api/targets/LLFirClassWithAllMembersResolveTarget.kt @@ -0,0 +1,31 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets + +import org.jetbrains.kotlin.fir.FirElementWithResolveState +import org.jetbrains.kotlin.fir.declarations.FirDeclaration +import org.jetbrains.kotlin.fir.declarations.FirFile +import org.jetbrains.kotlin.fir.declarations.FirRegularClass + +/** + * [LLFirResolveTarget] representing a class with all class members to be resolved (this includes callables, init blocks, and classifiers) + */ +class LLFirClassWithAllMembersResolveTarget( + override val firFile: FirFile, + override val path: List, + val target: FirRegularClass, +) : LLFirResolveTarget() { + override fun forEachTarget(action: (FirElementWithResolveState) -> Unit) { + action(target) + forEachMember(action) + } + + inline fun forEachMember(action: (FirDeclaration) -> Unit) { + target.declarations.forEach(action) + } + + override fun toStringForTarget(): String = target.name.asString() +} \ No newline at end of file diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/api/targets/LLFirClassWithSpecificMembersResolveTarget.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/api/targets/LLFirClassWithSpecificMembersResolveTarget.kt new file mode 100644 index 00000000000..208d58d6ae8 --- /dev/null +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/api/targets/LLFirClassWithSpecificMembersResolveTarget.kt @@ -0,0 +1,30 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets + +import org.jetbrains.kotlin.fir.FirElementWithResolveState +import org.jetbrains.kotlin.fir.declarations.FirDeclaration +import org.jetbrains.kotlin.fir.declarations.FirFile +import org.jetbrains.kotlin.fir.declarations.FirRegularClass + +class LLFirClassWithSpecificMembersResolveTarget( + override val firFile: FirFile, + override val path: List, + val target: FirRegularClass, + val members: List +) : LLFirResolveTarget() { + override fun forEachTarget(action: (FirElementWithResolveState) -> Unit) { + action(target) + forEachMember(action) + } + + fun forEachMember(action: (FirDeclaration) -> Unit) { + members.forEach(action) + } + + override fun toStringForTarget(): String = + members.joinToString(prefix = "[", postfix = "]") { it.symbol.toString() } +} diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/api/targets/LLFirResolveTarget.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/api/targets/LLFirResolveTarget.kt new file mode 100644 index 00000000000..4983a937084 --- /dev/null +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/api/targets/LLFirResolveTarget.kt @@ -0,0 +1,49 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets + +import org.jetbrains.kotlin.fir.FirElementWithResolveState +import org.jetbrains.kotlin.fir.declarations.FirFile +import org.jetbrains.kotlin.fir.declarations.FirRegularClass + + +/** + * Target to be lazily resolved by LL FIR lazy resolver. + * + * Specifies the path to the resolve targets and resolve targets themselves. + * Those targets are going to be resolved by [org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.LLFirModuleLazyDeclarationResolver] + */ +sealed class LLFirResolveTarget { + /** + * [FirFile] where the targets are located + */ + abstract val firFile: FirFile + + /** + * The list of [FirRegularClass] which are the required to go from file to target declarations in the top-down order. + * + * If resolve target is [FirRegularClass] itself, it's not included into the [path] + */ + abstract val path: List + + /** + * Executions the [action] for each target that this [LLFirResolveTarget] represents. + */ + abstract fun forEachTarget(action: (FirElementWithResolveState) -> Unit) + + override fun toString(): String = buildString { + append(this::class.simpleName) + append("(") + buildList { + add(firFile.name) + path.mapTo(this) { it.name.asString() } + add(toStringForTarget()) + }.joinTo(this, separator = " -> ") + append(")") + } + + protected abstract fun toStringForTarget(): String +} diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/api/targets/LLFirSingleResolveTarget.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/api/targets/LLFirSingleResolveTarget.kt new file mode 100644 index 00000000000..a995201db13 --- /dev/null +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/api/targets/LLFirSingleResolveTarget.kt @@ -0,0 +1,33 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets + +import org.jetbrains.kotlin.fir.FirElementWithResolveState +import org.jetbrains.kotlin.fir.FirFileAnnotationsContainer +import org.jetbrains.kotlin.fir.declarations.* + +/** + * [LLFirResolveTarget] representing single target to resolve. The [target] can be any of [FirElementWithResolveState] + */ +class LLFirSingleResolveTarget( + override val firFile: FirFile, + override val path: List, + val target: FirElementWithResolveState, +) : LLFirResolveTarget() { + + override fun forEachTarget(action: (FirElementWithResolveState) -> Unit) { + action(target) + } + + override fun toStringForTarget(): String = when (target) { + is FirConstructor -> "constructor" + is FirClassLikeDeclaration -> target.symbol.name.asString() + is FirCallableDeclaration -> target.symbol.name.asString() + is FirAnonymousInitializer -> ("") + is FirFileAnnotationsContainer -> "" + else -> "???" + } +} \ No newline at end of file diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/api/targets/LLFirWholeFileResolveTarget.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/api/targets/LLFirWholeFileResolveTarget.kt new file mode 100644 index 00000000000..ec6abf25767 --- /dev/null +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/api/targets/LLFirWholeFileResolveTarget.kt @@ -0,0 +1,39 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets + +import org.jetbrains.kotlin.fir.FirElementWithResolveState +import org.jetbrains.kotlin.fir.declarations.FirFile +import org.jetbrains.kotlin.fir.declarations.FirRegularClass + +/** + * [LLFirResolveTarget] representing all declarations in file. All of them are going to be resolved. + */ +class LLFirWholeFileResolveTarget( + override val firFile: FirFile, +) : LLFirResolveTarget() { + override val path: List get() = emptyList() + + override fun forEachTarget(action: (FirElementWithResolveState) -> Unit) { + fun goInside(target: FirElementWithResolveState) { + action(target) + if (target is FirRegularClass) { + target.declarations.forEach(::goInside) + } + } + forEachTopLevelDeclaration(::goInside) + } + + inline fun forEachTopLevelDeclaration(action: (FirElementWithResolveState) -> Unit) { + action(firFile.annotationsContainer) + + for (member in firFile.declarations) { + action(member) + } + } + + override fun toStringForTarget(): String = "*" +} diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/api/targets/targetUtils.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/api/targets/targetUtils.kt new file mode 100644 index 00000000000..080de45cf98 --- /dev/null +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/api/targets/targetUtils.kt @@ -0,0 +1,16 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets + +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.FirDesignationWithFile +import org.jetbrains.kotlin.fir.FirElementWithResolveState + +fun LLFirResolveTarget.forEachPathElementAndTarget(action: (FirElementWithResolveState) -> Unit) { + path.forEach(action) + forEachTarget(action) +} + +fun FirDesignationWithFile.asResolveTarget(): LLFirSingleResolveTarget = LLFirSingleResolveTarget(firFile, path, target) \ No newline at end of file diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostics/FileStructureElementDiagnosticRetriever.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostics/FileStructureElementDiagnosticRetriever.kt index 67435842310..ebf5d37fdda 100644 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostics/FileStructureElementDiagnosticRetriever.kt +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostics/FileStructureElementDiagnosticRetriever.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -12,9 +12,12 @@ import org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostics.fir.Persisten import org.jetbrains.kotlin.fir.FirElement import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContextForProvider import org.jetbrains.kotlin.fir.analysis.collectors.DiagnosticCollectorComponents -import org.jetbrains.kotlin.fir.declarations.* +import org.jetbrains.kotlin.fir.declarations.FirDeclaration +import org.jetbrains.kotlin.fir.declarations.FirFile +import org.jetbrains.kotlin.fir.declarations.FirRegularClass +import org.jetbrains.kotlin.fir.declarations.FirValueParameter +import org.jetbrains.kotlin.fir.declarations.impl.FirDefaultPropertyAccessor import org.jetbrains.kotlin.fir.resolve.SessionHolderImpl -import org.jetbrains.kotlin.name.StandardClassIds import org.jetbrains.kotlin.util.withSourceCodeAnalysisExceptionUnwrapping internal abstract class FileStructureElementDiagnosticRetriever { @@ -25,6 +28,49 @@ internal abstract class FileStructureElementDiagnosticRetriever { ): FileStructureElementDiagnosticList } +internal class ClassDiagnosticRetriever( + private val structureElementDeclaration: FirRegularClass +) : FileStructureElementDiagnosticRetriever() { + override fun retrieve( + firFile: FirFile, + collector: FileStructureElementDiagnosticsCollector, + moduleComponents: LLFirModuleResolveComponents, + ): FileStructureElementDiagnosticList { + val sessionHolder = SessionHolderImpl(moduleComponents.session, moduleComponents.scopeSessionProvider.getScopeSession()) + val context = PersistenceContextCollector.collectContext(sessionHolder, firFile, structureElementDeclaration) + return withSourceCodeAnalysisExceptionUnwrapping { + collector.collectForStructureElement(structureElementDeclaration) { components -> + Visitor(structureElementDeclaration, context, components) + } + } + } + + private class Visitor( + private val structureElementDeclaration: FirRegularClass, + context: CheckerContextForProvider, + components: DiagnosticCollectorComponents + ) : LLFirDiagnosticVisitor(context, components) { + + override fun shouldVisitDeclaration(declaration: FirDeclaration): Boolean { + return when { + declaration == structureElementDeclaration -> true + shouldDiagnosticsAlwaysBeCheckedOn(declaration) -> true + declaration is FirDefaultPropertyAccessor -> shouldVisitDeclaration(declaration.propertySymbol.fir) + declaration is FirValueParameter -> shouldVisitDeclaration(declaration.containingFunctionSymbol.fir) + else -> false + } + } + } + + companion object { + fun shouldDiagnosticsAlwaysBeCheckedOn(firElement: FirElement) = when (firElement.source?.kind) { + KtFakeSourceElementKind.PropertyFromParameter -> true + KtFakeSourceElementKind.ImplicitConstructor -> true + else -> false + } + } +} + internal class SingleNonLocalDeclarationDiagnosticRetriever( private val structureElementDeclaration: FirDeclaration ) : FileStructureElementDiagnosticRetriever() { @@ -34,66 +80,21 @@ internal class SingleNonLocalDeclarationDiagnosticRetriever( moduleComponents: LLFirModuleResolveComponents, ): FileStructureElementDiagnosticList { val sessionHolder = SessionHolderImpl(moduleComponents.session, moduleComponents.scopeSessionProvider.getScopeSession()) - val context = moduleComponents.globalResolveComponents.lockProvider.withLock(firFile) { - PersistenceContextCollector.collectContext(sessionHolder, firFile, structureElementDeclaration) - } + val context = PersistenceContextCollector.collectContext(sessionHolder, firFile, structureElementDeclaration) return withSourceCodeAnalysisExceptionUnwrapping { collector.collectForStructureElement(structureElementDeclaration) { components -> - Visitor(structureElementDeclaration, context, components) + Visitor(context, components) } } } private class Visitor( - private val structureElementDeclaration: FirDeclaration, context: CheckerContextForProvider, components: DiagnosticCollectorComponents ) : LLFirDiagnosticVisitor(context, components) { - private var insideAlwaysVisitableDeclarations = 0 override fun shouldVisitDeclaration(declaration: FirDeclaration): Boolean { - if (declaration.shouldVisitWithNestedDeclarations()) { - insideAlwaysVisitableDeclarations++ - } - - if (insideAlwaysVisitableDeclarations > 0) { - return true - } - - return when { - structureElementDeclaration !is FirRegularClass -> true - structureElementDeclaration == declaration -> true - declaration.hasAnnotation(StandardClassIds.Annotations.Suppress, context.session) -> { - useRegularComponents = false - true - } - else -> false - } - } - - private fun FirDeclaration.shouldVisitWithNestedDeclarations(): Boolean { - if (shouldDiagnosticsAlwaysBeCheckedOn(this)) return true - return when (this) { - is FirAnonymousInitializer -> true - is FirEnumEntry -> false - is FirValueParameter -> true - is FirConstructor -> isPrimary - else -> false - } - } - - override fun onDeclarationExit(declaration: FirDeclaration) { - if (declaration.shouldVisitWithNestedDeclarations()) { - insideAlwaysVisitableDeclarations-- - } - } - } - - companion object { - fun shouldDiagnosticsAlwaysBeCheckedOn(firElement: FirElement) = when (firElement.source?.kind) { - KtFakeSourceElementKind.PropertyFromParameter -> true - KtFakeSourceElementKind.ImplicitConstructor -> true - else -> false + return true } } } diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostics/LLFirDiagnosticVisitor.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostics/LLFirDiagnosticVisitor.kt index df997f756b4..556351bca76 100644 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostics/LLFirDiagnosticVisitor.kt +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostics/LLFirDiagnosticVisitor.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -11,6 +11,7 @@ import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContextForProvi import org.jetbrains.kotlin.fir.analysis.collectors.CheckerRunningDiagnosticCollectorVisitor import org.jetbrains.kotlin.fir.analysis.collectors.DiagnosticCollectorComponents import org.jetbrains.kotlin.fir.declarations.FirDeclaration +import org.jetbrains.kotlin.fir.declarations.FirRegularClass internal open class LLFirDiagnosticVisitor( context: CheckerContextForProvider, @@ -37,5 +38,21 @@ internal open class LLFirDiagnosticVisitor( } checkCanceled() element.accept(components.reportCommitter, context) + + if (element is FirRegularClass) { + suppressReportedDiagnosticsOnClassMembers(element) + } + } + + /** + * Some FirClassChecker may report diagnostics on class member headers. + * That diagnostics should be suppressed if we have a `@Suppress` annotation on class member. + */ + private fun suppressReportedDiagnosticsOnClassMembers(element: FirRegularClass) { + for (member in element.declarations) { + withAnnotationContainer(member) { + member.accept(components.reportCommitter, context) + } + } } } diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostics/fir/ContextCollectingDiagnosticCollectorVisitor.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostics/fir/ContextCollectingDiagnosticCollectorVisitor.kt index 1c3221320b5..9f25349140d 100644 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostics/fir/ContextCollectingDiagnosticCollectorVisitor.kt +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostics/fir/ContextCollectingDiagnosticCollectorVisitor.kt @@ -8,14 +8,17 @@ package org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostics.fir import org.jetbrains.kotlin.analysis.low.level.api.fir.ContextByDesignationCollector import org.jetbrains.kotlin.analysis.low.level.api.fir.api.FirDesignationWithFile import org.jetbrains.kotlin.analysis.low.level.api.fir.api.collectDesignation +import org.jetbrains.kotlin.analysis.low.level.api.fir.util.containingClass import org.jetbrains.kotlin.fir.FirElement import org.jetbrains.kotlin.fir.FirElementWithResolveState import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContextForProvider import org.jetbrains.kotlin.fir.analysis.collectors.AbstractDiagnosticCollectorVisitor import org.jetbrains.kotlin.fir.containingClass import org.jetbrains.kotlin.fir.declarations.* +import org.jetbrains.kotlin.fir.declarations.utils.classId import org.jetbrains.kotlin.fir.renderWithType import org.jetbrains.kotlin.fir.resolve.SessionHolder +import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase private class ContextCollectingDiagnosticCollectorVisitor private constructor( sessionHolder: SessionHolder, @@ -60,13 +63,20 @@ internal object PersistenceContextCollector { is FirClassLikeDeclaration -> declaration.symbol.classId.isLocal is FirCallableDeclaration -> declaration.symbol.callableId.isLocal is FirDanglingModifierList -> declaration.containingClass()?.classId?.isLocal == true + is FirAnonymousInitializer -> declaration.containingClass().classId.isLocal is FirScript -> false else -> error("Unsupported declaration ${declaration.renderWithType()}") } + require(!isLocal) { "Cannot collect context for local declaration ${declaration.renderWithType()}" } + val designation = declaration.collectDesignation(firFile) + designation.path.forEach { firClass -> + firClass.lazyResolveToPhase(FirResolvePhase.BODY_RESOLVE) + } + return ContextCollectingDiagnosticCollectorVisitor.collect(sessionHolder, designation) } } diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/element/builder/FirElementBuilder.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/element/builder/FirElementBuilder.kt index 75d9e1110ef..0e9b74524b5 100644 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/element/builder/FirElementBuilder.kt +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/element/builder/FirElementBuilder.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -116,6 +116,16 @@ internal fun PsiElement.getNonLocalContainingOrThisDeclaration(predicate: (KtDec when (parent) { is KtScript -> propose(parent) is KtDestructuringDeclaration -> propose(parent) + is KtAnonymousInitializer -> { + val container = parent.containingDeclaration + if (container is KtClassOrObject && + !container.isObjectLiteral() && + declarationCanBeLazilyResolved(container) && + predicate(parent) + ) { + propose(parent) + } + } is KtNamedDeclaration -> { val isKindApplicable = when (parent) { is KtClassOrObject -> !parent.isObjectLiteral() diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/file/builder/LLFirLockProvider.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/file/builder/LLFirLockProvider.kt index 381fa8d4b1e..730253e09ef 100644 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/file/builder/LLFirLockProvider.kt +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/file/builder/LLFirLockProvider.kt @@ -5,43 +5,176 @@ package org.jetbrains.kotlin.analysis.low.level.api.fir.file.builder -import com.intellij.util.containers.ContainerUtil +import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.LLFirLazyResolveContractChecker +import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkCanceled +import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkPhase +import org.jetbrains.kotlin.analysis.low.level.api.fir.util.lockWithPCECheck +import org.jetbrains.kotlin.fir.FirElementWithResolveState +import org.jetbrains.kotlin.fir.declarations.* +import java.util.concurrent.CountDownLatch +import java.util.concurrent.TimeUnit +import java.util.concurrent.atomic.AtomicReferenceFieldUpdater +import java.util.concurrent.locks.ReentrantLock import com.intellij.openapi.progress.ProcessCanceledException import org.jetbrains.kotlin.analysis.low.level.api.fir.sessions.llFirSession -import org.jetbrains.kotlin.analysis.low.level.api.fir.util.lockWithPCECheck import org.jetbrains.kotlin.fir.declarations.FirFile -import java.util.concurrent.locks.ReentrantLock /** * Keyed locks provider. */ -internal class LLFirLockProvider { - - //We temporarily disable multi-locks to fix deadlocks problem +internal class LLFirLockProvider(private val checker: LLFirLazyResolveContractChecker) { private val globalLock = ReentrantLock() - private val locksForImports = ContainerUtil.createConcurrentSoftMap() + private val superTypesLock = ReentrantLock() + private val implicitTypesLock = ReentrantLock() + private val statusLock = ReentrantLock() + private val compilerAnnotationsLock = ReentrantLock() - inline fun withLock( + inline fun withGlobalLock( key: FirFile, lockingIntervalMs: Long = DEFAULT_LOCKING_INTERVAL, action: () -> R - ): R { - return globalLock.lockWithPCECheck(lockingIntervalMs) { - val session = key.llFirSession - if (!session.isValid) { - throw ProcessCanceledException() - } + ): R = globalLock.lockWithPCECheck(lockingIntervalMs) { + val session = key.llFirSession + if (!session.isValid) { + throw ProcessCanceledException() + } + + action() + } + + fun withGlobalPhaseLock( + phase: FirResolvePhase, + action: () -> Unit + ) { + val lock = when (phase) { + FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE -> implicitTypesLock + FirResolvePhase.STATUS -> statusLock + FirResolvePhase.SUPER_TYPES -> superTypesLock + FirResolvePhase.COMPILER_REQUIRED_ANNOTATIONS -> compilerAnnotationsLock + else -> null + } + + if (lock == null) { action() + } else { + lock.lockWithPCECheck(DEFAULT_LOCKING_INTERVAL, action) } } - inline fun withLocksForImportResolution( - file: FirFile, - action: () -> R - ): R { - return locksForImports.getOrPut(file) { ReentrantLock() }.lockWithPCECheck(DEFAULT_LOCKING_INTERVAL) { action() } + inline fun withLock( + target: FirElementWithResolveState, + phase: FirResolvePhase, + action: () -> Unit + ) { + checker.lazyResolveToPhaseInside(phase) { + target.withCriticalSection(phase, action) + } + } + + inline fun withJumpingLock( + target: FirElementWithResolveState, + phase: FirResolvePhase, + action: () -> Unit + ) { + target.withCriticalSection(phase, action) + } + + /** + * Locks an a [FirElementWithResolveState] to resolve from `toPhase - 1` to [toPhase] and then updates the [FirElementWithResolveState.resolveState] to a [toPhase]. + * + * If [FirElementWithResolveState] is already at least at [toPhase], does nothing. + * + * Otherwise: + * - Marks [FirElementWithResolveState] as in a process of resovle + * - performs the resolve by calling [action] + * - updates the resolve phase to [toPhase] + * - notifies other threads waiting on the same lock that the declaration is already resolved by this thread, so other thread can continue its execution. + * + * + * Contention handling: + * - on lock acquisition, no real lock or barrier is created. Instead, the [FirElementWithResolveState.resolveState] is updated to indicate that the declaration is being resolved now. + * - If some other thread tries to resolve current [FirElementWithResolveState], it changes `resolveState` and puts the barrier there. Then it awaits on it until the initial thread which hold the lock finishes its job. + * - This way, no barrier is used in a case when no contention arise. + */ + private inline fun FirElementWithResolveState.withCriticalSection( + toPhase: FirResolvePhase, + action: () -> Unit + ) { + while (true) { + checkCanceled() + + @OptIn(ResolveStateAccess::class) + val stateSnapshot = resolveState + if (stateSnapshot.resolvePhase >= toPhase) { + // already resolved by some other thread + return + } + when (stateSnapshot) { + is FirInProcessOfResolvingToPhaseStateWithoutBarrier -> { + // some thread is resolving the phase, so we wait until it finishes + trySettingBarrier(toPhase, stateSnapshot) + continue + } + is FirInProcessOfResolvingToPhaseStateWithBarrier -> { + // some thread is waiting on a barrier as the declaration is beeing resovled, so we try too + if (!waitOnBarrier(stateSnapshot)) continue + checkPhase(toPhase) + return + } + is FirResolvedToPhaseState -> { + if (!tryLock(toPhase, stateSnapshot)) continue + try { + action() + } finally { + unlock(toPhase) + } + return + } + } + } + } + + private fun waitOnBarrier( + stateSnapshot: FirInProcessOfResolvingToPhaseStateWithBarrier + ): Boolean { + return stateSnapshot.barrier.await(DEFAULT_LOCKING_INTERVAL, TimeUnit.MILLISECONDS) + } + + private fun FirElementWithResolveState.trySettingBarrier( + toPhase: FirResolvePhase, + stateSnapshot: FirResolveState + ) { + val latch = CountDownLatch(1) + val newState = FirInProcessOfResolvingToPhaseStateWithBarrier(toPhase, latch) + resolveStateFieldUpdater.compareAndSet(this, stateSnapshot, newState) + } + + private fun FirElementWithResolveState.tryLock( + toPhase: FirResolvePhase, + stateSnapshot: FirResolveState + ): Boolean { + val newState = FirInProcessOfResolvingToPhaseStateWithoutBarrier(toPhase) + return resolveStateFieldUpdater.compareAndSet(this, stateSnapshot, newState) + } + + private fun FirElementWithResolveState.unlock(toPhase: FirResolvePhase) { + when (val stateSnapshotAfter = resolveStateFieldUpdater.getAndSet(this, FirResolvedToPhaseState(toPhase))) { + is FirInProcessOfResolvingToPhaseStateWithoutBarrier -> {} + is FirInProcessOfResolvingToPhaseStateWithBarrier -> { + stateSnapshotAfter.barrier.countDown() + } + is FirResolvedToPhaseState -> { + error("phase is unexpectedly unlocked $stateSnapshotAfter") + } + } } } +private val resolveStateFieldUpdater = AtomicReferenceFieldUpdater.newUpdater( + FirElementWithResolveState::class.java, + FirResolveState::class.java, + "resolveState" +) + private const val DEFAULT_LOCKING_INTERVAL = 50L \ No newline at end of file diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/file/structure/FileElementFactory.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/file/structure/FileElementFactory.kt index 29c895983f4..81a9287f1c6 100644 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/file/structure/FileElementFactory.kt +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/file/structure/FileElementFactory.kt @@ -1,18 +1,17 @@ /* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package org.jetbrains.kotlin.analysis.low.level.api.fir.file.structure +import org.jetbrains.kotlin.KtFakeSourceElementKind import org.jetbrains.kotlin.analysis.low.level.api.fir.LLFirModuleResolveComponents -import org.jetbrains.kotlin.fir.declarations.FirDeclaration -import org.jetbrains.kotlin.fir.declarations.FirFile -import org.jetbrains.kotlin.fir.declarations.FirProperty -import org.jetbrains.kotlin.fir.declarations.FirSimpleFunction -import org.jetbrains.kotlin.psi.KtDeclaration -import org.jetbrains.kotlin.psi.KtNamedFunction -import org.jetbrains.kotlin.psi.KtProperty +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.collectDesignationWithFile +import org.jetbrains.kotlin.fir.declarations.* +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets.LLFirClassWithSpecificMembersResolveTarget +import org.jetbrains.kotlin.fir.declarations.impl.FirPrimaryConstructor +import org.jetbrains.kotlin.psi.* internal object FileElementFactory { /** @@ -40,12 +39,58 @@ internal object FileElementFactory { moduleComponents, ) - else -> NonReanalyzableDeclarationStructureElement( - firFile, - firDeclaration, - ktDeclaration, - moduleComponents, + ktDeclaration is KtClassOrObject && ktDeclaration !is KtEnumEntry -> { + lazyResolveClassWithGeneratedMembers(firDeclaration as FirRegularClass, moduleComponents) + NonReanalyzableClassDeclarationStructureElement( + firFile, + firDeclaration, + ktDeclaration, + moduleComponents, + ) + } + + else -> { + NonReanalyzableNonClassDeclarationStructureElement( + firFile, + firDeclaration, + ktDeclaration, + moduleComponents, + ) + } + } + + private fun lazyResolveClassWithGeneratedMembers(firClass: FirRegularClass, moduleComponents: LLFirModuleResolveComponents) { + val classMembersToResolve = buildList { + for (member in firClass.declarations) { + when { + member is FirPrimaryConstructor && member.source?.kind == KtFakeSourceElementKind.ImplicitConstructor -> { + add(member) + } + + member is FirProperty && member.source?.kind == KtFakeSourceElementKind.PropertyFromParameter -> { + add(member) + } + + member is FirField && member.source?.kind == KtFakeSourceElementKind.ClassDelegationField -> { + add(member) + } + + member is FirDanglingModifierList -> { + add(member) + } + } + } + } + + val firClassDesignation = firClass.collectDesignationWithFile() + val designationWithMembers = LLFirClassWithSpecificMembersResolveTarget( + firClassDesignation.firFile, + firClassDesignation.path, + firClass, + classMembersToResolve, ) + + moduleComponents.firModuleLazyDeclarationResolver.lazyResolveTarget(designationWithMembers, FirResolvePhase.BODY_RESOLVE) } } diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/file/structure/FileStructure.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/file/structure/FileStructure.kt index fc34d9f618f..59878645169 100644 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/file/structure/FileStructure.kt +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/file/structure/FileStructure.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -15,6 +15,7 @@ import org.jetbrains.kotlin.analysis.low.level.api.fir.util.errorWithFirSpecific import org.jetbrains.kotlin.analysis.low.level.api.fir.util.findSourceByTraversingWholeTree import org.jetbrains.kotlin.analysis.low.level.api.fir.util.findSourceNonLocalFirDeclaration import org.jetbrains.kotlin.analysis.utils.printer.getElementTextInContext +import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget import org.jetbrains.kotlin.diagnostics.KtPsiDiagnostic import org.jetbrains.kotlin.fir.declarations.FirDanglingModifierList import org.jetbrains.kotlin.fir.declarations.FirFile @@ -22,6 +23,8 @@ import org.jetbrains.kotlin.fir.declarations.FirResolvePhase import org.jetbrains.kotlin.fir.resolve.providers.firProvider import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase import org.jetbrains.kotlin.psi.* +import org.jetbrains.kotlin.psi.psiUtil.containingClassOrObject +import org.jetbrains.kotlin.psi.psiUtil.isAncestor import java.util.concurrent.ConcurrentHashMap internal class FileStructure private constructor( @@ -44,7 +47,7 @@ internal class FileStructure private constructor( private val structureElements = ConcurrentHashMap() fun getStructureElementFor(element: KtElement): FileStructureElement { - val declaration = element.getNonLocalContainingOrThisDeclaration() + val declaration = getStructureKtElement(element) val container: KtElement if (declaration != null) { container = declaration @@ -52,11 +55,61 @@ internal class FileStructure private constructor( val modifierList = PsiTreeUtil.getParentOfType(element, KtModifierList::class.java, false) container = if (modifierList != null && modifierList.nextSibling is PsiErrorElement) { modifierList - } else element.containingKtFile + } else { + element.containingKtFile + } } + return getStructureElementForDeclaration(container) } + private fun getStructureKtElement(element: KtElement): KtDeclaration? { + val container = element.getNonLocalContainingOrThisDeclaration() + when { + container is KtClassOrObject && container.isInsideSuperClassCall(element) -> { + container.primaryConstructor?.let { return it } + } + + container is KtPrimaryConstructor && container.isInsideAnnotationOnParameter(element) -> { + container.containingClassOrObject?.let { return it } + } + } + + return container + } + + private fun KtClassOrObject.isInsideSuperClassCall(element: KtElement): Boolean { + for (entry in superTypeListEntries) { + if (entry is KtSuperTypeCallEntry && entry.isAncestor(element, strict = false)) return true + } + + return false + } + + private fun KtPrimaryConstructor.isInsideAnnotationOnParameter(element: KtElement): Boolean { + for (parameter in valueParameters) { + for (annotation in parameter.annotationEntries) { + val target = annotation.useSiteTarget?.getAnnotationUseSiteTarget() ?: continue + when (target) { + AnnotationUseSiteTarget.FIELD, + AnnotationUseSiteTarget.PROPERTY, + AnnotationUseSiteTarget.PROPERTY_GETTER, + AnnotationUseSiteTarget.PROPERTY_SETTER, + AnnotationUseSiteTarget.SETTER_PARAMETER -> { + if (annotation.isAncestor(element)) return true + } + AnnotationUseSiteTarget.FILE, + AnnotationUseSiteTarget.RECEIVER, + AnnotationUseSiteTarget.CONSTRUCTOR_PARAMETER, + AnnotationUseSiteTarget.PROPERTY_DELEGATE_FIELD -> { + } + } + } + } + + return false + } + private fun getStructureElementForDeclaration(declaration: KtElement): FileStructureElement { @Suppress("CANNOT_CHECK_FOR_ERASED") val structureElement = structureElements.compute(declaration) { _, structureElement -> @@ -123,6 +176,7 @@ internal class FileStructure private constructor( firProvider, firFile ) + firDeclaration.lazyResolveToPhase(FirResolvePhase.BODY_RESOLVE) return FileElementFactory.createFileStructureElement( firDeclaration = firDeclaration, @@ -133,8 +187,11 @@ internal class FileStructure private constructor( } private fun createDanglingModifierListStructure(container: KtElement): FileStructureElement { - val firDanglingModifierList = container.findSourceByTraversingWholeTree(moduleComponents.firFileBuilder, firFile) as? FirDanglingModifierList - ?: errorWithFirSpecificEntries("No dangling modifier found", psi = container) + val firDanglingModifierList = container.findSourceByTraversingWholeTree( + moduleComponents.firFileBuilder, + firFile, + ) as? FirDanglingModifierList ?: errorWithFirSpecificEntries("No dangling modifier found", psi = container) + firDanglingModifierList.lazyResolveToPhase(FirResolvePhase.BODY_RESOLVE) return DanglingTopLevelModifierListStructureElement(firFile, firDanglingModifierList, moduleComponents, container.containingKtFile) } @@ -142,6 +199,8 @@ internal class FileStructure private constructor( private fun createStructureElement(container: KtElement): FileStructureElement = when { container is KtFile -> { val firFile = moduleComponents.firFileBuilder.buildRawFirFileWithCaching(ktFile) + firFile.lazyResolveToPhase(FirResolvePhase.IMPORTS) + moduleComponents.firModuleLazyDeclarationResolver.lazyResolve( target = firFile.annotationsContainer, scopeSession = moduleComponents.scopeSessionProvider.getScopeSession(), diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/file/structure/FileStructureElement.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/file/structure/FileStructureElement.kt index ae919fe3cc3..7f0e99a50e8 100644 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/file/structure/FileStructureElement.kt +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/file/structure/FileStructureElement.kt @@ -6,19 +6,20 @@ package org.jetbrains.kotlin.analysis.low.level.api.fir.file.structure import com.intellij.psi.PsiElement +import org.jetbrains.kotlin.KtFakeSourceElementKind import org.jetbrains.kotlin.analysis.low.level.api.fir.LLFirModuleResolveComponents import org.jetbrains.kotlin.analysis.low.level.api.fir.api.LLFirResolveSession import org.jetbrains.kotlin.analysis.low.level.api.fir.api.LowLevelFirApiFacadeForResolveOnAir import org.jetbrains.kotlin.analysis.low.level.api.fir.api.collectDesignation +import org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostics.ClassDiagnosticRetriever import org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostics.FileDiagnosticRetriever import org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostics.FileStructureElementDiagnostics import org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostics.SingleNonLocalDeclarationDiagnosticRetriever import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.RawFirNonLocalDeclarationBuilder -import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.declarationCanBeLazilyResolved import org.jetbrains.kotlin.analysis.low.level.api.fir.util.withInvalidationOnException import org.jetbrains.kotlin.fir.FirElement import org.jetbrains.kotlin.fir.declarations.* -import org.jetbrains.kotlin.fir.psi +import org.jetbrains.kotlin.fir.declarations.impl.FirPrimaryConstructor import org.jetbrains.kotlin.fir.scopes.kotlinScopeProvider import org.jetbrains.kotlin.fir.symbols.FirBasedSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirFunctionSymbol @@ -116,7 +117,7 @@ internal class ReanalyzableFunctionStructureElement( rootNonLocalDeclaration = newKtDeclaration, ) as FirSimpleFunction - return moduleComponents.globalResolveComponents.lockProvider.withLock(firFile) { + return moduleComponents.globalResolveComponents.lockProvider.withGlobalLock(firFile) { val upgradedPhase = minOf(originalFunction.resolvePhase, FirResolvePhase.DECLARATIONS) withInvalidationOnException(moduleComponents.session) { @@ -166,7 +167,7 @@ internal class ReanalyzablePropertyStructureElement( rootNonLocalDeclaration = newKtDeclaration, ) as FirProperty - return moduleComponents.globalResolveComponents.lockProvider.withLock(firFile) { + return moduleComponents.globalResolveComponents.lockProvider.withGlobalLock(firFile) { val getterPhase = originalProperty.getter?.resolvePhase ?: originalProperty.resolvePhase val setterPhase = originalProperty.setter?.resolvePhase ?: originalProperty.resolvePhase val upgradedPhase = minOf(originalProperty.resolvePhase, getterPhase, setterPhase, FirResolvePhase.DECLARATIONS) @@ -197,13 +198,63 @@ internal class ReanalyzablePropertyStructureElement( } } -internal class NonReanalyzableDeclarationStructureElement( +internal sealed class NonReanalyzableDeclarationStructureElement( + firFile: FirFile, + moduleComponents: LLFirModuleResolveComponents, +) : FileStructureElement(firFile, moduleComponents) + +internal class NonReanalyzableClassDeclarationStructureElement( + firFile: FirFile, + val fir: FirRegularClass, + override val psi: KtClassOrObject, + moduleComponents: LLFirModuleResolveComponents, +) : NonReanalyzableDeclarationStructureElement(firFile, moduleComponents) { + + override val mappings = KtToFirMapping(fir, Recorder()) + + override val diagnostics = FileStructureElementDiagnostics( + firFile, + ClassDiagnosticRetriever(fir), + moduleComponents, + ) + + private inner class Recorder : FirElementsRecorder() { + override fun visitProperty(property: FirProperty, data: MutableMap) { + if (property.source?.kind == KtFakeSourceElementKind.PropertyFromParameter) { + super.visitProperty(property, data) + } + } + + override fun visitSimpleFunction(simpleFunction: FirSimpleFunction, data: MutableMap) { + } + + override fun visitConstructor(constructor: FirConstructor, data: MutableMap) { + if (constructor is FirPrimaryConstructor && constructor.source?.kind == KtFakeSourceElementKind.ImplicitConstructor) { + super.visitConstructor(constructor, data) + } + } + + override fun visitAnonymousInitializer(anonymousInitializer: FirAnonymousInitializer, data: MutableMap) { + } + + override fun visitRegularClass(regularClass: FirRegularClass, data: MutableMap) { + if (regularClass != fir) return + super.visitRegularClass(regularClass, data) + } + + override fun visitTypeAlias(typeAlias: FirTypeAlias, data: MutableMap) { + } + } +} + +internal class NonReanalyzableNonClassDeclarationStructureElement( firFile: FirFile, val fir: FirDeclaration, override val psi: KtDeclaration, moduleComponents: LLFirModuleResolveComponents, -) : FileStructureElement(firFile, moduleComponents) { - override val mappings = KtToFirMapping(fir, recorder) +) : NonReanalyzableDeclarationStructureElement(firFile, moduleComponents) { + + override val mappings = KtToFirMapping(fir, Recorder) override val diagnostics = FileStructureElementDiagnostics( firFile, @@ -211,24 +262,7 @@ internal class NonReanalyzableDeclarationStructureElement( moduleComponents, ) - - companion object { - private val recorder = object : FirElementsRecorder() { - override fun visitProperty(property: FirProperty, data: MutableMap) { - val psi = property.psi as? KtProperty ?: return super.visitProperty(property, data) - if (!isReanalyzableContainer(psi) || !declarationCanBeLazilyResolved(psi)) { - super.visitProperty(property, data) - } - } - - override fun visitSimpleFunction(simpleFunction: FirSimpleFunction, data: MutableMap) { - val psi = simpleFunction.psi as? KtNamedFunction ?: return super.visitSimpleFunction(simpleFunction, data) - if (!isReanalyzableContainer(psi) || !declarationCanBeLazilyResolved(psi)) { - super.visitSimpleFunction(simpleFunction, data) - } - } - } - } + private object Recorder : FirElementsRecorder() } internal class DanglingTopLevelModifierListStructureElement( diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/lazy/resolve/LLFirLazyResolveContractChecker.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/lazy/resolve/LLFirLazyResolveContractChecker.kt new file mode 100644 index 00000000000..a66db546f46 --- /dev/null +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/lazy/resolve/LLFirLazyResolveContractChecker.kt @@ -0,0 +1,37 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve + +import org.jetbrains.kotlin.fir.declarations.FirResolvePhase + +internal class LLFirLazyResolveContractChecker { + private val currentTransformerPhase = ThreadLocal.withInitial { null } + + inline fun lazyResolveToPhaseInside(phase: FirResolvePhase, resolve: () -> Unit) { + if (currentTransformerPhase.get() == FirResolvePhase.COMPILER_REQUIRED_ANNOTATIONS) return + checkIfCanLazyResolveToPhase(phase) + val previousPhase = currentTransformerPhase.get() + currentTransformerPhase.set(phase) + try { + resolve() + } finally { + currentTransformerPhase.set(previousPhase) + } + } + + private fun checkIfCanLazyResolveToPhase(requestedPhase: FirResolvePhase) { + val currentPhase = currentTransformerPhase.get() ?: return + + if (requestedPhase >= currentPhase) { + error( + """`lazyResolveToPhase($requestedPhase)` cannot be called from a transformer with a phase $currentPhase. + `lazyResolveToPhase` can be called only from a transformer with a phase which is strictly greater than a requested phase; + i.e., `lazyResolveToPhase(A)` may be only called from a lazy transformer with a phase B, where A < B. This is a contract of lazy resolve""".trimIndent() + ) + } + } +} + diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/lazy/resolve/LLFirModuleLazyDeclarationResolver.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/lazy/resolve/LLFirModuleLazyDeclarationResolver.kt index f961a92abba..408b6bbfad3 100644 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/lazy/resolve/LLFirModuleLazyDeclarationResolver.kt +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/lazy/resolve/LLFirModuleLazyDeclarationResolver.kt @@ -7,11 +7,13 @@ package org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve import org.jetbrains.kotlin.analysis.low.level.api.fir.LLFirModuleResolveComponents import org.jetbrains.kotlin.analysis.low.level.api.fir.api.FirDesignationWithFile -import org.jetbrains.kotlin.analysis.low.level.api.fir.api.throwUnexpectedFirElementError -import org.jetbrains.kotlin.analysis.low.level.api.fir.api.tryCollectDesignationWithFile +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets.LLFirClassWithAllMembersResolveTarget +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets.LLFirResolveTarget +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets.LLFirSingleResolveTarget +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets.forEachPathElementAndTarget import org.jetbrains.kotlin.analysis.low.level.api.fir.project.structure.llFirModuleData import org.jetbrains.kotlin.analysis.low.level.api.fir.sessions.llFirSession -import org.jetbrains.kotlin.analysis.low.level.api.fir.transformers.LLFirLazyTransformerExecutor +import org.jetbrains.kotlin.analysis.low.level.api.fir.transformers.LLFirLazyResolverRunner import org.jetbrains.kotlin.analysis.low.level.api.fir.transformers.withOnAirDesignation import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkCanceled import org.jetbrains.kotlin.analysis.low.level.api.fir.util.getContainingFile @@ -19,73 +21,24 @@ import org.jetbrains.kotlin.analysis.low.level.api.fir.util.withFirEntry import org.jetbrains.kotlin.analysis.utils.errors.rethrowExceptionWithDetails import org.jetbrains.kotlin.fir.FirElement import org.jetbrains.kotlin.fir.FirElementWithResolveState -import org.jetbrains.kotlin.fir.FirFileAnnotationsContainer -import org.jetbrains.kotlin.fir.declarations.* -import org.jetbrains.kotlin.fir.declarations.synthetic.FirSyntheticProperty -import org.jetbrains.kotlin.fir.declarations.synthetic.FirSyntheticPropertyAccessor +import org.jetbrains.kotlin.fir.declarations.FirDeclaration +import org.jetbrains.kotlin.fir.declarations.FirFile +import org.jetbrains.kotlin.fir.declarations.FirRegularClass +import org.jetbrains.kotlin.fir.declarations.FirResolvePhase +import org.jetbrains.kotlin.fir.declarations.resolvePhase import org.jetbrains.kotlin.fir.resolve.ScopeSession import org.jetbrains.kotlin.fir.resolve.transformers.FirImportResolveTransformer import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirTowerDataContextCollector internal class LLFirModuleLazyDeclarationResolver(val moduleComponents: LLFirModuleResolveComponents) { - - private fun FirDeclaration.isValidForResolve(): Boolean = when (origin) { - is FirDeclarationOrigin.Source, - is FirDeclarationOrigin.ImportedFromObjectOrStatic, - is FirDeclarationOrigin.Delegated, - is FirDeclarationOrigin.Synthetic, - is FirDeclarationOrigin.SubstitutionOverride, - is FirDeclarationOrigin.SamConstructor, - is FirDeclarationOrigin.IntersectionOverride -> { - when (this) { - is FirFile -> true - is FirSyntheticProperty -> false - is FirSyntheticPropertyAccessor -> false - is FirSimpleFunction, - is FirProperty, - is FirPropertyAccessor, - is FirField, - is FirTypeAlias, - is FirConstructor -> resolvePhase < FirResolvePhase.BODY_RESOLVE - else -> true - } - } - else -> { - check(resolvePhase == FirResolvePhase.BODY_RESOLVE) { - "Expected body resolve phase for origin $origin but found $resolvePhase" - } - false - } - } - - private fun FirElementWithResolveState.isValidForResolve() = when (this) { - is FirDeclaration -> isValidForResolve() - is FirFileAnnotationsContainer -> true - else -> throwUnexpectedFirElementError(this) - } - - private fun resolveContainingFileToImports(target: FirElementWithResolveState) { - if (target.resolvePhase >= FirResolvePhase.IMPORTS) return - val firFile = target.getContainingFile() ?: return - if (firFile.resolvePhase >= FirResolvePhase.IMPORTS) return - moduleComponents.globalResolveComponents.lockProvider.withLocksForImportResolution(firFile) { - resolveFileToImportsWithoutLock(firFile) - } - } - - private fun resolveFileToImportsWithoutLock(firFile: FirFile) { - if (firFile.resolvePhase >= FirResolvePhase.IMPORTS) return - checkCanceled() - firFile.transform(FirImportResolveTransformer(firFile.moduleData.session), null) - @OptIn(ResolveStateAccess::class) - firFile.resolveState = FirResolvePhase.IMPORTS.asResolveState() - } - /** - * Run designated resolve only designation with fully resolved path (synchronized). + * Lazily resolves the [target] to a given [toPhase]. + * + * Might resolve additional required declarations. + * + * Resolution is performed under the lock specific to each declaration which is going to be resolved. + * * Suitable for body resolve or/and on-air resolve. - * @see lazyResolve for ordinary resolve - * @param target target non-local declaration */ fun lazyResolve( target: FirElementWithResolveState, @@ -93,77 +46,68 @@ internal class LLFirModuleLazyDeclarationResolver(val moduleComponents: LLFirMod toPhase: FirResolvePhase, ) { val fromPhase = target.resolvePhase + if (fromPhase >= toPhase) return try { - doLazyResolve(target, scopeSession, toPhase) + resolveContainingFileToImports(target) + if (toPhase == FirResolvePhase.IMPORTS) return + + lazyResolveTargets( + targets = LLFirResolveMultiDesignationCollector.getDesignationsToResolve(target), + scopeSession = scopeSession, + toPhase = toPhase, + ) } catch (e: Exception) { handleExceptionFromResolve(e, target, fromPhase, toPhase) } } - private fun doLazyResolve( - target: FirElementWithResolveState, + /** + * Lazily resolves the [target] with all callable members to a given [toPhase]. + * + * Might resolve additional required declarations. + * + * Resolution is performed under the lock specific to each declaration which is going to be resolved. + * + * Suitable for body resolve or/and on-air resolve. + */ + fun lazyResolveWithCallableMembers( + target: FirRegularClass, scopeSession: ScopeSession, toPhase: FirResolvePhase, ) { - if (target.resolvePhase >= toPhase) return - resolveContainingFileToImports(target) - if (toPhase == FirResolvePhase.IMPORTS) return + val fromPhase = target.resolvePhase + try { + resolveContainingFileToImports(target) + if (toPhase == FirResolvePhase.IMPORTS) return - for (designation in declarationDesignationsToResolve(target)) { - if (!designation.target.isValidForResolve()) continue - if (designation.target.resolvePhase >= toPhase) continue - moduleComponents.globalResolveComponents.lockProvider.withLock(designation.firFile) { - runLazyDesignatedResolveWithoutLock( - designation = designation, - scopeSession = scopeSession, - toPhase = toPhase, - ) - } - } - } - - private fun declarationDesignationsToResolve(target: FirElementWithResolveState): List { - return when (target) { - is FirPropertyAccessor -> declarationDesignationsToResolve(target.propertySymbol.fir) - is FirBackingField -> declarationDesignationsToResolve(target.propertySymbol.fir) - is FirTypeParameter -> declarationDesignationsToResolve(target.containingDeclarationSymbol.fir) - is FirValueParameter -> declarationDesignationsToResolve(target.containingFunctionSymbol.fir) - is FirFile -> { - val validForResolveDeclarations = buildList { - add(target.annotationsContainer) - target.declarations.filterTo(this) { it.isValidForResolve() } - } - - validForResolveDeclarations.map { - FirDesignationWithFile(path = emptyList(), target = it, firFile = target) - } - } - else -> listOfNotNull(target.tryCollectDesignationWithFile()) - } - } - - - private fun runLazyDesignatedResolveWithoutLock( - designation: FirDesignationWithFile, - scopeSession: ScopeSession, - toPhase: FirResolvePhase, - ) { - val declarationResolvePhase = designation.target.resolvePhase - if (declarationResolvePhase >= toPhase) return - - var currentPhase = maxOf(declarationResolvePhase, FirResolvePhase.IMPORTS) - - while (currentPhase < toPhase) { - currentPhase = currentPhase.next - checkCanceled() - - LLFirLazyTransformerExecutor.execute( - phase = currentPhase, - designation = designation, + lazyResolveTargets( + targets = LLFirResolveMultiDesignationCollector.getDesignationsToResolveWithCallableMembers(target), scopeSession = scopeSession, - lockProvider = moduleComponents.globalResolveComponents.lockProvider, - towerDataContextCollector = null + toPhase = toPhase, ) + } catch (e: Exception) { + handleExceptionFromResolve(e, target, fromPhase, toPhase) + } + } + + + /** + * Lazily resolves all the declarations which are specified for resolve by [target] + * + * Might resolve additional required declarations. + * + * Resolution is performed under the lock specific to each declaration which is going to be resolved. + * + * Suitable for body resolve or/and on-air resolve. + */ + fun lazyResolveTarget( + target: LLFirResolveTarget, + toPhase: FirResolvePhase + ) { + try { + lazyResolveTargets(listOf(target), moduleComponents.scopeSessionProvider.getScopeSession(), toPhase) + } catch (e: Exception) { + handleExceptionFromResolve(e, target, toPhase) } } @@ -173,6 +117,10 @@ internal class LLFirModuleLazyDeclarationResolver(val moduleComponents: LLFirMod towerDataContextCollector: FirTowerDataContextCollector?, ) { resolveFileToImportsWithoutLock(designation.firFile) + val resolveTarget = when (designation.target) { + is FirRegularClass -> LLFirClassWithAllMembersResolveTarget(designation.firFile, designation.path, designation.target) + else -> LLFirSingleResolveTarget(designation.firFile, designation.path, designation.target) + } fun runTransformation() { val scopeSession = ScopeSession() @@ -182,9 +130,9 @@ internal class LLFirModuleLazyDeclarationResolver(val moduleComponents: LLFirMod currentPhase = currentPhase.next checkCanceled() - LLFirLazyTransformerExecutor.execute( + LLFirLazyResolverRunner.runLazyResolverByPhase( phase = currentPhase, - designation = designation, + target = resolveTarget, scopeSession = scopeSession, lockProvider = moduleComponents.globalResolveComponents.lockProvider, towerDataContextCollector = towerDataContextCollector, @@ -198,6 +146,58 @@ internal class LLFirModuleLazyDeclarationResolver(val moduleComponents: LLFirMod runTransformation() } } + + private fun resolveContainingFileToImports(target: FirElementWithResolveState) { + if (target.resolvePhase >= FirResolvePhase.IMPORTS) return + val firFile = target.getContainingFile() ?: return + if (firFile.resolvePhase >= FirResolvePhase.IMPORTS) return + moduleComponents.globalResolveComponents.lockProvider.withLock(firFile, FirResolvePhase.IMPORTS) { + resolveFileToImportsWithoutLock(firFile) + } + } + + private fun resolveFileToImportsWithoutLock(firFile: FirFile) { + if (firFile.resolvePhase >= FirResolvePhase.IMPORTS) return + checkCanceled() + firFile.transform(FirImportResolveTransformer(firFile.moduleData.session), null) + } + + private fun lazyResolveTargets( + targets: List, + scopeSession: ScopeSession, + toPhase: FirResolvePhase, + ) { + if (targets.isEmpty()) return + var currentPhase = getMinResolvePhase(targets).coerceAtLeast(FirResolvePhase.IMPORTS) + if (currentPhase >= toPhase) return + + while (currentPhase < toPhase) { + currentPhase = currentPhase.next + checkCanceled() + + for (target in targets) { + LLFirLazyResolverRunner.runLazyResolverByPhase( + phase = currentPhase, + target = target, + scopeSession = scopeSession, + lockProvider = moduleComponents.globalResolveComponents.lockProvider, + towerDataContextCollector = null + ) + } + } + } + + private fun getMinResolvePhase(designations: List): FirResolvePhase { + var min = FirResolvePhase.BODY_RESOLVE + for (designation in designations) { + if (min == FirResolvePhase.RAW_FIR) break + designation.forEachPathElementAndTarget { target -> + min = minOf(min, target.resolvePhase) + } + } + + return min + } } private fun handleExceptionFromResolve( @@ -226,4 +226,29 @@ private fun handleExceptionFromResolve( withEntry("moduleData", firDeclarationToResolve.moduleData) { it.toString() } withFirEntry("firDeclarationToResolve", firDeclarationToResolve) } +} + +private fun handleExceptionFromResolve( + exception: Exception, + designation: LLFirResolveTarget, + toPhase: FirResolvePhase? +): Nothing { + val llFirSession = designation.firFile.llFirSession + llFirSession.invalidate() + val moduleData = llFirSession.llFirModuleData + rethrowExceptionWithDetails( + buildString { + appendLine("Error while resolving ${designation::class.java.name} ") + appendLine("to $toPhase") + appendLine("module data: ${moduleData::class}") + appendLine("KtModule: ${moduleData.ktModule::class}") + appendLine("platform: ${moduleData.ktModule.platform}") + }, + exception = exception, + ) { + withEntry("KtModule", moduleData.ktModule) { it.moduleDescription } + withEntry("session", designation.firFile.llFirSession) { it.toString() } + withEntry("moduleData", moduleData) { it.toString() } + withEntry("firDesignationToResolve", designation) { it.toString() } + } } \ No newline at end of file diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/lazy/resolve/LLFirPhaseUpdater.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/lazy/resolve/LLFirPhaseUpdater.kt index f93821c5206..80886e0a806 100644 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/lazy/resolve/LLFirPhaseUpdater.kt +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/lazy/resolve/LLFirPhaseUpdater.kt @@ -17,10 +17,18 @@ internal object LLFirPhaseUpdater { newPhase: FirResolvePhase, updateForLocalDeclarations: Boolean, ) { - if (updateForLocalDeclarations) { - target.acceptChildren(PhaseUpdatingTransformer, newPhase) - } else { - updatePhaseForNonLocals(target, newPhase, isTargetDeclaration = true) + updatePhaseForNonLocals(target, newPhase, isTargetDeclaration = true) + + if (updateForLocalDeclarations && target is FirCallableDeclaration) { + when (target) { + is FirFunction -> target.body?.accept(PhaseUpdatingTransformer, newPhase) + is FirVariable -> { + target.initializer?.accept(PhaseUpdatingTransformer, newPhase) + target.getter?.body?.accept(PhaseUpdatingTransformer, newPhase) + target.setter?.body?.accept(PhaseUpdatingTransformer, newPhase) + target.backingField?.accept(PhaseUpdatingTransformer, newPhase) + } + } } } @@ -29,7 +37,8 @@ internal object LLFirPhaseUpdater { if (element.resolvePhase >= newPhase) return if (!isTargetDeclaration) { // phase update for target declaration happens as a declaration publication event after resolve is finished - element.replaceResolveState(newPhase.asResolveState()) + @OptIn(ResolveStateAccess::class) + element.resolveState = newPhase.asResolveState() } if (element is FirTypeParameterRefsOwner) { @@ -48,13 +57,9 @@ internal object LLFirPhaseUpdater { is FirProperty -> { element.getter?.let { updatePhaseForNonLocals(it, newPhase, isTargetDeclaration = false) } element.setter?.let { updatePhaseForNonLocals(it, newPhase, isTargetDeclaration = false) } + element.backingField?.let { updatePhaseForNonLocals(it, newPhase, isTargetDeclaration = false) } } - is FirClass -> { - element.declarations.forEach { - updatePhaseForNonLocals(it, newPhase, isTargetDeclaration = false) - } - } - else -> Unit + else -> {} } } } @@ -63,7 +68,9 @@ private object PhaseUpdatingTransformer : FirVisitor() { override fun visitElement(element: FirElement, data: FirResolvePhase) { if (element is FirElementWithResolveState) { if (element.resolvePhase >= data && element !is FirDefaultPropertyAccessor) return - element.replaceResolveState(data.asResolveState()) + + @OptIn(ResolveStateAccess::class) + element.resolveState = data.asResolveState() } element.acceptChildren(this, data) diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/lazy/resolve/LLFirResolveMultiDesignationCollector.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/lazy/resolve/LLFirResolveMultiDesignationCollector.kt new file mode 100644 index 00000000000..a2fa9d6f35e --- /dev/null +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/lazy/resolve/LLFirResolveMultiDesignationCollector.kt @@ -0,0 +1,92 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve + +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.collectDesignationWithFile +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets.LLFirClassWithAllCallablesResolveTarget +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets.LLFirResolveTarget +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets.LLFirWholeFileResolveTarget +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets.asResolveTarget +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.throwUnexpectedFirElementError +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.tryCollectDesignationWithFile +import org.jetbrains.kotlin.fir.FirElementWithResolveState +import org.jetbrains.kotlin.fir.FirFileAnnotationsContainer +import org.jetbrains.kotlin.fir.declarations.* +import org.jetbrains.kotlin.fir.declarations.synthetic.FirSyntheticProperty +import org.jetbrains.kotlin.fir.declarations.synthetic.FirSyntheticPropertyAccessor + +internal object LLFirResolveMultiDesignationCollector { + fun getDesignationsToResolve(target: FirElementWithResolveState): List { + return when (target) { + is FirFile -> listOf(LLFirWholeFileResolveTarget(target)) + else -> getMainDesignationToResolve(target)?.withAnnotationContainer() + } ?: emptyList() + } + + fun getDesignationsToResolveWithCallableMembers(target: FirRegularClass): List { + val designation = target.tryCollectDesignationWithFile() ?: return emptyList() + val resolveTarget = LLFirClassWithAllCallablesResolveTarget(designation.firFile, designation.path, target) + return resolveTarget.withAnnotationContainer() + } + + private fun LLFirResolveTarget.withAnnotationContainer(): List { + val annotationsContainer = firFile.annotationsContainer + if (!annotationsContainer.shouldBeResolved()) return listOf(this) + return buildList { + add(annotationsContainer.collectDesignationWithFile().asResolveTarget()) + add(this@withAnnotationContainer) + } + } + + private fun getMainDesignationToResolve(target: FirElementWithResolveState): LLFirResolveTarget? { + require(target !is FirFile) + if (!target.shouldBeResolved()) return null + return when (target) { + is FirPropertyAccessor -> getMainDesignationToResolve(target.propertySymbol.fir) + is FirBackingField -> getMainDesignationToResolve(target.propertySymbol.fir) + is FirTypeParameter -> getMainDesignationToResolve(target.containingDeclarationSymbol.fir) + is FirValueParameter -> getMainDesignationToResolve(target.containingFunctionSymbol.fir) + else -> target.tryCollectDesignationWithFile()?.asResolveTarget() + } + } + + private fun FirElementWithResolveState.shouldBeResolved() = when (this) { + is FirDeclaration -> shouldBeResolved() + is FirFileAnnotationsContainer -> annotations.isNotEmpty() + else -> throwUnexpectedFirElementError(this) + } + + private fun FirDeclaration.shouldBeResolved(): Boolean = when (origin) { + is FirDeclarationOrigin.Source, + is FirDeclarationOrigin.ImportedFromObjectOrStatic, + is FirDeclarationOrigin.Delegated, + is FirDeclarationOrigin.Synthetic, + is FirDeclarationOrigin.SubstitutionOverride, + is FirDeclarationOrigin.SamConstructor, + is FirDeclarationOrigin.IntersectionOverride -> { + when (this) { + is FirFile -> true + is FirSyntheticProperty -> false + is FirSyntheticPropertyAccessor -> false + is FirSimpleFunction, + is FirProperty, + is FirPropertyAccessor, + is FirField, + is FirTypeAlias, + is FirConstructor -> true + else -> true + } + } + else -> { + @OptIn(ResolveStateAccess::class) + check(resolvePhase == FirResolvePhase.BODY_RESOLVE) { + "Expected body resolve phase for origin $origin but found $resolveState" + } + + false + } + } +} \ No newline at end of file diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/lazy/resolve/NonLocalDeclarationUtils.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/lazy/resolve/NonLocalDeclarationUtils.kt index 7cc70590191..009d2a5c6d5 100644 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/lazy/resolve/NonLocalDeclarationUtils.kt +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/lazy/resolve/NonLocalDeclarationUtils.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -49,20 +49,18 @@ internal fun FirDeclaration.getKtDeclarationForFirElement(): KtDeclaration { return declaration } -internal fun declarationCanBeLazilyResolved(declaration: KtDeclaration): Boolean { - return when (declaration) { - !is KtNamedDeclaration -> false - is KtDestructuringDeclarationEntry, is KtFunctionLiteral, is KtTypeParameter -> false - is KtPrimaryConstructor -> false - is KtParameter -> declaration.hasValOrVar() && declaration.containingClassOrObject?.getClassId() != null - is KtCallableDeclaration, is KtEnumEntry -> { - when (val parent = declaration.parent) { - is KtFile -> true - is KtClassBody -> (parent.parent as? KtClassOrObject)?.getClassId() != null - else -> false - } +internal fun declarationCanBeLazilyResolved(declaration: KtDeclaration): Boolean = when (declaration) { + is KtDestructuringDeclarationEntry, is KtFunctionLiteral, is KtTypeParameter -> false + is KtPrimaryConstructor -> (declaration.parent as? KtClassOrObject)?.getClassId() != null + is KtParameter -> declaration.hasValOrVar() && declaration.containingClassOrObject?.getClassId() != null + is KtCallableDeclaration, is KtEnumEntry, is KtClassInitializer -> { + when (val parent = declaration.parent) { + is KtFile -> true + is KtClassBody -> (parent.parent as? KtClassOrObject)?.getClassId() != null + else -> false } - is KtClassLikeDeclaration -> declaration.getClassId() != null - else -> error("Unexpected ${declaration::class.qualifiedName}") } + !is KtNamedDeclaration -> false + is KtClassLikeDeclaration -> declaration.getClassId() != null + else -> error("Unexpected ${declaration::class.qualifiedName}") } diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirAbstractBodyTargetResolver.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirAbstractBodyTargetResolver.kt new file mode 100644 index 00000000000..7dddd8dc3da --- /dev/null +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirAbstractBodyTargetResolver.kt @@ -0,0 +1,65 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.analysis.low.level.api.fir.transformers + +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.FirDesignationWithFile +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets.LLFirResolveTarget +import org.jetbrains.kotlin.analysis.low.level.api.fir.element.builder.LLFirDesignatedImpliciteTypesBodyResolveTransformerForReturnTypeCalculator +import org.jetbrains.kotlin.analysis.low.level.api.fir.file.builder.LLFirLockProvider +import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.FirLazyBodiesCalculator +import org.jetbrains.kotlin.fir.FirElementWithResolveState +import org.jetbrains.kotlin.fir.declarations.FirFile +import org.jetbrains.kotlin.fir.declarations.FirRegularClass +import org.jetbrains.kotlin.fir.declarations.FirResolvePhase +import org.jetbrains.kotlin.fir.resolve.ScopeSession +import org.jetbrains.kotlin.fir.resolve.transformers.ReturnTypeCalculator +import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirAbstractBodyResolveTransformerDispatcher +import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.ImplicitBodyResolveComputationSession +import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.createReturnTypeCalculatorForIDE + +internal abstract class LLFirAbstractBodyTargetResolver( + resolveTarget: LLFirResolveTarget, + lockProvider: LLFirLockProvider, + private val scopeSession: ScopeSession, + resolvePhase: FirResolvePhase, + protected val implicitBodyResolveComputationSession: ImplicitBodyResolveComputationSession = ImplicitBodyResolveComputationSession() +) : LLFirTargetResolver(resolveTarget, lockProvider, resolvePhase) { + + protected fun createReturnTypeCalculator(): ReturnTypeCalculator = createReturnTypeCalculatorForIDE( + scopeSession, + implicitBodyResolveComputationSession, + ::LLFirDesignatedImpliciteTypesBodyResolveTransformerForReturnTypeCalculator + ) + + abstract val transformer: FirAbstractBodyResolveTransformerDispatcher + + override fun checkResolveConsistency() { + check(resolverPhase == transformer.transformerPhase) { + "Inconsistent Resolver($resolverPhase) and Transformer(${transformer.transformerPhase}) phases" + } + } + + override fun withFile(firFile: FirFile, action: () -> Unit) { + transformer.context.withFile(firFile, transformer.components) { + action() + } + } + + @Deprecated("Should never be called directly, only for override purposes, please use withRegularClass", level = DeprecationLevel.ERROR) + override fun withRegularClassImpl(firClass: FirRegularClass, action: () -> Unit) { + transformer.declarationsTransformer.context.withContainingClass(firClass) { + transformer.declarationsTransformer.withRegularClass(firClass) { + action() + firClass + } + } + } + + protected fun calculateLazyBodies(declaration: FirElementWithResolveState) { + val firDesignation = FirDesignationWithFile(nestedClassesStack, declaration, resolveTarget.firFile) + FirLazyBodiesCalculator.calculateLazyBodiesInside(firDesignation) + } +} diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirAnnotationArgumentMappingLazyResolver.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirAnnotationArgumentMappingLazyResolver.kt new file mode 100644 index 00000000000..134d4fc8711 --- /dev/null +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirAnnotationArgumentMappingLazyResolver.kt @@ -0,0 +1,87 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.analysis.low.level.api.fir.transformers + +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets.LLFirResolveTarget +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.throwUnexpectedFirElementError +import org.jetbrains.kotlin.analysis.low.level.api.fir.file.builder.LLFirLockProvider +import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.FirLazyBodiesCalculator +import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.LLFirPhaseUpdater +import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkAnnotationArgumentsMappingIsResolved +import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkPhase +import org.jetbrains.kotlin.fir.FirAnnotationContainer +import org.jetbrains.kotlin.fir.FirElementWithResolveState +import org.jetbrains.kotlin.fir.FirFileAnnotationsContainer +import org.jetbrains.kotlin.fir.FirSession +import org.jetbrains.kotlin.fir.declarations.* +import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall +import org.jetbrains.kotlin.fir.resolve.ResolutionMode +import org.jetbrains.kotlin.fir.resolve.ScopeSession +import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirTowerDataContextCollector +import org.jetbrains.kotlin.fir.resolve.transformers.plugin.FirAnnotationArgumentsMappingTransformer +import org.jetbrains.kotlin.fir.visitors.transformSingle + +internal object LLFirAnnotationArgumentMappingLazyResolver : LLFirLazyResolver(FirResolvePhase.ANNOTATIONS_ARGUMENTS_MAPPING) { + override fun resolve( + target: LLFirResolveTarget, + lockProvider: LLFirLockProvider, + session: FirSession, + scopeSession: ScopeSession, + towerDataContextCollector: FirTowerDataContextCollector?, + ) { + val resolver = LLFirAnnotationArgumentsMappingTargetResolver(target, lockProvider, session, scopeSession) + resolver.resolveDesignation() + } + + override fun updatePhaseForDeclarationInternals(target: FirElementWithResolveState) { + LLFirPhaseUpdater.updateDeclarationInternalsPhase(target, resolverPhase, updateForLocalDeclarations = false) + } + + override fun checkIsResolved(target: FirElementWithResolveState) { + target.checkPhase(resolverPhase) + if (target !is FirAnnotationContainer) return + for (annotation in target.annotations) { + if (annotation is FirAnnotationCall) { + checkAnnotationArgumentsMappingIsResolved(annotation, target) + } + } + checkNestedDeclarationsAreResolved(target) + } +} + +private class LLFirAnnotationArgumentsMappingTargetResolver( + resolveTarget: LLFirResolveTarget, + lockProvider: LLFirLockProvider, + session: FirSession, + scopeSession: ScopeSession, +) : LLFirAbstractBodyTargetResolver( + resolveTarget, + lockProvider, + scopeSession, + FirResolvePhase.ANNOTATIONS_ARGUMENTS_MAPPING, +) { + override val transformer = FirAnnotationArgumentsMappingTransformer( + session, + scopeSession, + resolverPhase, + returnTypeCalculator = createReturnTypeCalculator() + ) + + override fun doLazyResolveUnderLock(target: FirElementWithResolveState) { + FirLazyBodiesCalculator.calculateAnnotations(target) + when (target) { + is FirRegularClass -> { + target.transformAnnotations(transformer.declarationsTransformer, ResolutionMode.ContextIndependent) + target.transformTypeParameters(transformer.declarationsTransformer, ResolutionMode.ContextIndependent) + target.transformSuperTypeRefs(transformer.declarationsTransformer, ResolutionMode.ContextIndependent) + } + is FirCallableDeclaration, is FirAnonymousInitializer, is FirDanglingModifierList, is FirFileAnnotationsContainer, is FirTypeAlias, is FirScript -> { + target.transformSingle(transformer, ResolutionMode.ContextIndependent) + } + else -> throwUnexpectedFirElementError(target) + } + } +} diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirAnnotationArgumentsLazyResolver.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirAnnotationArgumentsLazyResolver.kt new file mode 100644 index 00000000000..ae6ac550a1f --- /dev/null +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirAnnotationArgumentsLazyResolver.kt @@ -0,0 +1,98 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.analysis.low.level.api.fir.transformers + +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets.LLFirResolveTarget +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.throwUnexpectedFirElementError +import org.jetbrains.kotlin.analysis.low.level.api.fir.file.builder.LLFirLockProvider +import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.FirLazyBodiesCalculator +import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.LLFirPhaseUpdater +import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkPhase +import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkTypeRefIsResolved +import org.jetbrains.kotlin.analysis.low.level.api.fir.util.withFirEntry +import org.jetbrains.kotlin.fir.FirAnnotationContainer +import org.jetbrains.kotlin.fir.FirElementWithResolveState +import org.jetbrains.kotlin.fir.FirFileAnnotationsContainer +import org.jetbrains.kotlin.fir.FirSession +import org.jetbrains.kotlin.fir.declarations.* +import org.jetbrains.kotlin.fir.resolve.ResolutionMode +import org.jetbrains.kotlin.fir.resolve.ScopeSession +import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirTowerDataContextCollector +import org.jetbrains.kotlin.fir.resolve.transformers.plugin.FirAnnotationArgumentsResolveTransformer +import org.jetbrains.kotlin.fir.types.FirResolvedTypeRef +import org.jetbrains.kotlin.fir.visitors.transformSingle + +internal object LLFirAnnotationArgumentsLazyResolver : LLFirLazyResolver(FirResolvePhase.ARGUMENTS_OF_ANNOTATIONS) { + override fun resolve( + target: LLFirResolveTarget, + lockProvider: LLFirLockProvider, + session: FirSession, + scopeSession: ScopeSession, + towerDataContextCollector: FirTowerDataContextCollector?, + ) { + val resolver = LLFirAnnotationArgumentsTargetResolver(target, lockProvider, session, scopeSession) + resolver.resolveDesignation() + } + + override fun updatePhaseForDeclarationInternals(target: FirElementWithResolveState) { + LLFirPhaseUpdater.updateDeclarationInternalsPhase(target, resolverPhase, updateForLocalDeclarations = false) + } + + override fun checkIsResolved(target: FirElementWithResolveState) { + if (target !is FirAnnotationContainer) return + val unresolvedAnnotation = target.annotations.firstOrNull { it.annotationTypeRef !is FirResolvedTypeRef } + check(unresolvedAnnotation == null) { + "Unexpected annotationTypeRef annotation, expected resolvedType but actual ${unresolvedAnnotation?.annotationTypeRef}" + } + + target.checkPhase(resolverPhase) + + for (annotation in target.annotations) { + for (argument in annotation.argumentMapping.mapping.values) { + checkTypeRefIsResolved(argument.typeRef, "annotation argument", target) { + withFirEntry("firAnnotation", annotation) + withFirEntry("firArgument", argument) + } + } + } + + checkNestedDeclarationsAreResolved(target) + } +} + +private class LLFirAnnotationArgumentsTargetResolver( + target: LLFirResolveTarget, + lockProvider: LLFirLockProvider, + session: FirSession, + scopeSession: ScopeSession, +) : LLFirAbstractBodyTargetResolver( + target, + lockProvider, + scopeSession, + FirResolvePhase.ARGUMENTS_OF_ANNOTATIONS, +) { + override val transformer = FirAnnotationArgumentsResolveTransformer( + session, + scopeSession, + resolverPhase, + returnTypeCalculator = createReturnTypeCalculator() + ) + + override fun doLazyResolveUnderLock(target: FirElementWithResolveState) { + FirLazyBodiesCalculator.calculateAnnotations(target) + when (target) { + is FirRegularClass -> { + target.transformAnnotations(transformer.declarationsTransformer, ResolutionMode.ContextIndependent) + target.transformTypeParameters(transformer.declarationsTransformer, ResolutionMode.ContextIndependent) + target.transformSuperTypeRefs(transformer.declarationsTransformer, ResolutionMode.ContextIndependent) + } + is FirCallableDeclaration, is FirAnonymousInitializer, is FirDanglingModifierList, is FirFileAnnotationsContainer, is FirTypeAlias, is FirScript -> { + target.transformSingle(transformer, ResolutionMode.ContextIndependent) + } + else -> throwUnexpectedFirElementError(target) + } + } +} diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirBodyLazyResolver.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirBodyLazyResolver.kt new file mode 100644 index 00000000000..42068702d33 --- /dev/null +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirBodyLazyResolver.kt @@ -0,0 +1,165 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.analysis.low.level.api.fir.transformers + +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets.LLFirResolveTarget +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.throwUnexpectedFirElementError +import org.jetbrains.kotlin.analysis.low.level.api.fir.file.builder.LLFirLockProvider +import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.LLFirPhaseUpdater +import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkBodyIsResolved +import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkDefaultValueIsResolved +import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkInitializerIsResolved +import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkPhase +import org.jetbrains.kotlin.analysis.low.level.api.fir.util.withFirEntry +import org.jetbrains.kotlin.analysis.utils.errors.buildErrorWithAttachment +import org.jetbrains.kotlin.analysis.utils.errors.checkWithAttachmentBuilder +import org.jetbrains.kotlin.fir.FirElementWithResolveState +import org.jetbrains.kotlin.fir.FirFileAnnotationsContainer +import org.jetbrains.kotlin.fir.FirSession +import org.jetbrains.kotlin.fir.declarations.* +import org.jetbrains.kotlin.fir.resolve.ResolutionMode +import org.jetbrains.kotlin.fir.resolve.ScopeSession +import org.jetbrains.kotlin.fir.resolve.dfa.FirControlFlowGraphReferenceImpl +import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirBodyResolveTransformer +import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirTowerDataContextCollector +import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase +import org.jetbrains.kotlin.fir.visitors.transformSingle + + +internal object LLFirBodyLazyResolver : LLFirLazyResolver(FirResolvePhase.BODY_RESOLVE) { + override fun resolve( + target: LLFirResolveTarget, + lockProvider: LLFirLockProvider, + session: FirSession, + scopeSession: ScopeSession, + towerDataContextCollector: FirTowerDataContextCollector?, + ) { + val resolver = LLFirBodyTargetResolver(target, lockProvider, session, scopeSession, towerDataContextCollector) + resolver.resolveDesignation() + } + + override fun updatePhaseForDeclarationInternals(target: FirElementWithResolveState) { + LLFirPhaseUpdater.updateDeclarationInternalsPhase(target, resolverPhase, updateForLocalDeclarations = true) + } + + override fun checkIsResolved(target: FirElementWithResolveState) { + target.checkPhase(resolverPhase) + when (target) { + is FirValueParameter -> checkDefaultValueIsResolved(target) + is FirVariable -> checkInitializerIsResolved(target) + is FirFunction -> checkBodyIsResolved(target) + } + + checkNestedDeclarationsAreResolved(target) + } +} + +private class LLFirBodyTargetResolver( + target: LLFirResolveTarget, + lockProvider: LLFirLockProvider, + session: FirSession, + scopeSession: ScopeSession, + towerDataContextCollector: FirTowerDataContextCollector?, +) : LLFirAbstractBodyTargetResolver( + target, + lockProvider, + scopeSession, + FirResolvePhase.BODY_RESOLVE, +) { + override val transformer = object : FirBodyResolveTransformer( + session, + phase = resolverPhase, + implicitTypeOnly = false, + scopeSession = scopeSession, + returnTypeCalculator = createReturnTypeCalculator(), + firTowerDataContextCollector = towerDataContextCollector, + ) { + override val preserveCFGForClasses: Boolean get() = false + } + + override fun doResolveWithoutLock(target: FirElementWithResolveState): Boolean { + when (target) { + is FirRegularClass -> { + if (target.resolvePhase >= resolverPhase) return true + + withRegularClass(target) { + transformer.firTowerDataContextCollector?.addDeclarationContext(target, transformer.context.towerDataContext) + } + + // resolve class CFG graph here, to do this we need to have property & init blocks resoled + resolveMemberProperties(target) + performCustomResolveUnderLock(target) { + calculateCFG(target) + } + + return true + } + } + + return false + } + + private fun calculateCFG(target: FirRegularClass) { + checkWithAttachmentBuilder( + target.controlFlowGraphReference == null, + { "controlFlowGraphReference should be null if class phase < $resolverPhase)" }, + ) { + withFirEntry("firClass", target) + } + + val dataFlowAnalyzer = transformer.declarationsTransformer.dataFlowAnalyzer + dataFlowAnalyzer.enterClass(target, buildGraph = true) + val controlFlowGraph = dataFlowAnalyzer.exitClass() + ?: buildErrorWithAttachment("CFG should not be null as buildGraph is specified") { + withFirEntry("firClass", target) + } + + target.replaceControlFlowGraphReference(FirControlFlowGraphReferenceImpl(controlFlowGraph)) + } + + private fun resolveMemberProperties(target: FirRegularClass) { + withRegularClass(target) { + for (member in target.declarations) { + if (member is FirCallableDeclaration || member is FirAnonymousInitializer) { + /* TODO we should resolve only properties and init blocks here but due to the recent changes in the compiler, we also have to do this for all callable members + we should avoid doing it as it leads to additional work and also can might to problems with incremental analysis + */ + member.lazyResolveToPhase(resolverPhase.previous) + performResolve(member) + } + } + } + } + + override fun doLazyResolveUnderLock(target: FirElementWithResolveState) { + val contextCollector = transformer.firTowerDataContextCollector + if (contextCollector != null && target is FirDeclaration) { + val bodyResolveContext = transformer.context + if (target is FirFunction) { + bodyResolveContext.forFunctionBody(target, transformer.components) { + contextCollector.addDeclarationContext(target, bodyResolveContext.towerDataContext) + } + } else { + contextCollector.addDeclarationContext(target, bodyResolveContext.towerDataContext) + } + } + + when (target) { + is FirRegularClass -> { + error("should be resolved in ${::doResolveWithoutLock.name}") + } + is FirDanglingModifierList, is FirFileAnnotationsContainer, is FirTypeAlias -> { + // no bodies here + } + is FirCallableDeclaration, is FirAnonymousInitializer, is FirScript -> { + calculateLazyBodies(target) + target.transformSingle(transformer, ResolutionMode.ContextIndependent) + } + else -> throwUnexpectedFirElementError(target) + } + } +} + diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirCompilerAnnotationsLazyResolver.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirCompilerAnnotationsLazyResolver.kt new file mode 100644 index 00000000000..212a89a10f9 --- /dev/null +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirCompilerAnnotationsLazyResolver.kt @@ -0,0 +1,89 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.analysis.low.level.api.fir.transformers + +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets.LLFirResolveTarget +import org.jetbrains.kotlin.analysis.low.level.api.fir.file.builder.LLFirLockProvider +import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.FirLazyBodiesCalculator +import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.LLFirPhaseUpdater +import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkPhase +import org.jetbrains.kotlin.fir.FirElementWithResolveState +import org.jetbrains.kotlin.fir.FirSession +import org.jetbrains.kotlin.fir.declarations.FirFile +import org.jetbrains.kotlin.fir.declarations.FirRegularClass +import org.jetbrains.kotlin.fir.declarations.FirResolvePhase +import org.jetbrains.kotlin.fir.declarations.FirTypeAlias +import org.jetbrains.kotlin.fir.resolve.ScopeSession +import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirTowerDataContextCollector +import org.jetbrains.kotlin.fir.resolve.transformers.plugin.CompilerRequiredAnnotationsComputationSession +import org.jetbrains.kotlin.fir.resolve.transformers.plugin.FirCompilerRequiredAnnotationsResolveTransformer + +internal object LLFirCompilerAnnotationsLazyResolver : LLFirLazyResolver(FirResolvePhase.COMPILER_REQUIRED_ANNOTATIONS) { + override fun resolve( + target: LLFirResolveTarget, + lockProvider: LLFirLockProvider, + session: FirSession, + scopeSession: ScopeSession, + towerDataContextCollector: FirTowerDataContextCollector?, + ) { + val resolver = LLFirCompilerRequiredAnnotationsTargetResolver(target, lockProvider, session, scopeSession) + resolver.resolveDesignation() + } + + override fun updatePhaseForDeclarationInternals(target: FirElementWithResolveState) { + LLFirPhaseUpdater.updateDeclarationInternalsPhase(target, resolverPhase, updateForLocalDeclarations = false) + } + + override fun checkIsResolved(target: FirElementWithResolveState) { + target.checkPhase(resolverPhase) + checkNestedDeclarationsAreResolved(target) + // TODO add proper check that COMPILER_REQUIRED_ANNOTATIONS are resolved + } +} + + +private class LLFirCompilerRequiredAnnotationsTargetResolver( + target: LLFirResolveTarget, + lockProvider: LLFirLockProvider, + session: FirSession, + scopeSession: ScopeSession, +) : LLFirTargetResolver(target, lockProvider, FirResolvePhase.COMPILER_REQUIRED_ANNOTATIONS, isJumpingPhase = true) { + private val transformer = + FirCompilerRequiredAnnotationsResolveTransformer(session, scopeSession, CompilerRequiredAnnotationsComputationSession()) + + override fun withFile(firFile: FirFile, action: () -> Unit) { + transformer.annotationTransformer.withFileAndFileScopes(firFile) { + action() + } + } + + @Deprecated("Should never be called directly, only for override purposes, please use withRegularClass", level = DeprecationLevel.ERROR) + override fun withRegularClassImpl(firClass: FirRegularClass, action: () -> Unit) { + transformer.annotationTransformer.withRegularClass(firClass) { + action() + } + } + + override fun doLazyResolveUnderLock(target: FirElementWithResolveState) { + FirLazyBodiesCalculator.calculateCompilerAnnotations(target) + when (target) { + is FirTypeAlias -> { + transformer.transformTypeAlias(target, null) + } + is FirRegularClass -> { + transformer.annotationTransformer.resolveRegularClass( + target, + transformChildren = { + target.transformSuperTypeRefs(transformer.annotationTransformer, null) + }, + afterChildrenTransform = { + transformer.annotationTransformer.calculateDeprecations(target) + } + ) + } + } + } +} \ No newline at end of file diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirContractsLazyResolver.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirContractsLazyResolver.kt new file mode 100644 index 00000000000..14b557f3ecd --- /dev/null +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirContractsLazyResolver.kt @@ -0,0 +1,75 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.analysis.low.level.api.fir.transformers + +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets.LLFirResolveTarget +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.throwUnexpectedFirElementError +import org.jetbrains.kotlin.analysis.low.level.api.fir.file.builder.LLFirLockProvider +import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.LLFirPhaseUpdater +import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkPhase +import org.jetbrains.kotlin.fir.FirElementWithResolveState +import org.jetbrains.kotlin.fir.FirFileAnnotationsContainer +import org.jetbrains.kotlin.fir.FirSession +import org.jetbrains.kotlin.fir.declarations.* +import org.jetbrains.kotlin.fir.resolve.ResolutionMode +import org.jetbrains.kotlin.fir.resolve.ScopeSession +import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirTowerDataContextCollector +import org.jetbrains.kotlin.fir.resolve.transformers.contracts.FirContractResolveTransformer +import org.jetbrains.kotlin.fir.visitors.transformSingle + + +internal object LLFirContractsLazyResolver : LLFirLazyResolver(FirResolvePhase.CONTRACTS) { + override fun resolve( + target: LLFirResolveTarget, + lockProvider: LLFirLockProvider, + session: FirSession, + scopeSession: ScopeSession, + towerDataContextCollector: FirTowerDataContextCollector?, + ) { + val resolver = LLFirContractsTargetResolver(target, lockProvider, session, scopeSession) + resolver.resolveDesignation() + } + + override fun updatePhaseForDeclarationInternals(target: FirElementWithResolveState) { + LLFirPhaseUpdater.updateDeclarationInternalsPhase(target, resolverPhase, updateForLocalDeclarations = false) + } + + override fun checkIsResolved(target: FirElementWithResolveState) { + target.checkPhase(resolverPhase) + if (target is FirContractDescriptionOwner) { + // TODO checkContractDescriptionIsResolved(declaration) + } + checkNestedDeclarationsAreResolved(target) + } +} + +private class LLFirContractsTargetResolver( + target: LLFirResolveTarget, + lockProvider: LLFirLockProvider, + session: FirSession, + scopeSession: ScopeSession, +) : LLFirAbstractBodyTargetResolver( + target, + lockProvider, + scopeSession, + FirResolvePhase.CONTRACTS +) { + override val transformer = FirContractResolveTransformer(session, scopeSession) + + override fun doLazyResolveUnderLock(target: FirElementWithResolveState) { + when (target) { + is FirRegularClass, is FirAnonymousInitializer, is FirDanglingModifierList, is FirFileAnnotationsContainer, is FirTypeAlias, is FirScript -> { + // no contracts here + } + is FirCallableDeclaration -> { + // TODO calculate bodies only when in-body contract is present + calculateLazyBodies(target) + target.transformSingle(transformer, ResolutionMode.ContextIndependent) + } + else -> throwUnexpectedFirElementError(target) + } + } +} diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirDeclarationTransformer.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirDeclarationTransformer.kt deleted file mode 100644 index 015a2f4323a..00000000000 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirDeclarationTransformer.kt +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.analysis.low.level.api.fir.transformers - -import org.jetbrains.kotlin.analysis.low.level.api.fir.api.FirDesignation -import org.jetbrains.kotlin.fir.FirElement -import org.jetbrains.kotlin.fir.FirElementWithResolveState -import org.jetbrains.kotlin.fir.declarations.FirDeclaration -import org.jetbrains.kotlin.fir.render -import org.jetbrains.kotlin.fir.visitors.FirDefaultTransformer -import org.jetbrains.kotlin.fir.visitors.FirVisitor - -internal class LLFirDeclarationTransformer(private val designation: FirDesignation) { - private val designationWithoutTargetIterator = designation.toSequence(includeTarget = false).iterator() - private var isInsideTargetDeclaration: Boolean = false - private var designationPassed: Boolean = false - - inline fun visitDeclarationContent( - visitor: FirVisitor, - declaration: FirDeclaration, - data: D, - default: () -> FirDeclaration - ): FirDeclaration = processDeclarationContent(declaration, default) { - it.accept(visitor, data) - } - - inline fun transformDeclarationContent( - transformer: FirDefaultTransformer, - declaration: FirDeclaration, - data: D, - default: () -> FirDeclaration - ): FirDeclaration = processDeclarationContent(declaration, default) { toTransform -> - toTransform.transform(transformer, data).also { transformed -> - check(transformed === toTransform) { - "become $transformed `${transformed.render()}`, was ${toTransform}: `${toTransform.render()}`" - } - } - } - - private inline fun processDeclarationContent( - declaration: FirDeclaration, - default: () -> FirDeclaration, - applyToDesignated: (FirElementWithResolveState) -> Unit, - ): FirDeclaration { - //It means that we are inside the target declaration - if (isInsideTargetDeclaration) { - return default() - } - - //It means that we already transform target declaration and now can skip all others - if (designationPassed) { - return declaration - } - - if (designationWithoutTargetIterator.hasNext()) { - applyToDesignated(designationWithoutTargetIterator.next()) - } else { - try { - isInsideTargetDeclaration = true - designationPassed = true - applyToDesignated(designation.target) - } finally { - isInsideTargetDeclaration = false - } - } - - return declaration - } - - fun ensureDesignationPassed() { - check(designationPassed) { "Designation not passed for declaration ${designation.target::class.simpleName}" } - } -} diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirDesignatedAnnotationArgumentsMappingTransformer.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirDesignatedAnnotationArgumentsMappingTransformer.kt deleted file mode 100644 index 0ac19a5781b..00000000000 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirDesignatedAnnotationArgumentsMappingTransformer.kt +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.analysis.low.level.api.fir.transformers - -import org.jetbrains.kotlin.analysis.low.level.api.fir.api.FirDesignationWithFile -import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.FirLazyBodiesCalculator -import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.LLFirPhaseUpdater -import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkAnnotationArgumentsMappingIsResolved -import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkPhase -import org.jetbrains.kotlin.fir.FirAnnotationContainer -import org.jetbrains.kotlin.fir.FirElementWithResolveState -import org.jetbrains.kotlin.fir.FirSession -import org.jetbrains.kotlin.fir.declarations.FirDeclaration -import org.jetbrains.kotlin.fir.declarations.FirFile -import org.jetbrains.kotlin.fir.declarations.FirResolvePhase -import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall -import org.jetbrains.kotlin.fir.resolve.ResolutionMode -import org.jetbrains.kotlin.fir.resolve.ScopeSession -import org.jetbrains.kotlin.fir.resolve.transformers.plugin.FirAnnotationArgumentsMappingTransformer - -/** - * Transform designation into ANNOTATIONS_ARGUMENTS_MAPPING declaration. Affects only for target declaration, it's children and dependents - */ -internal class LLFirDesignatedAnnotationArgumentsMappingTransformer( - private val designation: FirDesignationWithFile, - session: FirSession, - scopeSession: ScopeSession, -) : LLFirLazyTransformer, FirAnnotationArgumentsMappingTransformer(session, scopeSession, FirResolvePhase.ANNOTATIONS_ARGUMENTS_MAPPING) { - private val ideDeclarationTransformer = LLFirDeclarationTransformer(designation) - - override fun transformDeclarationContent(declaration: FirDeclaration, data: ResolutionMode): FirDeclaration = - ideDeclarationTransformer.transformDeclarationContent(this, declaration, data) { - super.transformDeclarationContent(declaration, data) - } - - override fun transformDeclaration() { - FirLazyBodiesCalculator.calculateAnnotations(designation.firFile) - designation.firFile.transform(this, ResolutionMode.ContextIndependent) - } - - override fun updatePhaseForDeclarationInternals(target: FirElementWithResolveState) { - LLFirPhaseUpdater.updateDeclarationInternalsPhase( - target, - FirResolvePhase.ANNOTATIONS_ARGUMENTS_MAPPING, - updateForLocalDeclarations = false, - ) - } - - override fun checkIsResolved(target: FirElementWithResolveState) { - target.checkPhase(FirResolvePhase.ANNOTATIONS_ARGUMENTS_MAPPING) - if (target !is FirAnnotationContainer) return - for (annotation in target.annotations) { - if (annotation is FirAnnotationCall) { - checkAnnotationArgumentsMappingIsResolved(annotation, target) - } - } - checkNestedDeclarationsAreResolved(target) - } -} diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirDesignatedAnnotationArgumentsResolveTransformer.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirDesignatedAnnotationArgumentsResolveTransformer.kt deleted file mode 100644 index b64b459702f..00000000000 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirDesignatedAnnotationArgumentsResolveTransformer.kt +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.analysis.low.level.api.fir.transformers - -import org.jetbrains.kotlin.analysis.low.level.api.fir.api.FirDesignationWithFile -import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.LLFirPhaseUpdater -import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.FirLazyBodiesCalculator -import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkPhase -import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkTypeRefIsResolved -import org.jetbrains.kotlin.analysis.low.level.api.fir.util.withFirEntry -import org.jetbrains.kotlin.fir.FirAnnotationContainer -import org.jetbrains.kotlin.fir.FirElementWithResolveState -import org.jetbrains.kotlin.fir.FirSession -import org.jetbrains.kotlin.fir.declarations.* -import org.jetbrains.kotlin.fir.resolve.ResolutionMode -import org.jetbrains.kotlin.fir.resolve.ScopeSession -import org.jetbrains.kotlin.fir.resolve.transformers.plugin.FirAnnotationArgumentsResolveTransformer -import org.jetbrains.kotlin.fir.types.FirResolvedTypeRef - -internal class LLFirDesignatedAnnotationArgumentsResolveTransformer( - private val designation: FirDesignationWithFile, - session: FirSession, - scopeSession: ScopeSession, -) : LLFirLazyTransformer, FirAnnotationArgumentsResolveTransformer(session, scopeSession, FirResolvePhase.ARGUMENTS_OF_ANNOTATIONS) { - - private fun moveNextDeclaration(designationIterator: Iterator) { - if (!designationIterator.hasNext()) { - FirLazyBodiesCalculator.calculateAnnotations(designation.target) - designation.target.transform(declarationsTransformer, ResolutionMode.ContextIndependent) - return - } - when (val nextElement = designationIterator.next()) { - is FirFile -> { - context.withFile(nextElement, components) { - moveNextDeclaration(designationIterator) - } - } - is FirRegularClass -> { - context.withRegularClass(nextElement, components) { - moveNextDeclaration(designationIterator) - } - } - is FirEnumEntry -> { - context.forEnumEntry { - moveNextDeclaration(designationIterator) - } - } - else -> { - error("Unexpected declaration in designation: ${nextElement::class.qualifiedName}") - } - } - } - - override fun transformDeclaration() { - val designationIterator = designation.toSequenceWithFile(includeTarget = false).iterator() - moveNextDeclaration(designationIterator) - } - - override fun updatePhaseForDeclarationInternals(target: FirElementWithResolveState) { - LLFirPhaseUpdater.updateDeclarationInternalsPhase( - target, - FirResolvePhase.ARGUMENTS_OF_ANNOTATIONS, - updateForLocalDeclarations = false, - ) - } - - override fun checkIsResolved(target: FirElementWithResolveState) { - if (target !is FirAnnotationContainer) return - val unresolvedAnnotation = target.annotations.firstOrNull { it.annotationTypeRef !is FirResolvedTypeRef } - check(unresolvedAnnotation == null) { - "Unexpected annotationTypeRef annotation, expected resolvedType but actual ${unresolvedAnnotation?.annotationTypeRef}" - } - target.checkPhase(FirResolvePhase.ARGUMENTS_OF_ANNOTATIONS) - - for (annotation in target.annotations) { - for (argument in annotation.argumentMapping.mapping.values) { - checkTypeRefIsResolved(argument.typeRef, "annotation argument", target) { - withFirEntry("firAnnotation", annotation) - withFirEntry("firArgument", argument) - } - } - } - checkNestedDeclarationsAreResolved(target) - } - -} diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirDesignatedAnnotationsResolveTransformed.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirDesignatedAnnotationsResolveTransformed.kt deleted file mode 100644 index e1339ccee73..00000000000 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirDesignatedAnnotationsResolveTransformed.kt +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.analysis.low.level.api.fir.transformers - -import org.jetbrains.kotlin.analysis.low.level.api.fir.api.FirDesignationWithFile -import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.LLFirPhaseUpdater -import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.FirLazyBodiesCalculator -import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkPhase -import org.jetbrains.kotlin.fir.FirElementWithResolveState -import org.jetbrains.kotlin.fir.FirSession -import org.jetbrains.kotlin.fir.declarations.* -import org.jetbrains.kotlin.fir.resolve.ScopeSession -import org.jetbrains.kotlin.fir.resolve.transformers.plugin.CompilerRequiredAnnotationsComputationSession -import org.jetbrains.kotlin.fir.resolve.transformers.plugin.FirCompilerRequiredAnnotationsResolveTransformer - -internal class LLFirDesignatedAnnotationsResolveTransformed( - private val designation: FirDesignationWithFile, - session: FirSession, - scopeSession: ScopeSession, -) : LLFirLazyTransformer, - FirCompilerRequiredAnnotationsResolveTransformer(session, scopeSession, CompilerRequiredAnnotationsComputationSession()) { - - private fun moveNextDeclaration(designationIterator: Iterator) { - if (!designationIterator.hasNext()) { - val declaration = designation.target - FirLazyBodiesCalculator.calculateCompilerAnnotations(declaration) - if (declaration is FirRegularClass || declaration is FirTypeAlias) { - declaration.transform(this, null) - } - return - } - when (val nextElement = designationIterator.next()) { - is FirFile -> { - withFileAndScopes(nextElement) { - moveNextDeclaration(designationIterator) - } - } - is FirRegularClass -> { - moveNextDeclaration(designationIterator) - } - else -> { - error("Unexpected declaration in designation: ${nextElement::class.qualifiedName}") - } - } - } - - override fun transformDeclaration() { - val designationIterator = designation.toSequenceWithFile(includeTarget = false).iterator() - moveNextDeclaration(designationIterator) - } - - - override fun updatePhaseForDeclarationInternals(target: FirElementWithResolveState) { - LLFirPhaseUpdater.updateDeclarationInternalsPhase( - target, - FirResolvePhase.COMPILER_REQUIRED_ANNOTATIONS, - updateForLocalDeclarations = false, - ) - } - - override fun checkIsResolved(target: FirElementWithResolveState) { - target.checkPhase(FirResolvePhase.COMPILER_REQUIRED_ANNOTATIONS) - // todo add proper check that COMPILER_REQUIRED_ANNOTATIONS are resolved -// checkNestedDeclarationsAreResolved(declaration) - } -} diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirDesignatedBodyResolveTransformer.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirDesignatedBodyResolveTransformer.kt deleted file mode 100644 index 987428c2d90..00000000000 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirDesignatedBodyResolveTransformer.kt +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.analysis.low.level.api.fir.transformers - -import org.jetbrains.kotlin.analysis.low.level.api.fir.api.FirDesignationWithFile -import org.jetbrains.kotlin.analysis.low.level.api.fir.element.builder.LLFirEnsureBasedTransformerForReturnTypeCalculator -import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.LLFirPhaseUpdater -import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkPhase -import org.jetbrains.kotlin.fir.FirElementWithResolveState -import org.jetbrains.kotlin.fir.FirSession -import org.jetbrains.kotlin.fir.declarations.FirDeclaration -import org.jetbrains.kotlin.fir.declarations.FirFile -import org.jetbrains.kotlin.fir.declarations.FirResolvePhase -import org.jetbrains.kotlin.fir.resolve.ResolutionMode -import org.jetbrains.kotlin.fir.resolve.ScopeSession -import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirBodyResolveTransformer -import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirTowerDataContextCollector -import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.ImplicitBodyResolveComputationSession -import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.createReturnTypeCalculatorForIDE - -/** - * Transform designation into BODY_RESOLVE declaration. Affects only for target declaration and it's children - */ -internal class LLFirDesignatedBodyResolveTransformer( - private val designation: FirDesignationWithFile, - session: FirSession, - scopeSession: ScopeSession, - towerDataContextCollector: FirTowerDataContextCollector? -) : LLFirLazyTransformer, FirBodyResolveTransformer( - session, - phase = FirResolvePhase.BODY_RESOLVE, - implicitTypeOnly = false, - scopeSession = scopeSession, - returnTypeCalculator = createReturnTypeCalculatorForIDE( - scopeSession, - ImplicitBodyResolveComputationSession(), - ::LLFirEnsureBasedTransformerForReturnTypeCalculator - ), - firTowerDataContextCollector = towerDataContextCollector -) { - private val ideDeclarationTransformer = LLFirDeclarationTransformer(designation) - - override fun transformDeclarationContent(declaration: FirDeclaration, data: ResolutionMode): FirDeclaration = - ideDeclarationTransformer.transformDeclarationContent(this, declaration, data) { - super.transformDeclarationContent(declaration, data) - } - - override fun transformDeclaration() { - designation.firFile.transform(this, ResolutionMode.ContextIndependent) - ideDeclarationTransformer.ensureDesignationPassed() - } - - override fun updatePhaseForDeclarationInternals(target: FirElementWithResolveState) { - LLFirPhaseUpdater.updateDeclarationInternalsPhase(target, FirResolvePhase.BODY_RESOLVE, updateForLocalDeclarations = true) - } - - override fun checkIsResolved(target: FirElementWithResolveState) { - target.checkPhase(FirResolvePhase.BODY_RESOLVE) - checkNestedDeclarationsAreResolved(target) - } -} - diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirDesignatedContractsResolveTransformer.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirDesignatedContractsResolveTransformer.kt deleted file mode 100644 index 44f781c150d..00000000000 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirDesignatedContractsResolveTransformer.kt +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.analysis.low.level.api.fir.transformers - -import org.jetbrains.kotlin.analysis.low.level.api.fir.api.FirDesignationWithFile -import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.FirLazyBodiesCalculator -import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.LLFirPhaseUpdater -import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkPhase -import org.jetbrains.kotlin.fir.FirElementWithResolveState -import org.jetbrains.kotlin.fir.FirSession -import org.jetbrains.kotlin.fir.declarations.* -import org.jetbrains.kotlin.fir.resolve.ResolutionMode -import org.jetbrains.kotlin.fir.resolve.ScopeSession -import org.jetbrains.kotlin.fir.resolve.transformers.contracts.FirAbstractContractResolveTransformerDispatcher - -/** - * Transform designation into CONTRACTS declaration. Affects only for target declaration and it's children - */ -internal class LLFirDesignatedContractsResolveTransformer( - private val designation: FirDesignationWithFile, - session: FirSession, - scopeSession: ScopeSession, -) : LLFirLazyTransformer, FirAbstractContractResolveTransformerDispatcher(session, scopeSession) { - - private val ideDeclarationTransformer = LLFirDeclarationTransformer(designation) - - override val contractDeclarationsTransformer: FirDeclarationsContractResolveTransformer - get() = object : FirDeclarationsContractResolveTransformer() { - override fun transformDeclarationContent(firClass: FirClass, data: ResolutionMode) { - ideDeclarationTransformer.transformDeclarationContent(this, firClass, data) { - super.transformDeclarationContent(firClass, data) - firClass - } - } - } - - override fun transformDeclarationContent(declaration: FirDeclaration, data: ResolutionMode): FirDeclaration = - ideDeclarationTransformer.transformDeclarationContent(this, declaration, data) { - super.transformDeclarationContent(declaration, data) - } - - override fun transformDeclaration() { - FirLazyBodiesCalculator.calculateLazyBodiesInside(designation) - designation.firFile.transform(this, ResolutionMode.ContextIndependent) - ideDeclarationTransformer.ensureDesignationPassed() - } - - override fun updatePhaseForDeclarationInternals(target: FirElementWithResolveState) { - LLFirPhaseUpdater.updateDeclarationInternalsPhase(target, FirResolvePhase.CONTRACTS, updateForLocalDeclarations = false) - } - - override fun checkIsResolved(target: FirElementWithResolveState) { - target.checkPhase(FirResolvePhase.CONTRACTS) - if (target is FirContractDescriptionOwner) { - // TODO checkContractDescriptionIsResolved(declaration) - } - checkNestedDeclarationsAreResolved(target) - } -} diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirDesignatedExpectActualMatcherTransformer.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirDesignatedExpectActualMatcherTransformer.kt deleted file mode 100644 index 57604d37868..00000000000 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirDesignatedExpectActualMatcherTransformer.kt +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.analysis.low.level.api.fir.transformers - -import org.jetbrains.kotlin.analysis.low.level.api.fir.api.FirDesignationWithFile -import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.FirLazyBodiesCalculator -import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.LLFirPhaseUpdater -import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkPhase -import org.jetbrains.kotlin.fir.FirElementWithResolveState -import org.jetbrains.kotlin.fir.FirSession -import org.jetbrains.kotlin.fir.declarations.FirDeclaration -import org.jetbrains.kotlin.fir.declarations.FirFile -import org.jetbrains.kotlin.fir.declarations.FirRegularClass -import org.jetbrains.kotlin.fir.declarations.FirResolvePhase -import org.jetbrains.kotlin.fir.expressions.FirStatement -import org.jetbrains.kotlin.fir.resolve.ScopeSession -import org.jetbrains.kotlin.fir.resolve.transformers.mpp.FirExpectActualMatcherTransformer - -internal class LLFirDesignatedExpectActualMatcherTransformer( - private val designation: FirDesignationWithFile, - session: FirSession, - scopeSession: ScopeSession, -) : LLFirLazyTransformer, FirExpectActualMatcherTransformer(session, scopeSession) { - - private val declarationTransformer = LLFirDeclarationTransformer(designation) - - override fun transformRegularClass(regularClass: FirRegularClass, data: Nothing?): FirStatement { - return declarationTransformer.transformDeclarationContent(this, regularClass, data) { - super.transformRegularClass(regularClass, data) as FirDeclaration - } as FirStatement - } - - override fun transformFile(file: FirFile, data: Nothing?): FirFile { - return declarationTransformer.transformDeclarationContent(this, file, data) { - super.transformFile(file, data) - } as FirFile - } - - override fun transformDeclaration() { - FirLazyBodiesCalculator.calculateLazyBodiesInside(designation) - designation.firFile.transform(this, null) - declarationTransformer.ensureDesignationPassed() - } - - override fun updatePhaseForDeclarationInternals(target: FirElementWithResolveState) { - LLFirPhaseUpdater.updateDeclarationInternalsPhase( - target, - FirResolvePhase.EXPECT_ACTUAL_MATCHING, - updateForLocalDeclarations = false, - ) - } - - override fun checkIsResolved(target: FirElementWithResolveState) { - target.checkPhase(FirResolvePhase.EXPECT_ACTUAL_MATCHING) - // TODO check if expect-actual matching is present - checkNestedDeclarationsAreResolved(target) - } -} - diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirDesignatedGeneratedCompanionObjectResolveTransformer.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirDesignatedGeneratedCompanionObjectResolveTransformer.kt deleted file mode 100644 index 20c30db7082..00000000000 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirDesignatedGeneratedCompanionObjectResolveTransformer.kt +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.analysis.low.level.api.fir.transformers - -import org.jetbrains.kotlin.analysis.low.level.api.fir.api.FirDesignationWithFile -import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.LLFirPhaseUpdater -import org.jetbrains.kotlin.fir.FirElementWithResolveState -import org.jetbrains.kotlin.fir.FirSession -import org.jetbrains.kotlin.fir.declarations.FirDeclaration -import org.jetbrains.kotlin.fir.declarations.FirResolvePhase -import org.jetbrains.kotlin.fir.resolve.transformers.plugin.FirCompanionGenerationTransformer -import org.jetbrains.kotlin.fir.declarations.resolvePhase - -internal class LLFirDesignatedGeneratedCompanionObjectResolveTransformer( - val designation: FirDesignationWithFile, - session: FirSession -) : LLFirLazyTransformer { - private val transformer: FirCompanionGenerationTransformer = FirCompanionGenerationTransformer(session) - - override fun transformDeclaration() { - designation.target.transform(transformer, null) - } - - override fun updatePhaseForDeclarationInternals(target: FirElementWithResolveState) { - LLFirPhaseUpdater.updateDeclarationInternalsPhase(target, FirResolvePhase.COMPANION_GENERATION, updateForLocalDeclarations = false) - } - - override fun checkIsResolved(target: FirElementWithResolveState) { - check(target.resolvePhase >= FirResolvePhase.COMPANION_GENERATION) - } -} \ No newline at end of file diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirDesignatedImplicitTypesTransformer.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirDesignatedImplicitTypesTransformer.kt deleted file mode 100644 index 3196ae805ad..00000000000 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirDesignatedImplicitTypesTransformer.kt +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.analysis.low.level.api.fir.transformers - -import org.jetbrains.kotlin.analysis.low.level.api.fir.api.FirDesignationWithFile -import org.jetbrains.kotlin.analysis.low.level.api.fir.element.builder.LLFirDesignatedImpliciteTypesBodyResolveTransformerForReturnTypeCalculator -import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.LLFirPhaseUpdater -import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkPhase -import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkReturnTypeRefIsResolved -import org.jetbrains.kotlin.fir.FirElementWithResolveState -import org.jetbrains.kotlin.fir.FirSession -import org.jetbrains.kotlin.fir.declarations.FirCallableDeclaration -import org.jetbrains.kotlin.fir.declarations.FirDeclaration -import org.jetbrains.kotlin.fir.declarations.FirFile -import org.jetbrains.kotlin.fir.declarations.FirResolvePhase -import org.jetbrains.kotlin.fir.resolve.ResolutionMode -import org.jetbrains.kotlin.fir.resolve.ScopeSession -import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirImplicitAwareBodyResolveTransformer -import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirTowerDataContextCollector -import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.ImplicitBodyResolveComputationSession -import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.createReturnTypeCalculatorForIDE - -/** - * Transform designation into IMPLICIT_TYPES_BODY_RESOLVE declaration. Affects only for target declaration, it's children and dependents - */ -internal class LLFirDesignatedImplicitTypesTransformer( - private val designation: FirDesignationWithFile, - session: FirSession, - scopeSession: ScopeSession, - towerDataContextCollector: FirTowerDataContextCollector?, - implicitBodyResolveComputationSession: ImplicitBodyResolveComputationSession = ImplicitBodyResolveComputationSession(), -) : LLFirLazyTransformer, FirImplicitAwareBodyResolveTransformer( - session, - implicitBodyResolveComputationSession = implicitBodyResolveComputationSession, - phase = FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE, - implicitTypeOnly = true, - scopeSession = scopeSession, - firTowerDataContextCollector = towerDataContextCollector, - returnTypeCalculator = createReturnTypeCalculatorForIDE( - scopeSession, - implicitBodyResolveComputationSession, - ::LLFirDesignatedImpliciteTypesBodyResolveTransformerForReturnTypeCalculator - ) -) { - private val ideDeclarationTransformer = LLFirDeclarationTransformer(designation) - - override fun transformDeclarationContent(declaration: FirDeclaration, data: ResolutionMode): FirDeclaration = - ideDeclarationTransformer.transformDeclarationContent(this, declaration, data) { - super.transformDeclarationContent(declaration, data) - } - - override fun transformDeclaration() { - designation.firFile.transform(this, ResolutionMode.ContextIndependent) - ideDeclarationTransformer.ensureDesignationPassed() - } - - override fun updatePhaseForDeclarationInternals(target: FirElementWithResolveState) { - LLFirPhaseUpdater.updateDeclarationInternalsPhase( - target, - FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE, - updateForLocalDeclarations = false, /* here should be true if we resolved the body*/ - ) - } - - override fun checkIsResolved(target: FirElementWithResolveState) { - target.checkPhase(FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE) - if (target is FirCallableDeclaration) { - checkReturnTypeRefIsResolved(target) - } - checkNestedDeclarationsAreResolved(target) - } -} diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirDesignatedStatusResolveTransformer.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirDesignatedStatusResolveTransformer.kt deleted file mode 100644 index 8a645681206..00000000000 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirDesignatedStatusResolveTransformer.kt +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.analysis.low.level.api.fir.transformers - -import org.jetbrains.kotlin.analysis.low.level.api.fir.api.FirDesignationWithFile -import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.LLFirPhaseUpdater -import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkDeclarationStatusIsResolved -import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkPhase -import org.jetbrains.kotlin.fir.FirElementWithResolveState -import org.jetbrains.kotlin.fir.FirSession -import org.jetbrains.kotlin.fir.declarations.* -import org.jetbrains.kotlin.fir.expressions.FirStatement -import org.jetbrains.kotlin.fir.resolve.ScopeSession -import org.jetbrains.kotlin.fir.resolve.transformers.FirStatusResolveTransformer -import org.jetbrains.kotlin.fir.resolve.transformers.StatusComputationSession -import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase -import org.jetbrains.kotlin.fir.visitors.transformSingle - -/** - * Transform designation into STATUS phase. Affects only for designation, members of designation classes, target declaration, it's children and dependents - */ -internal class LLFirDesignatedStatusResolveTransformer( - private val designation: FirDesignationWithFile, - private val session: FirSession, - private val scopeSession: ScopeSession, -) : LLFirLazyTransformer { - private inner class FirDesignatedStatusResolveTransformerForIDE( - private val designationIterator: Iterator, - ) : FirStatusResolveTransformer(session, scopeSession, StatusComputationSession()) { - - private var isInsideTargetDeclaration = false - - override fun transformClass(klass: FirClass, data: FirResolvedDeclarationStatus?): FirStatement { - return storeClass(klass) { - resolveClassTypeParameters(klass) - if (isInsideTargetDeclaration) { - transformDeclarationContent(klass, data) - } else { - resolveCallableMembers(klass, data) - moveNextDeclaration() - } - klass - } as FirStatement - } - - private fun resolveClassTypeParameters(klass: FirClass) { - klass.typeParameters.forEach { it.transformSingle(this, data = null) } - } - - private fun resolveCallableMembers( - klass: FirClass, - data: FirResolvedDeclarationStatus? - ) { - for (member in klass.declarations) { - if (member is FirClassLikeDeclaration) continue - // we need the types to be resolved here to compute visibility - // implicit types will not be handled (see bug in the compiler KT-55446) - member.lazyResolveToPhase(FirResolvePhase.TYPES) - member.transformSingle(this, data) - } - } - - fun moveNextDeclaration() { - if (!designationIterator.hasNext()) { - isInsideTargetDeclaration = true - designation.target.transform(this, data = null) - return - } - val nextClass = designationIterator.next() - transformClassContent(nextClass, data = null) - } - } - - - override fun transformDeclaration() { - val designationIterator = designation.path.iterator() - val transformer = FirDesignatedStatusResolveTransformerForIDE(designationIterator) - transformer.moveNextDeclaration() - } - - override fun updatePhaseForDeclarationInternals(target: FirElementWithResolveState) { - LLFirPhaseUpdater.updateDeclarationInternalsPhase(target, FirResolvePhase.STATUS, updateForLocalDeclarations = false) - } - - override fun checkIsResolved(target: FirElementWithResolveState) { - if (target !is FirAnonymousInitializer) { - target.checkPhase(FirResolvePhase.STATUS) - } - if (target is FirMemberDeclaration) { - checkDeclarationStatusIsResolved(target) - } - checkNestedDeclarationsAreResolved(target) - } -} diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirDesignatedTypeResolverTransformer.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirDesignatedTypeResolverTransformer.kt deleted file mode 100644 index 25bb7391b28..00000000000 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirDesignatedTypeResolverTransformer.kt +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.analysis.low.level.api.fir.transformers - -import org.jetbrains.kotlin.analysis.low.level.api.fir.api.FirDesignationWithFile -import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.FirLazyBodiesCalculator -import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.LLFirPhaseUpdater -import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkPhase -import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkReceiverTypeRefIsResolved -import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkReturnTypeRefIsResolved -import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkTypeRefIsResolved -import org.jetbrains.kotlin.fir.FirElement -import org.jetbrains.kotlin.fir.FirElementWithResolveState -import org.jetbrains.kotlin.fir.FirSession -import org.jetbrains.kotlin.fir.declarations.* -import org.jetbrains.kotlin.fir.resolve.ScopeSession -import org.jetbrains.kotlin.fir.resolve.transformers.FirTypeResolveTransformer -import org.jetbrains.kotlin.fir.types.FirResolvedTypeRef -import org.jetbrains.kotlin.fir.types.FirTypeRef - -/** - * Transform designation into TYPES phase. Affects only for designation, target declaration and it's children - */ -internal class LLFirDesignatedTypeResolverTransformer( - private val designation: FirDesignationWithFile, - session: FirSession, - scopeSession: ScopeSession, -) : LLFirLazyTransformer, FirTypeResolveTransformer(session, scopeSession) { - - private val declarationTransformer = LLFirDeclarationTransformer(designation) - - override fun transformElement(element: E, data: Any?): E { - return if (element is FirDeclaration && (element is FirRegularClass || element is FirFile)) { - @Suppress("UNCHECKED_CAST") - declarationTransformer.transformDeclarationContent(this, element, data) { - super.transformElement(element, data) - } as E - } else { - super.transformElement(element, data) - } - } - - override fun transformDeclaration() { - designation.firFile.transform(this, null) - declarationTransformer.ensureDesignationPassed() - } - - override fun updatePhaseForDeclarationInternals(target: FirElementWithResolveState) { - LLFirPhaseUpdater.updateDeclarationInternalsPhase(target, FirResolvePhase.TYPES, updateForLocalDeclarations = false) - } - - override fun transformTypeRef(typeRef: FirTypeRef, data: Any?): FirResolvedTypeRef { - FirLazyBodiesCalculator.calculateAnnotations(typeRef, session) - return super.transformTypeRef(typeRef, data) - } - - override fun checkIsResolved(target: FirElementWithResolveState) { - target.checkPhase(FirResolvePhase.TYPES) - when (target) { - is FirCallableDeclaration -> { - checkReturnTypeRefIsResolved(target, acceptImplicitTypeRef = true) - checkReceiverTypeRefIsResolved(target) - } - - is FirTypeParameter -> { - for (bound in target.bounds) { - checkTypeRefIsResolved(bound, "type parameter bound", target) - } - } - - else -> {} - } - checkNestedDeclarationsAreResolved(target) - (target as? FirDeclaration)?.let { - checkTypeParametersAreResolved(it) - checkClassMembersAreResolved(it) - } - } -} diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirExpectActualMatcherLazyResolver.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirExpectActualMatcherLazyResolver.kt new file mode 100644 index 00000000000..2d7dc2fc454 --- /dev/null +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirExpectActualMatcherLazyResolver.kt @@ -0,0 +1,74 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.analysis.low.level.api.fir.transformers + +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets.LLFirResolveTarget +import org.jetbrains.kotlin.analysis.low.level.api.fir.file.builder.LLFirLockProvider +import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.LLFirPhaseUpdater +import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkPhase +import org.jetbrains.kotlin.fir.FirElementWithResolveState +import org.jetbrains.kotlin.fir.FirSession +import org.jetbrains.kotlin.fir.declarations.* +import org.jetbrains.kotlin.fir.resolve.ScopeSession +import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirTowerDataContextCollector +import org.jetbrains.kotlin.fir.resolve.transformers.mpp.FirExpectActualMatcherTransformer + +internal object LLFirExpectActualMatcherLazyResolver : LLFirLazyResolver(FirResolvePhase.EXPECT_ACTUAL_MATCHING) { + override fun resolve( + target: LLFirResolveTarget, + lockProvider: LLFirLockProvider, + session: FirSession, + scopeSession: ScopeSession, + towerDataContextCollector: FirTowerDataContextCollector?, + ) { + val resolver = LLFirExpectActualMatchingTargetResolver(target, lockProvider, session, scopeSession) + resolver.resolveDesignation() + } + + override fun updatePhaseForDeclarationInternals(target: FirElementWithResolveState) { + LLFirPhaseUpdater.updateDeclarationInternalsPhase(target, resolverPhase, updateForLocalDeclarations = false) + } + + override fun checkIsResolved(target: FirElementWithResolveState) { + target.checkPhase(resolverPhase) + // TODO check if expect-actual matching is present + checkNestedDeclarationsAreResolved(target) + } +} + +private class LLFirExpectActualMatchingTargetResolver( + target: LLFirResolveTarget, + lockProvider: LLFirLockProvider, + session: FirSession, + scopeSession: ScopeSession, +) : LLFirTargetResolver(target, lockProvider, FirResolvePhase.EXPECT_ACTUAL_MATCHING) { + private val transformer = FirExpectActualMatcherTransformer(session, scopeSession) + + override fun withFile(firFile: FirFile, action: () -> Unit) { + action() + } + + @Deprecated("Should never be called directly, only for override purposes, please use withRegularClass", level = DeprecationLevel.ERROR) + override fun withRegularClassImpl(firClass: FirRegularClass, action: () -> Unit) { + action() + } + + override fun doLazyResolveUnderLock(target: FirElementWithResolveState) { + if (target !is FirMemberDeclaration) return + if (!target.canHaveExpectCounterPart()) return + transformer.transformMemberDeclaration(target) + } + + private fun FirMemberDeclaration.canHaveExpectCounterPart(): Boolean = when (this) { + is FirEnumEntry -> true + is FirProperty -> true + is FirConstructor -> true + is FirSimpleFunction -> true + is FirRegularClass -> true + is FirTypeAlias -> true + else -> false + } +} \ No newline at end of file diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirGeneratedCompanionObjectLazyResolver.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirGeneratedCompanionObjectLazyResolver.kt new file mode 100644 index 00000000000..632c3045112 --- /dev/null +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirGeneratedCompanionObjectLazyResolver.kt @@ -0,0 +1,62 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.analysis.low.level.api.fir.transformers + +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets.LLFirResolveTarget +import org.jetbrains.kotlin.analysis.low.level.api.fir.file.builder.LLFirLockProvider +import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.LLFirPhaseUpdater +import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkPhase +import org.jetbrains.kotlin.fir.FirElementWithResolveState +import org.jetbrains.kotlin.fir.FirSession +import org.jetbrains.kotlin.fir.declarations.FirFile +import org.jetbrains.kotlin.fir.declarations.FirRegularClass +import org.jetbrains.kotlin.fir.declarations.FirResolvePhase +import org.jetbrains.kotlin.fir.resolve.ScopeSession +import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirTowerDataContextCollector +import org.jetbrains.kotlin.fir.resolve.transformers.plugin.FirCompanionGenerationTransformer + +internal object LLFirGeneratedCompanionObjectLazyResolver : LLFirLazyResolver(FirResolvePhase.COMPANION_GENERATION) { + override fun resolve( + target: LLFirResolveTarget, + lockProvider: LLFirLockProvider, + session: FirSession, + scopeSession: ScopeSession, + towerDataContextCollector: FirTowerDataContextCollector?, + ) { + val resolver = LLFirCompanionGenerationTargetResolver(target, lockProvider, session) + resolver.resolveDesignation() + } + + override fun updatePhaseForDeclarationInternals(target: FirElementWithResolveState) { + LLFirPhaseUpdater.updateDeclarationInternalsPhase(target, resolverPhase, updateForLocalDeclarations = false) + } + + override fun checkIsResolved(target: FirElementWithResolveState) { + target.checkPhase(resolverPhase) + } +} + +private class LLFirCompanionGenerationTargetResolver( + target: LLFirResolveTarget, + lockProvider: LLFirLockProvider, + session: FirSession, +) : LLFirTargetResolver(target, lockProvider, FirResolvePhase.COMPANION_GENERATION) { + private val transformer: FirCompanionGenerationTransformer = FirCompanionGenerationTransformer(session) + + override fun withFile(firFile: FirFile, action: () -> Unit) { + action() + } + + @Deprecated("Should never be called directly, only for override purposes, please use withRegularClass", level = DeprecationLevel.ERROR) + override fun withRegularClassImpl(firClass: FirRegularClass, action: () -> Unit) { + action() + } + + override fun doLazyResolveUnderLock(target: FirElementWithResolveState) { + if (target !is FirRegularClass) return + transformer.generateAndUpdateCompanion(target) + } +} \ No newline at end of file diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirImplicitTypesLazyResolver.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirImplicitTypesLazyResolver.kt new file mode 100644 index 00000000000..4cb29258bdf --- /dev/null +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirImplicitTypesLazyResolver.kt @@ -0,0 +1,91 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.analysis.low.level.api.fir.transformers + +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets.LLFirResolveTarget +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.throwUnexpectedFirElementError +import org.jetbrains.kotlin.analysis.low.level.api.fir.file.builder.LLFirLockProvider +import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.LLFirPhaseUpdater +import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkPhase +import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkReturnTypeRefIsResolved +import org.jetbrains.kotlin.fir.FirElementWithResolveState +import org.jetbrains.kotlin.fir.FirFileAnnotationsContainer +import org.jetbrains.kotlin.fir.FirSession +import org.jetbrains.kotlin.fir.declarations.* +import org.jetbrains.kotlin.fir.resolve.ResolutionMode +import org.jetbrains.kotlin.fir.resolve.ScopeSession +import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirImplicitAwareBodyResolveTransformer +import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirTowerDataContextCollector +import org.jetbrains.kotlin.fir.visitors.transformSingle + +internal object LLFirImplicitTypesLazyResolver : LLFirLazyResolver(FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE) { + override fun resolve( + target: LLFirResolveTarget, + lockProvider: LLFirLockProvider, + session: FirSession, + scopeSession: ScopeSession, + towerDataContextCollector: FirTowerDataContextCollector?, + ) { + val resolver = LLFirImplicitBodyTargetResolver(target, lockProvider, session, scopeSession, towerDataContextCollector) + resolver.resolveDesignation() + } + + override fun updatePhaseForDeclarationInternals(target: FirElementWithResolveState) { + LLFirPhaseUpdater.updateDeclarationInternalsPhase( + target, + resolverPhase, + updateForLocalDeclarations = false/* here should be true if we resolved the body*/ + ) + } + + override fun checkIsResolved(target: FirElementWithResolveState) { + target.checkPhase(resolverPhase) + if (target is FirCallableDeclaration) { + checkReturnTypeRefIsResolved(target) + } + + checkNestedDeclarationsAreResolved(target) + } +} + +private class LLFirImplicitBodyTargetResolver( + target: LLFirResolveTarget, + lockProvider: LLFirLockProvider, + session: FirSession, + scopeSession: ScopeSession, + towerDataContextCollector: FirTowerDataContextCollector?, +) : LLFirAbstractBodyTargetResolver( + target, + lockProvider, + scopeSession, + FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE, +) { + override val transformer = object : FirImplicitAwareBodyResolveTransformer( + session, + implicitBodyResolveComputationSession = implicitBodyResolveComputationSession, + phase = resolverPhase, + implicitTypeOnly = true, + scopeSession = scopeSession, + firTowerDataContextCollector = towerDataContextCollector, + returnTypeCalculator = createReturnTypeCalculator(), + ) { + override val preserveCFGForClasses: Boolean get() = false + } + + override fun doLazyResolveUnderLock(target: FirElementWithResolveState) { + when (target) { + is FirRegularClass, is FirDanglingModifierList, is FirAnonymousInitializer, is FirFileAnnotationsContainer, is FirTypeAlias, is FirScript -> { + // no implicit bodies here + } + is FirCallableDeclaration -> { + calculateLazyBodies(target) + target.transformSingle(transformer, ResolutionMode.ContextIndependent) + } + else -> throwUnexpectedFirElementError(target) + } + } +} + diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirLazyPhaseResolverByPhase.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirLazyPhaseResolverByPhase.kt new file mode 100644 index 00000000000..7e99620d608 --- /dev/null +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirLazyPhaseResolverByPhase.kt @@ -0,0 +1,28 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.analysis.low.level.api.fir.transformers + +import org.jetbrains.kotlin.fir.declarations.FirResolvePhase +import java.util.* + +internal object LLFirLazyPhaseResolverByPhase { + private val byPhase = EnumMap(FirResolvePhase::class.java).apply { + this[FirResolvePhase.COMPANION_GENERATION] = LLFirGeneratedCompanionObjectLazyResolver + this[FirResolvePhase.SUPER_TYPES] = LLFirSupertypeLazyResolver + this[FirResolvePhase.TYPES] = LLFirTypeLazyResolver + this[FirResolvePhase.STATUS] = LLFirStatusLazyResolver + this[FirResolvePhase.COMPILER_REQUIRED_ANNOTATIONS] = LLFirCompilerAnnotationsLazyResolver + this[FirResolvePhase.ARGUMENTS_OF_ANNOTATIONS] = LLFirAnnotationArgumentsLazyResolver + this[FirResolvePhase.CONTRACTS] = LLFirContractsLazyResolver + this[FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE] = LLFirImplicitTypesLazyResolver + this[FirResolvePhase.ANNOTATIONS_ARGUMENTS_MAPPING] = LLFirAnnotationArgumentMappingLazyResolver + this[FirResolvePhase.BODY_RESOLVE] = LLFirBodyLazyResolver + this[FirResolvePhase.EXPECT_ACTUAL_MATCHING] = LLFirExpectActualMatcherLazyResolver + this[FirResolvePhase.SEALED_CLASS_INHERITORS] = LLFirSealedClassInheritorsLazyResolver + } + + fun getByPhase(phase: FirResolvePhase): LLFirLazyResolver = byPhase.getValue(phase) +} diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirLazyResolver.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirLazyResolver.kt new file mode 100644 index 00000000000..14559866c0b --- /dev/null +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirLazyResolver.kt @@ -0,0 +1,75 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.analysis.low.level.api.fir.transformers + +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets.LLFirResolveTarget +import org.jetbrains.kotlin.analysis.low.level.api.fir.file.builder.LLFirLockProvider +import org.jetbrains.kotlin.fir.FirElementWithResolveState +import org.jetbrains.kotlin.fir.FirSession +import org.jetbrains.kotlin.fir.declarations.* +import org.jetbrains.kotlin.fir.resolve.ScopeSession +import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirTowerDataContextCollector + +internal abstract class LLFirLazyResolver( + val resolverPhase: FirResolvePhase, +) { + abstract fun resolve( + target: LLFirResolveTarget, + lockProvider: LLFirLockProvider, + session: FirSession, + scopeSession: ScopeSession, + towerDataContextCollector: FirTowerDataContextCollector?, + ) + + abstract fun checkIsResolved(target: FirElementWithResolveState) + + abstract fun updatePhaseForDeclarationInternals(target: FirElementWithResolveState) + + fun checkIsResolved(designation: LLFirResolveTarget) { + designation.forEachTarget(::checkIsResolved) + } + + protected fun checkNestedDeclarationsAreResolved(target: FirElementWithResolveState) { + if (target !is FirDeclaration) return + checkFunctionParametersAreResolved(target) + checkPropertyAccessorsAreResolved(target) + checkPropertyBackingFieldIsResolved(target) + checkTypeParametersAreResolved(target) + } + + private fun checkPropertyAccessorsAreResolved(declaration: FirDeclaration) { + if (declaration is FirProperty) { + declaration.getter?.let { checkIsResolved(it) } + declaration.setter?.let { checkIsResolved(it) } + } + } + + + private fun checkPropertyBackingFieldIsResolved(declaration: FirDeclaration) { + if (declaration is FirProperty) { + declaration.backingField?.let { checkIsResolved(it) } + } + } + + + private fun checkFunctionParametersAreResolved(declaration: FirDeclaration) { + if (declaration is FirFunction) { + for (parameter in declaration.valueParameters) { + checkIsResolved(parameter) + } + } + } + + private fun checkTypeParametersAreResolved(declaration: FirDeclaration) { + if (declaration is FirTypeParameterRefsOwner) { + for (parameter in declaration.typeParameters) { + if (parameter is FirTypeParameter) { + checkIsResolved(parameter) + } + } + } + } +} diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirLazyResolverRunner.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirLazyResolverRunner.kt new file mode 100644 index 00000000000..62785990f8b --- /dev/null +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirLazyResolverRunner.kt @@ -0,0 +1,35 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.analysis.low.level.api.fir.transformers + +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets.LLFirResolveTarget +import org.jetbrains.kotlin.analysis.low.level.api.fir.file.builder.LLFirLockProvider +import org.jetbrains.kotlin.fir.declarations.FirResolvePhase +import org.jetbrains.kotlin.fir.resolve.ScopeSession +import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirTowerDataContextCollector + +internal object LLFirLazyResolverRunner { + fun runLazyResolverByPhase( + phase: FirResolvePhase, + target: LLFirResolveTarget, + scopeSession: ScopeSession, + lockProvider: LLFirLockProvider, + towerDataContextCollector: FirTowerDataContextCollector?, + ) { + val lazyResolver = LLFirLazyPhaseResolverByPhase.getByPhase(phase) + val firFile = target.firFile + val session = firFile.moduleData.session + + // TODO: global lock should be dropped in the context of KT-56550 + lockProvider.withGlobalLock(firFile) { + lockProvider.withGlobalPhaseLock(phase) { + lazyResolver.resolve(target, lockProvider, session, scopeSession, towerDataContextCollector) + } + } + + lazyResolver.checkIsResolved(target) + } +} \ No newline at end of file diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirLazyTransformer.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirLazyTransformer.kt deleted file mode 100644 index e5e6117e34b..00000000000 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirLazyTransformer.kt +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.analysis.low.level.api.fir.transformers - -import org.jetbrains.annotations.TestOnly -import org.jetbrains.kotlin.fir.FirElementWithResolveState -import org.jetbrains.kotlin.fir.declarations.* - -internal interface LLFirLazyTransformer { - fun transformDeclaration() - - fun checkIsResolved(target: FirElementWithResolveState) - - fun updatePhaseForDeclarationInternals(target: FirElementWithResolveState) - - fun checkNestedDeclarationsAreResolved(target: FirElementWithResolveState) { - if (target !is FirDeclaration) return - checkFunctionParametersAreResolved(target) - checkPropertyAccessorsAreResolved(target) - checkClassMembersAreResolved(target) - } - - fun checkClassMembersAreResolved(declaration: FirDeclaration) { - if (!needCheckingIfClassMembersAreResolved) return - if (declaration is FirClass) { - for (member in declaration.declarations) { - checkClassMembersAreResolved(member) - } - } - } - - fun checkPropertyAccessorsAreResolved(declaration: FirDeclaration) { - if (declaration is FirProperty) { - declaration.getter?.let { checkIsResolved(it) } - declaration.setter?.let { checkIsResolved(it) } - } - } - - - fun checkFunctionParametersAreResolved(declaration: FirDeclaration) { - if (declaration is FirFunction) { - for (parameter in declaration.valueParameters) { - checkIsResolved(parameter) - } - } - } - - fun checkTypeParametersAreResolved(declaration: FirDeclaration) { - if (declaration is FirTypeParameterRefsOwner) { - for (parameter in declaration.typeParameters) { - if (parameter is FirTypeParameter) { - checkIsResolved(parameter) - } - } - } - } - - companion object { - internal var needCheckingIfClassMembersAreResolved: Boolean = false - @TestOnly set - - val DUMMY = object : LLFirLazyTransformer { - override fun transformDeclaration() {} - override fun checkIsResolved(target: FirElementWithResolveState) {} - override fun updatePhaseForDeclarationInternals(target: FirElementWithResolveState) {} - } - } -} diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirLazyTransformerExecutor.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirLazyTransformerExecutor.kt deleted file mode 100644 index 2ee82fe840b..00000000000 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirLazyTransformerExecutor.kt +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.analysis.low.level.api.fir.transformers - -import org.jetbrains.kotlin.analysis.low.level.api.fir.api.FirDesignationWithFile -import org.jetbrains.kotlin.analysis.low.level.api.fir.file.builder.LLFirLockProvider -import org.jetbrains.kotlin.fir.declarations.FirResolvePhase -import org.jetbrains.kotlin.fir.declarations.asResolveState -import org.jetbrains.kotlin.fir.resolve.ScopeSession -import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirTowerDataContextCollector - -internal object LLFirLazyTransformerExecutor { - fun execute( - phase: FirResolvePhase, - designation: FirDesignationWithFile, - scopeSession: ScopeSession, - lockProvider: LLFirLockProvider, - towerDataContextCollector: FirTowerDataContextCollector? - ) { - val lazyTransformer = LazyTransformerFactory.createLazyTransformer( - phase, - designation, - scopeSession, - lockProvider, - towerDataContextCollector, - ) - - lockProvider.withLock(designation.firFile) { - lazyTransformer.transformDeclaration() - lazyTransformer.updatePhaseForDeclarationInternals(designation.target) - designation.target.replaceResolveState(phase.asResolveState()) - lazyTransformer.checkIsResolved(designation.target) - } - } -} \ No newline at end of file diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirSealedClassInheritorsLazyResolver.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirSealedClassInheritorsLazyResolver.kt new file mode 100644 index 00000000000..ba403f502c2 --- /dev/null +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirSealedClassInheritorsLazyResolver.kt @@ -0,0 +1,61 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.analysis.low.level.api.fir.transformers + +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets.LLFirResolveTarget +import org.jetbrains.kotlin.analysis.low.level.api.fir.file.builder.LLFirLockProvider +import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.LLFirPhaseUpdater +import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkPhase +import org.jetbrains.kotlin.fir.FirElementWithResolveState +import org.jetbrains.kotlin.fir.FirSession +import org.jetbrains.kotlin.fir.declarations.FirFile +import org.jetbrains.kotlin.fir.declarations.FirRegularClass +import org.jetbrains.kotlin.fir.declarations.FirResolvePhase +import org.jetbrains.kotlin.fir.resolve.ScopeSession +import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirTowerDataContextCollector + +internal object LLFirSealedClassInheritorsLazyResolver : LLFirLazyResolver(FirResolvePhase.SEALED_CLASS_INHERITORS) { + override fun resolve( + target: LLFirResolveTarget, + lockProvider: LLFirLockProvider, + session: FirSession, + scopeSession: ScopeSession, + towerDataContextCollector: FirTowerDataContextCollector?, + ) { + val resolver = LLFirSealedClassInheritorsDesignatedResolver(target, lockProvider) + resolver.resolveDesignation() + } + + + override fun updatePhaseForDeclarationInternals(target: FirElementWithResolveState) { + LLFirPhaseUpdater.updateDeclarationInternalsPhase(target, resolverPhase, updateForLocalDeclarations = false) + } + + override fun checkIsResolved(target: FirElementWithResolveState) { + target.checkPhase(resolverPhase) + checkNestedDeclarationsAreResolved(target) + } +} + + +private class LLFirSealedClassInheritorsDesignatedResolver( + target: LLFirResolveTarget, + lockProvider: LLFirLockProvider, +) : LLFirTargetResolver(target, lockProvider, FirResolvePhase.SEALED_CLASS_INHERITORS) { + + override fun withFile(firFile: FirFile, action: () -> Unit) { + action() + } + + @Deprecated("Should never be called directly, only for override purposes, please use withRegularClass", level = DeprecationLevel.ERROR) + override fun withRegularClassImpl(firClass: FirRegularClass, action: () -> Unit) { + action() + } + + override fun doLazyResolveUnderLock(target: FirElementWithResolveState) { + // just update the phase + } +} \ No newline at end of file diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirStatusLazyResolver.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirStatusLazyResolver.kt new file mode 100644 index 00000000000..330eaaaf6c3 --- /dev/null +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirStatusLazyResolver.kt @@ -0,0 +1,159 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.analysis.low.level.api.fir.transformers + +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.collectDesignationWithFile +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets.LLFirResolveTarget +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets.asResolveTarget +import org.jetbrains.kotlin.analysis.low.level.api.fir.file.builder.LLFirLockProvider +import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.LLFirPhaseUpdater +import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkDeclarationStatusIsResolved +import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkPhase +import org.jetbrains.kotlin.fir.FirElementWithResolveState +import org.jetbrains.kotlin.fir.FirSession +import org.jetbrains.kotlin.fir.declarations.* +import org.jetbrains.kotlin.fir.expressions.FirStatement +import org.jetbrains.kotlin.fir.resolve.ScopeSession +import org.jetbrains.kotlin.fir.resolve.transformers.FirStatusResolveTransformer +import org.jetbrains.kotlin.fir.resolve.transformers.StatusComputationSession +import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirTowerDataContextCollector +import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase +import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhaseWithCallableMembers +import org.jetbrains.kotlin.fir.visitors.transformSingle + +internal object LLFirStatusLazyResolver : LLFirLazyResolver(FirResolvePhase.STATUS) { + override fun resolve( + target: LLFirResolveTarget, + lockProvider: LLFirLockProvider, + session: FirSession, + scopeSession: ScopeSession, + towerDataContextCollector: FirTowerDataContextCollector?, + ) { + val resolver = LLFirStatusTargetResolver(target, lockProvider, session, scopeSession) + resolver.resolveDesignation() + } + + override fun updatePhaseForDeclarationInternals(target: FirElementWithResolveState) { + LLFirPhaseUpdater.updateDeclarationInternalsPhase(target, resolverPhase, updateForLocalDeclarations = false) + } + + override fun checkIsResolved(target: FirElementWithResolveState) { + if (target !is FirAnonymousInitializer) { + target.checkPhase(resolverPhase) + } + if (target is FirMemberDeclaration) { + checkDeclarationStatusIsResolved(target) + } + checkNestedDeclarationsAreResolved(target) + } +} + +private class LLFirStatusTargetResolver( + target: LLFirResolveTarget, + lockProvider: LLFirLockProvider, + session: FirSession, + scopeSession: ScopeSession, + private val statusComputationSession: StatusComputationSession = StatusComputationSession() +) : LLFirTargetResolver(target, lockProvider, FirResolvePhase.STATUS, isJumpingPhase = true) { + private val transformer = Transformer(session, scopeSession) + + override fun withFile(firFile: FirFile, action: () -> Unit) { + action() + } + + @Deprecated("Should never be called directly, only for override purposes, please use withRegularClass", level = DeprecationLevel.ERROR) + override fun withRegularClassImpl(firClass: FirRegularClass, action: () -> Unit) { + firClass.lazyResolveToPhase(resolverPhase.previous) + resolveClass(firClass, action) + } + + private fun resolveClassTypeParameters(klass: FirClass) { + klass.typeParameters.forEach { it.transformSingle(transformer, data = null) } + } + + private fun resolveCallableMembers(klass: FirClass) { + // we need the types to be resolved here to compute visibility + // implicit types will not be handled (see bug in the compiler KT-55446) + klass.lazyResolveToPhaseWithCallableMembers(resolverPhase.previous) + for (member in klass.declarations) { + if (member !is FirCallableDeclaration) continue + performResolve(member) + } + } + + override fun doResolveWithoutLock(target: FirElementWithResolveState): Boolean { + return when (target) { + is FirRegularClass -> { + resolveClass(target, action = {}) + true + } + else -> { + false + } + } + } + + override fun doLazyResolveUnderLock(target: FirElementWithResolveState) { + when (target) { + is FirRegularClass -> { + error("should be resolved in doResolveWithoutLock") + } + else -> { + target.transformSingle(transformer, data = null) + } + } + } + + private fun resolveClass(firClass: FirRegularClass, action: () -> Unit) { + transformer.statusComputationSession.startComputing(firClass) + transformer.forceResolveStatusesOfSupertypes(firClass) + + performCustomResolveUnderLock(firClass) { + transformer.transformClassStatus(firClass) + transformer.transformValueClassRepresentation(firClass) + transformer.storeClass(firClass) { + resolveClassTypeParameters(firClass) + firClass + } + } + + transformer.storeClass(firClass) { + resolveCallableMembers(firClass) + firClass + } + + transformer.storeClass(firClass) { + action() + firClass + } + + transformer.statusComputationSession.endComputing(firClass) + } + + + private inner class Transformer( + session: FirSession, + scopeSession: ScopeSession, + ) : FirStatusResolveTransformer(session, scopeSession, statusComputationSession) { + + override fun FirDeclaration.needResolveMembers(): Boolean = false + override fun FirDeclaration.needResolveNestedClassifiers(): Boolean = false + + override fun transformClass(klass: FirClass, data: FirResolvedDeclarationStatus?): FirStatement { + return klass + } + + override fun resolveClassForSuperType(regularClass: FirRegularClass): Boolean { + if (regularClass.resolvePhase >= resolverPhase) return true + regularClass.lazyResolveToPhase(resolverPhase.previous) + + val designation = regularClass.collectDesignationWithFile().asResolveTarget() + val resolver = LLFirStatusTargetResolver(designation, lockProvider, session, scopeSession, statusComputationSession) + resolver.resolveDesignation() + return true + } + } +} diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirDesignatedSupertypeResolverTransformer.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirSupertypeLazyResolver.kt similarity index 57% rename from analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirDesignatedSupertypeResolverTransformer.kt rename to analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirSupertypeLazyResolver.kt index 05dab6c3a29..97d4d3c411a 100644 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirDesignatedSupertypeResolverTransformer.kt +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirSupertypeLazyResolver.kt @@ -8,6 +8,7 @@ package org.jetbrains.kotlin.analysis.low.level.api.fir.transformers import org.jetbrains.kotlin.analysis.low.level.api.fir.api.FirDesignation import org.jetbrains.kotlin.analysis.low.level.api.fir.api.FirDesignationWithFile import org.jetbrains.kotlin.analysis.low.level.api.fir.api.collectDesignation +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets.LLFirResolveTarget import org.jetbrains.kotlin.analysis.low.level.api.fir.file.builder.LLFirLockProvider import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.LLFirPhaseUpdater import org.jetbrains.kotlin.analysis.low.level.api.fir.sessions.llFirResolvableSession @@ -20,33 +21,102 @@ import org.jetbrains.kotlin.fir.FirElementWithResolveState import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.java.declarations.FirJavaClass +import org.jetbrains.kotlin.fir.render import org.jetbrains.kotlin.fir.resolve.ScopeSession -import org.jetbrains.kotlin.fir.resolve.transformers.* +import org.jetbrains.kotlin.fir.resolve.transformers.FirApplySupertypesTransformer +import org.jetbrains.kotlin.fir.resolve.transformers.FirSupertypeResolverVisitor +import org.jetbrains.kotlin.fir.resolve.transformers.SupertypeComputationSession +import org.jetbrains.kotlin.fir.resolve.transformers.SupertypeComputationStatus +import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirTowerDataContextCollector import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase import org.jetbrains.kotlin.fir.types.ConeClassLikeType import org.jetbrains.kotlin.fir.types.ConeKotlinType import org.jetbrains.kotlin.fir.types.toSymbol import org.jetbrains.kotlin.fir.types.type +import org.jetbrains.kotlin.fir.visitors.FirDefaultTransformer +import org.jetbrains.kotlin.fir.visitors.FirVisitor -/** - * Transform designation into SUPER_TYPES phase. Affects only the designation, target declaration, its children, and dependents. - */ -internal class LLFirDesignatedSupertypeResolverTransformer( - private val designation: FirDesignationWithFile, +internal object LLFirSupertypeLazyResolver : LLFirLazyResolver(FirResolvePhase.SUPER_TYPES) { + override fun resolve( + target: LLFirResolveTarget, + lockProvider: LLFirLockProvider, + session: FirSession, + scopeSession: ScopeSession, + towerDataContextCollector: FirTowerDataContextCollector?, + ) { + val resolver = LLFirSuperTypeTargetResolver(target, lockProvider, session, scopeSession) + resolver.resolveDesignation() + } + + override fun updatePhaseForDeclarationInternals(target: FirElementWithResolveState) { + LLFirPhaseUpdater.updateDeclarationInternalsPhase(target, resolverPhase, updateForLocalDeclarations = false) + } + + override fun checkIsResolved(target: FirElementWithResolveState) { + target.checkPhase(resolverPhase) + when (target) { + is FirClass -> { + for (superTypeRef in target.superTypeRefs) { + checkTypeRefIsResolved(superTypeRef, "class super type", target) + } + } + + is FirTypeAlias -> { + checkTypeRefIsResolved(target.expandedTypeRef, typeRefName = "type alias expanded type", target) + } + + else -> {} + } + } +} + +internal class LLFirSuperTypeTargetResolver( + target: LLFirResolveTarget, + lockProvider: LLFirLockProvider, private val session: FirSession, private val scopeSession: ScopeSession, - private val lockProvider: LLFirLockProvider -) : LLFirLazyTransformer { +) : LLFirTargetResolver(target, lockProvider, FirResolvePhase.SUPER_TYPES) { private val supertypeComputationSession = SupertypeComputationSession() + override fun withFile(firFile: FirFile, action: () -> Unit) { + action() + } + + @Deprecated("Should never be called directly, only for override purposes, please use withRegularClass", level = DeprecationLevel.ERROR) + override fun withRegularClassImpl(firClass: FirRegularClass, action: () -> Unit) { + doResolveWithoutLock(firClass) + action() + } + + override fun doResolveWithoutLock(target: FirElementWithResolveState): Boolean { + when (target) { + is FirRegularClass, is FirTypeAlias -> { + val designationToResolve = FirDesignationWithFile(nestedClassesStack, target, resolveTarget.firFile) + val collected = collect(designationToResolve) + supertypeComputationSession.breakLoops(session) + apply(collected) + } + else -> { + performCustomResolveUnderLock(target) { + // just update the phase + } + } + } + return true + } + + override fun doLazyResolveUnderLock(target: FirElementWithResolveState) { + error("Should be resolved without lock in ${::doResolveWithoutLock.name}") + } + private inner class DesignatedFirSupertypeResolverVisitor(classDesignation: FirDesignation) : FirSupertypeResolverVisitor( session = session, supertypeComputationSession = supertypeComputationSession, scopeSession = scopeSession, scopeForLocalClass = null, - localClassesNavigationInfo = null + localClassesNavigationInfo = null, ) { val declarationTransformer = LLFirDeclarationTransformer(classDesignation) @@ -87,6 +157,7 @@ internal class LLFirDesignatedSupertypeResolverTransformer( supertypeComputationStatus.supertypeRefs.forEach { crawlSupertype(it.type) } } } + return visited.values } @@ -94,9 +165,7 @@ internal class LLFirDesignatedSupertypeResolverTransformer( checkCanceled() val resolver = DesignatedFirSupertypeResolverVisitor(designation) designation.firFile.lazyResolveToPhase(FirResolvePhase.IMPORTS) - lockProvider.withLock(designation.firFile) { - designation.firFile.accept(resolver, null) - } + designation.firFile.accept(resolver, null) resolver.declarationTransformer.ensureDesignationPassed() visited[designation.target] = designation } @@ -135,55 +204,84 @@ internal class LLFirDesignatedSupertypeResolverTransformer( for (designation in designations) { checkCanceled() val applier = DesignatedFirApplySupertypesTransformer(designation) - designation.firFile.transform(applier, null) - applier.declarationTransformer.ensureDesignationPassed() + (designation.target as FirDeclaration).lazyResolveToPhase(resolverPhase.previous) + performCustomResolveUnderLock(designation.target) { + designation.firFile.transform(applier, null) + applier.declarationTransformer.ensureDesignationPassed() + } } } val filesToDesignations = designations.groupBy { it.firFile } for (designationsPerFile in filesToDesignations) { checkCanceled() - lockProvider.withLock(designationsPerFile.key) { - val session = designationsPerFile.key.llFirResolvableSession - ?: error("When FirFile exists for the declaration, the session should be resolvevablable") - withInvalidationOnException(session) { - applyToFileSymbols(designationsPerFile.value) - } + val session = designationsPerFile.key.llFirResolvableSession + ?: error("When FirFile exists for the declaration, the session should be resolvable") + withInvalidationOnException(session) { + applyToFileSymbols(designationsPerFile.value) } } } - - override fun transformDeclaration() { - val targetDesignation = if (designation.target !is FirClassLikeDeclaration) { - val resolvableTarget = designation.path.lastOrNull() ?: return - val targetPath = designation.path.dropLast(1) - FirDesignationWithFile(targetPath, resolvableTarget, designation.firFile) - } else designation - - val collected = collect(targetDesignation) - supertypeComputationSession.breakLoops(session) - apply(collected) - } - - override fun updatePhaseForDeclarationInternals(target: FirElementWithResolveState) { - LLFirPhaseUpdater.updateDeclarationInternalsPhase(target, FirResolvePhase.SUPER_TYPES, updateForLocalDeclarations = false) - } - - override fun checkIsResolved(target: FirElementWithResolveState) { - target.checkPhase(FirResolvePhase.SUPER_TYPES) - when (target) { - is FirClass -> { - for (superTypeRef in target.superTypeRefs) { - checkTypeRefIsResolved(superTypeRef, "class super type", target) - } - } - - is FirTypeAlias -> { - checkTypeRefIsResolved(target.expandedTypeRef, typeRefName = "type alias expanded type", target) - } - - else -> {} - } - checkNestedDeclarationsAreResolved(target) - } +} + +private class LLFirDeclarationTransformer(private val designation: FirDesignation) { + private val designationWithoutTargetIterator = designation.toSequence(includeTarget = false).iterator() + private var isInsideTargetDeclaration: Boolean = false + private var designationPassed: Boolean = false + + inline fun visitDeclarationContent( + visitor: FirVisitor, + declaration: FirDeclaration, + data: D, + default: () -> FirDeclaration + ): FirDeclaration = processDeclarationContent(declaration, default) { + it.accept(visitor, data) + } + + inline fun transformDeclarationContent( + transformer: FirDefaultTransformer, + declaration: FirDeclaration, + data: D, + default: () -> FirDeclaration + ): FirDeclaration = processDeclarationContent(declaration, default) { toTransform -> + toTransform.transform(transformer, data).also { transformed -> + check(transformed === toTransform) { + "become $transformed `${transformed.render()}`, was ${toTransform}: `${toTransform.render()}`" + } + } + } + + private inline fun processDeclarationContent( + declaration: FirDeclaration, + default: () -> FirDeclaration, + applyToDesignated: (FirElementWithResolveState) -> Unit, + ): FirDeclaration { + //It means that we are inside the target declaration + if (isInsideTargetDeclaration) { + return default() + } + + //It means that we already transform target declaration and now can skip all others + if (designationPassed) { + return declaration + } + + if (designationWithoutTargetIterator.hasNext()) { + applyToDesignated(designationWithoutTargetIterator.next()) + } else { + try { + isInsideTargetDeclaration = true + designationPassed = true + applyToDesignated(designation.target) + } finally { + isInsideTargetDeclaration = false + } + } + + return declaration + } + + fun ensureDesignationPassed() { + check(designationPassed) { "Designation not passed for declaration ${designation.target::class.simpleName}" } + } } diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirTargetResolver.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirTargetResolver.kt new file mode 100644 index 00000000000..b84bb257fa6 --- /dev/null +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirTargetResolver.kt @@ -0,0 +1,128 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.analysis.low.level.api.fir.transformers + +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets.* +import org.jetbrains.kotlin.analysis.low.level.api.fir.file.builder.LLFirLockProvider +import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkPhase +import org.jetbrains.kotlin.fir.FirElementWithResolveState +import org.jetbrains.kotlin.fir.declarations.FirFile +import org.jetbrains.kotlin.fir.declarations.FirRegularClass +import org.jetbrains.kotlin.fir.declarations.FirResolvePhase + +internal abstract class LLFirTargetResolver( + protected val resolveTarget: LLFirResolveTarget, + protected val lockProvider: LLFirLockProvider, + protected val resolverPhase: FirResolvePhase, + private val isJumpingPhase: Boolean = false, +) { + private val _nestedClassesStack = mutableListOf() + + val nestedClassesStack: List get() = _nestedClassesStack.toList() + + protected abstract fun withFile(firFile: FirFile, action: () -> Unit) + + @Deprecated("Should never be called directly, only for override purposes, please use withRegularClass", level = DeprecationLevel.ERROR) + protected abstract fun withRegularClassImpl(firClass: FirRegularClass, action: () -> Unit) + + @Suppress("DEPRECATION_ERROR") + protected fun withRegularClass(firClass: FirRegularClass, action: () -> Unit) { + _nestedClassesStack += firClass + withRegularClassImpl(firClass, action) + check(_nestedClassesStack.removeLast() === firClass) + } + + protected open fun checkResolveConsistency() {} + + protected open fun doResolveWithoutLock(target: FirElementWithResolveState): Boolean = false + protected abstract fun doLazyResolveUnderLock(target: FirElementWithResolveState) + + fun resolveDesignation() { + checkResolveConsistency() + withFile(resolveTarget.firFile) { + goToTargets(resolveTarget.path.iterator()) + } + } + + private fun goToTargets(iterator: Iterator) { + if (iterator.hasNext()) { + val firClass = iterator.next() + withRegularClass(firClass) { + goToTargets(iterator) + } + } else { + when (resolveTarget) { + is LLFirClassWithSpecificMembersResolveTarget -> { + performResolve(resolveTarget.target) + withRegularClass(resolveTarget.target) { + resolveTarget.forEachMember(::performResolve) + } + } + is LLFirClassWithAllMembersResolveTarget -> { + performResolve(resolveTarget.target) + withRegularClass(resolveTarget.target) { + resolveTarget.forEachMember(::performResolve) + } + } + is LLFirClassWithAllCallablesResolveTarget -> { + performResolve(resolveTarget.target) + withRegularClass(resolveTarget.target) { + resolveTarget.forEachCallable(::performResolve) + } + } + is LLFirSingleResolveTarget -> { + performResolve(resolveTarget.target) + } + is LLFirWholeFileResolveTarget -> { + resolveTarget.forEachTopLevelDeclaration(::resolveTargetWithNestedDeclarations) + } + } + } + } + + private fun resolveTargetWithNestedDeclarations(target: FirElementWithResolveState) { + performResolve(target) + if (target is FirRegularClass) { + withRegularClass(target) { + for (member in target.declarations) { + resolveTargetWithNestedDeclarations(member) + } + } + } + } + + protected fun performResolve(target: FirElementWithResolveState) { + if (doResolveWithoutLock(target)) return + performCustomResolveUnderLock(target) { + doLazyResolveUnderLock(target) + } + } + + protected inline fun performCustomResolveUnderLock(target: FirElementWithResolveState, crossinline action: () -> Unit) { + checkThatResolvedAtLeastToPreviousPhase(target) + withPossiblyJumpingLock(target) { + action() + LLFirLazyPhaseResolverByPhase.getByPhase(resolverPhase).updatePhaseForDeclarationInternals(target) + } + } + + private inline fun withPossiblyJumpingLock(target: FirElementWithResolveState, action: () -> Unit) { + if (isJumpingPhase) { + lockProvider.withJumpingLock(target, resolverPhase, action) + } else { + lockProvider.withLock(target, resolverPhase, action) + } + } + + private fun checkThatResolvedAtLeastToPreviousPhase(target: FirElementWithResolveState) { + when (val previousPhase = resolverPhase.previous) { + FirResolvePhase.IMPORTS -> {} + else -> { + target.checkPhase(previousPhase) + } + } + } +} \ No newline at end of file diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirTypeLazyResolver.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirTypeLazyResolver.kt new file mode 100644 index 00000000000..bf19dcbd1a2 --- /dev/null +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LLFirTypeLazyResolver.kt @@ -0,0 +1,152 @@ +/* + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.analysis.low.level.api.fir.transformers + +import org.jetbrains.kotlin.analysis.low.level.api.fir.api.targets.LLFirResolveTarget +import org.jetbrains.kotlin.analysis.low.level.api.fir.file.builder.LLFirLockProvider +import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.FirLazyBodiesCalculator +import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.LLFirPhaseUpdater +import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkPhase +import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkReceiverTypeRefIsResolved +import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkReturnTypeRefIsResolved +import org.jetbrains.kotlin.analysis.low.level.api.fir.util.checkTypeRefIsResolved +import org.jetbrains.kotlin.fir.FirElementWithResolveState +import org.jetbrains.kotlin.fir.FirFileAnnotationsContainer +import org.jetbrains.kotlin.fir.FirSession +import org.jetbrains.kotlin.fir.declarations.* +import org.jetbrains.kotlin.fir.resolve.ScopeSession +import org.jetbrains.kotlin.fir.resolve.transformers.FirTypeResolveTransformer +import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirTowerDataContextCollector +import org.jetbrains.kotlin.fir.symbols.lazyResolveToPhase +import org.jetbrains.kotlin.fir.types.FirResolvedTypeRef +import org.jetbrains.kotlin.fir.types.FirTypeRef +import org.jetbrains.kotlin.fir.visitors.transformSingle + +internal object LLFirTypeLazyResolver : LLFirLazyResolver(FirResolvePhase.TYPES) { + override fun resolve( + target: LLFirResolveTarget, + lockProvider: LLFirLockProvider, + session: FirSession, + scopeSession: ScopeSession, + towerDataContextCollector: FirTowerDataContextCollector?, + ) { + val resolver = LLFirTypeTargetResolver(target, lockProvider, session, scopeSession) + resolver.resolveDesignation() + } + + override fun updatePhaseForDeclarationInternals(target: FirElementWithResolveState) { + LLFirPhaseUpdater.updateDeclarationInternalsPhase(target, resolverPhase, updateForLocalDeclarations = false) + } + + override fun checkIsResolved(target: FirElementWithResolveState) { + target.checkPhase(resolverPhase) + if (target is FirConstructor) { + target.delegatedConstructor?.let { delegated -> + checkTypeRefIsResolved(delegated.constructedTypeRef, "constructor type reference", target, acceptImplicitTypeRef = true) + } + } + when (target) { + is FirCallableDeclaration -> { + checkReturnTypeRefIsResolved(target, acceptImplicitTypeRef = true) + checkReceiverTypeRefIsResolved(target) + } + + is FirTypeParameter -> { + for (bound in target.bounds) { + checkTypeRefIsResolved(bound, "type parameter bound", target) + } + } + + else -> {} + } + + checkNestedDeclarationsAreResolved(target) + } +} + +private class LLFirTypeTargetResolver( + target: LLFirResolveTarget, + lockProvider: LLFirLockProvider, + session: FirSession, + scopeSession: ScopeSession, +) : LLFirTargetResolver(target, lockProvider, FirResolvePhase.TYPES) { + private val transformer = object : FirTypeResolveTransformer(session, scopeSession) { + override fun transformTypeRef(typeRef: FirTypeRef, data: Any?): FirResolvedTypeRef { + FirLazyBodiesCalculator.calculateAnnotations(typeRef, session) + return super.transformTypeRef(typeRef, data) + } + } + + override fun withFile(firFile: FirFile, action: () -> Unit) { + transformer.withFileScope(firFile) { + action() + } + } + + @Deprecated("Should never be called directly, only for override purposes, please use withRegularClass", level = DeprecationLevel.ERROR) + override fun withRegularClassImpl(firClass: FirRegularClass, action: () -> Unit) { + firClass.lazyResolveToPhase(resolverPhase.previous) + transformer.withClassDeclarationCleanup(firClass) { + performCustomResolveUnderLock(firClass) { + resolveClassTypes(firClass) + } + + transformer.withClassScopes( + firClass, + actionInsideStaticScope = { + resolveConstructors(firClass) + }, + action = action, + ) + } + } + + private fun resolveConstructors(firClass: FirRegularClass): Unit = transformer.withScopeCleanup { + transformer.addTypeParametersScope(firClass) + + for (member in firClass.declarations) { + if (member !is FirConstructor) continue + + member.lazyResolveToPhase(resolverPhase.previous) + + performCustomResolveUnderLock(member) { + // ConstructedTypeRef should be resolved only with type parameters, but not with nested classes and classes from supertypes + transformer.transformDelegatedConstructorCall(member) + + transformer.withClassScopes(firClass) { + member.accept(transformer, null) + } + } + } + } + + override fun doLazyResolveUnderLock(target: FirElementWithResolveState) { + when (target) { + is FirDanglingModifierList, is FirFileAnnotationsContainer, is FirCallableDeclaration, is FirTypeAlias, is FirScript -> { + target.accept(transformer, null) + } + + is FirRegularClass -> { + resolveClassTypes(target) + } + is FirAnonymousInitializer -> {} + else -> error("Unknown declaration ${target::class.java}") + } + } + + private fun resolveClassTypes(firClass: FirRegularClass) { + transformer.transformClassTypeParameters(firClass, null) + transformer.withScopeCleanup { + firClass.transformAnnotations(transformer, null) + } + + transformer.withClassScopes(firClass) { + for (contextReceiver in firClass.contextReceivers) { + contextReceiver.transformSingle(transformer, null) + } + } + } +} \ No newline at end of file diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LazyTransformerFactory.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LazyTransformerFactory.kt deleted file mode 100644 index a115659ba4c..00000000000 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/transformers/LazyTransformerFactory.kt +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. - * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. - */ - -package org.jetbrains.kotlin.analysis.low.level.api.fir.transformers - -import org.jetbrains.kotlin.analysis.low.level.api.fir.api.FirDesignationWithFile -import org.jetbrains.kotlin.analysis.low.level.api.fir.file.builder.LLFirLockProvider -import org.jetbrains.kotlin.fir.declarations.FirResolvePhase -import org.jetbrains.kotlin.fir.resolve.ScopeSession -import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirTowerDataContextCollector - -internal object LazyTransformerFactory { - fun createLazyTransformer( - phase: FirResolvePhase, - designation: FirDesignationWithFile, - scopeSession: ScopeSession, - lockProvider: LLFirLockProvider, - towerDataContextCollector: FirTowerDataContextCollector? - ): LLFirLazyTransformer = when (phase) { - FirResolvePhase.COMPANION_GENERATION -> LLFirDesignatedGeneratedCompanionObjectResolveTransformer( - designation = designation, - session = designation.firFile.moduleData.session, - ) - FirResolvePhase.SEALED_CLASS_INHERITORS -> LLFirLazyTransformer.DUMMY - FirResolvePhase.SUPER_TYPES -> LLFirDesignatedSupertypeResolverTransformer( - designation = designation, - session = designation.firFile.moduleData.session, - scopeSession = scopeSession, - lockProvider = lockProvider - ) - FirResolvePhase.TYPES -> LLFirDesignatedTypeResolverTransformer( - designation, - designation.firFile.moduleData.session, - scopeSession, - ) - FirResolvePhase.STATUS -> LLFirDesignatedStatusResolveTransformer( - designation, - designation.firFile.moduleData.session, - scopeSession, - ) - FirResolvePhase.EXPECT_ACTUAL_MATCHING -> LLFirDesignatedExpectActualMatcherTransformer( - designation, - designation.firFile.moduleData.session, - scopeSession - ) - FirResolvePhase.COMPILER_REQUIRED_ANNOTATIONS -> LLFirDesignatedAnnotationsResolveTransformed( - designation, - designation.firFile.moduleData.session, - scopeSession, - ) - FirResolvePhase.ARGUMENTS_OF_ANNOTATIONS -> LLFirDesignatedAnnotationArgumentsResolveTransformer( - designation, - designation.firFile.moduleData.session, - scopeSession, - ) - FirResolvePhase.CONTRACTS -> LLFirDesignatedContractsResolveTransformer( - designation, - designation.firFile.moduleData.session, - scopeSession, - ) - FirResolvePhase.IMPLICIT_TYPES_BODY_RESOLVE -> LLFirDesignatedImplicitTypesTransformer( - designation, - designation.firFile.moduleData.session, - scopeSession, - towerDataContextCollector - ) - FirResolvePhase.ANNOTATIONS_ARGUMENTS_MAPPING -> LLFirDesignatedAnnotationArgumentsMappingTransformer( - designation, - designation.firFile.moduleData.session, - scopeSession, - ) - FirResolvePhase.BODY_RESOLVE -> LLFirDesignatedBodyResolveTransformer( - designation, - designation.firFile.moduleData.session, - scopeSession, - towerDataContextCollector - ) - FirResolvePhase.RAW_FIR -> error("Non-lazy phase $phase") - FirResolvePhase.IMPORTS -> error("Non-lazy phase $phase") - } -} diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/util/containingFileUtils.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/util/containingFileUtils.kt index 1abfd3f0f04..4bdc8ef381f 100644 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/util/containingFileUtils.kt +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/util/containingFileUtils.kt @@ -24,6 +24,7 @@ fun FirElementWithResolveState.getContainingFile(): FirFile? { is FirValueParameter -> containingFunctionSymbol.fir.getContainingFile() is FirCallableDeclaration -> provider.getFirCallableContainerFile(symbol) is FirClassLikeDeclaration -> provider.getFirClassifierContainerFileIfAny(symbol) + is FirAnonymousInitializer -> containingClass().getContainingFile() is FirDanglingModifierList -> { val ktFile = psi?.containingFile as? KtFile ?: error("File for dangling modifier list cannot be null") diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/util/declarationUtils.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/util/declarationUtils.kt index 13cdc0171d1..df80816abb3 100644 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/util/declarationUtils.kt +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/util/declarationUtils.kt @@ -9,10 +9,13 @@ import org.jetbrains.kotlin.analysis.low.level.api.fir.api.throwUnexpectedFirEle import org.jetbrains.kotlin.analysis.low.level.api.fir.element.builder.getNonLocalContainingOrThisDeclaration import org.jetbrains.kotlin.analysis.low.level.api.fir.file.builder.LLFirFileBuilder import org.jetbrains.kotlin.analysis.low.level.api.fir.providers.LLFirProvider +import org.jetbrains.kotlin.analysis.low.level.api.fir.sessions.llFirSession import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.psi import org.jetbrains.kotlin.fir.realPsi import org.jetbrains.kotlin.fir.resolve.providers.FirProvider +import org.jetbrains.kotlin.fir.resolve.toSymbol +import org.jetbrains.kotlin.fir.types.ConeLookupTagBasedType import org.jetbrains.kotlin.psi.* import org.jetbrains.kotlin.psi.psiUtil.containingClassOrObject @@ -95,7 +98,7 @@ private fun KtDeclaration.findSourceNonLocalFirDeclarationByProvider( */ declarations?.firstOrNull { it.psi == this || it.psi == original } } - this is KtConstructor<*> -> { + this is KtConstructor<*> || this is KtClassInitializer -> { val containingClass = containingClassOrObject ?: errorWithFirSpecificEntries("Container class should be not null for KtConstructor", psi = this) val containerClassFir = containingClass.findFir(provider) as? FirRegularClass ?: return null @@ -112,6 +115,16 @@ private fun KtDeclaration.findSourceNonLocalFirDeclarationByProvider( return candidate?.takeIf { it.realPsi == this } } +fun FirAnonymousInitializer.containingClass(): FirRegularClass { + val dispatchReceiverType = this.dispatchReceiverType as? ConeLookupTagBasedType + ?: error("dispatchReceiverType for FirAnonymousInitializer modifier cannot be null") + + val dispatchReceiverSymbol = dispatchReceiverType.lookupTag.toSymbol(llFirSession) + ?: error("symbol for FirAnonymousInitializer cannot be null") + + return dispatchReceiverSymbol.fir as FirRegularClass +} + val ORIGINAL_DECLARATION_KEY = com.intellij.openapi.util.Key("ORIGINAL_DECLARATION_KEY") var KtDeclaration.originalDeclaration by UserDataProperty(ORIGINAL_DECLARATION_KEY) diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/util/firCheckResolvedUtils.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/util/firCheckResolvedUtils.kt index 58f779cda48..3b16f8ac5a0 100644 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/util/firCheckResolvedUtils.kt +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/util/firCheckResolvedUtils.kt @@ -13,6 +13,8 @@ import org.jetbrains.kotlin.fir.contracts.FirResolvedContractDescription import org.jetbrains.kotlin.fir.contracts.impl.FirEmptyContractDescription import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall +import org.jetbrains.kotlin.fir.expressions.FirBlock +import org.jetbrains.kotlin.fir.expressions.FirExpression import org.jetbrains.kotlin.fir.expressions.impl.FirResolvedArgumentList import org.jetbrains.kotlin.fir.types.FirImplicitTypeRef import org.jetbrains.kotlin.fir.types.FirResolvedTypeRef @@ -43,6 +45,27 @@ internal inline fun checkTypeRefIsResolved( } } +internal fun checkBodyIsResolved(function: FirFunction) { + val block = function.body ?: return + checkTypeRefIsResolved(block.typeRef, "block type", function) { + withFirEntry("block", block) + } +} + +internal fun checkInitializerIsResolved(variable: FirVariable) { + val initializer = variable.initializer ?: return + checkTypeRefIsResolved(initializer.typeRef, "initializer type", variable) { + withFirEntry("initializer", initializer) + } +} + +internal fun checkDefaultValueIsResolved(parameter: FirValueParameter) { + val defaultValue = parameter.defaultValue ?: return + checkTypeRefIsResolved(defaultValue.typeRef, "default value type", parameter) { + withFirEntry("defaultValue", defaultValue) + } +} + internal fun checkReturnTypeRefIsResolved(declaration: FirCallableDeclaration, acceptImplicitTypeRef: Boolean = false) { checkTypeRefIsResolved(declaration.returnTypeRef, typeRefName = "return type", declaration, acceptImplicitTypeRef) } diff --git a/analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/callInsideLambdaInsideSuperCallAndExplicitConstructor.kt b/analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/callInsideLambdaInsideSuperCallAndExplicitConstructor.kt new file mode 100644 index 00000000000..05fe077f55a --- /dev/null +++ b/analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/callInsideLambdaInsideSuperCallAndExplicitConstructor.kt @@ -0,0 +1,7 @@ +open class B(x: () -> Unit) + +class A() : B(1, { + foo() +}) + +fun foo() {} \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/callInsideLambdaInsideSuperCallAndImplicitConstructor.kt b/analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/callInsideLambdaInsideSuperCallAndImplicitConstructor.kt new file mode 100644 index 00000000000..c2fb0a7a203 --- /dev/null +++ b/analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/callInsideLambdaInsideSuperCallAndImplicitConstructor.kt @@ -0,0 +1,7 @@ +open class B(x: () -> Unit) + +class A : B(1, { + foo() +}) + +fun foo() {} \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/callInsideLambdaInsideSuperCallFromSecondaryConstructor.kt b/analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/callInsideLambdaInsideSuperCallFromSecondaryConstructor.kt new file mode 100644 index 00000000000..af27c8780fb --- /dev/null +++ b/analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/callInsideLambdaInsideSuperCallFromSecondaryConstructor.kt @@ -0,0 +1,17 @@ +open class A(x: () -> Unit) + +class B : A { + constructor(i: Int) : super( + { + foo(i) + } + ) + + constructor(l: Long) : super( + { + foo(l) + } + ) +} + +fun foo(any: Any) {} \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/callInsideLambdaInsideSuperCallFromSingleSecondaryConstructor.kt b/analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/callInsideLambdaInsideSuperCallFromSingleSecondaryConstructor.kt new file mode 100644 index 00000000000..f2fd2ed6e6b --- /dev/null +++ b/analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/callInsideLambdaInsideSuperCallFromSingleSecondaryConstructor.kt @@ -0,0 +1,11 @@ +open class A(x: () -> Unit) + +class B : A { + constructor(i: Int) : super( + { + foo(i) + } + ) +} + +fun foo(any: Any) {} \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/constructorParameters/constructorParameter.kt b/analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/constructorParameters/constructorParameter.kt new file mode 100644 index 00000000000..5b3a9caf804 --- /dev/null +++ b/analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/constructorParameters/constructorParameter.kt @@ -0,0 +1 @@ +class A(var x: Int) \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/constructorParameters/constructorParameterWithAnnotations.kt b/analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/constructorParameters/constructorParameterWithAnnotations.kt new file mode 100644 index 00000000000..b1e8e834504 --- /dev/null +++ b/analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/constructorParameters/constructorParameterWithAnnotations.kt @@ -0,0 +1,10 @@ +class A( + @setparam:Ann + @get:Ann + @set:Ann + @field:Ann + @property:Ann + var x: Int +) + +annotation class Ann \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/superCallAnnotation.kt b/analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/superCallAnnotation.kt new file mode 100644 index 00000000000..55a8590ea90 --- /dev/null +++ b/analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/superCallAnnotation.kt @@ -0,0 +1,6 @@ +@Target(AnnotationTarget.TYPE) +annotation class Anno + +open class A + +class B : @Anno A() \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/superCallAnnotation2.kt b/analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/superCallAnnotation2.kt new file mode 100644 index 00000000000..24fcb2f57a9 --- /dev/null +++ b/analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/superCallAnnotation2.kt @@ -0,0 +1,6 @@ +@Target(AnnotationTarget.TYPE) +annotation class Anno + +interface A + +class B : @Anno A \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/superType.kt b/analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/superType.kt new file mode 100644 index 00000000000..a15364ca07b --- /dev/null +++ b/analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/superType.kt @@ -0,0 +1,7 @@ +interface A + +typealias AS = A + +class C : AS { + constructor() +} \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/fileStructure/class.kt b/analysis/low-level-api-fir/testdata/fileStructure/class.kt index f60ca4f611a..041931d6ece 100644 --- a/analysis/low-level-api-fir/testdata/fileStructure/class.kt +++ b/analysis/low-level-api-fir/testdata/fileStructure/class.kt @@ -1,6 +1,6 @@ -class A {/* NonReanalyzableDeclarationStructureElement */ +class A {/* NonReanalyzableClassDeclarationStructureElement */ fun x() {/* ReanalyzableFunctionStructureElement */ } fun y(): Int = 10/* ReanalyzableFunctionStructureElement */ -} \ No newline at end of file +} diff --git a/analysis/low-level-api-fir/testdata/fileStructure/classMemberProperty.kt b/analysis/low-level-api-fir/testdata/fileStructure/classMemberProperty.kt index 81221eecbae..04eb8421779 100644 --- a/analysis/low-level-api-fir/testdata/fileStructure/classMemberProperty.kt +++ b/analysis/low-level-api-fir/testdata/fileStructure/classMemberProperty.kt @@ -1,11 +1,11 @@ -class X {/* NonReanalyzableDeclarationStructureElement */ +class X {/* NonReanalyzableClassDeclarationStructureElement */ var x: Int/* ReanalyzablePropertyStructureElement */ get() = field set(value) { field = value } - val y = 42/* NonReanalyzableDeclarationStructureElement */ + val y = 42/* NonReanalyzableNonClassDeclarationStructureElement */ var z: Int = 15/* ReanalyzablePropertyStructureElement */ -} \ No newline at end of file +} diff --git a/analysis/low-level-api-fir/testdata/fileStructure/constructors.kt b/analysis/low-level-api-fir/testdata/fileStructure/constructors.kt new file mode 100644 index 00000000000..3a5b564ff9d --- /dev/null +++ b/analysis/low-level-api-fir/testdata/fileStructure/constructors.kt @@ -0,0 +1,9 @@ +class A + + (val a: Int)/* NonReanalyzableNonClassDeclarationStructureElement */ + +{/* NonReanalyzableClassDeclarationStructureElement */ + constructor() : this(1) {/* NonReanalyzableNonClassDeclarationStructureElement */ + + } +} diff --git a/analysis/low-level-api-fir/testdata/fileStructure/danglingAnnotationClassLevel.kt b/analysis/low-level-api-fir/testdata/fileStructure/danglingAnnotationClassLevel.kt index 9ccf19d03e3..3e546f4338c 100644 --- a/analysis/low-level-api-fir/testdata/fileStructure/danglingAnnotationClassLevel.kt +++ b/analysis/low-level-api-fir/testdata/fileStructure/danglingAnnotationClassLevel.kt @@ -1,11 +1,11 @@ -class Foo {/* NonReanalyzableDeclarationStructureElement */ +class Foo {/* NonReanalyzableClassDeclarationStructureElement */ @Suppress("") @MustBeDocumented } -class Bar {/* NonReanalyzableDeclarationStructureElement */ +class Bar {/* NonReanalyzableClassDeclarationStructureElement */ @Suppress("") @MustBeDocumented } -class Outer {/* NonReanalyzableDeclarationStructureElement */ - class Inner {/* NonReanalyzableDeclarationStructureElement */ +class Outer {/* NonReanalyzableClassDeclarationStructureElement */ + class Inner {/* NonReanalyzableClassDeclarationStructureElement */ @Suppress("") @MustBeDocumented } fun foo() {/* ReanalyzableFunctionStructureElement */ diff --git a/analysis/low-level-api-fir/testdata/fileStructure/declarationsInPropertyInit.kt b/analysis/low-level-api-fir/testdata/fileStructure/declarationsInPropertyInit.kt index 74956002a3a..0bc021ae25d 100644 --- a/analysis/low-level-api-fir/testdata/fileStructure/declarationsInPropertyInit.kt +++ b/analysis/low-level-api-fir/testdata/fileStructure/declarationsInPropertyInit.kt @@ -1,9 +1,9 @@ -class A {/* NonReanalyzableDeclarationStructureElement */ +class A {/* NonReanalyzableClassDeclarationStructureElement */ val a = run { class X() val y = 10 - }/* NonReanalyzableDeclarationStructureElement */ + }/* NonReanalyzableNonClassDeclarationStructureElement */ } inline fun run(block: () -> R): R {/* ReanalyzableFunctionStructureElement */ diff --git a/analysis/low-level-api-fir/testdata/fileStructure/enumClass.kt b/analysis/low-level-api-fir/testdata/fileStructure/enumClass.kt index 7c6b44ec80a..6677be3c428 100644 --- a/analysis/low-level-api-fir/testdata/fileStructure/enumClass.kt +++ b/analysis/low-level-api-fir/testdata/fileStructure/enumClass.kt @@ -1,13 +1,13 @@ -enum class A {/* NonReanalyzableDeclarationStructureElement */ - X,/* NonReanalyzableDeclarationStructureElement */ - Y,/* NonReanalyzableDeclarationStructureElement */ +enum class A {/* NonReanalyzableClassDeclarationStructureElement */ + X,/* NonReanalyzableNonClassDeclarationStructureElement */ + Y,/* NonReanalyzableNonClassDeclarationStructureElement */ Z - ;/* NonReanalyzableDeclarationStructureElement */ + ;/* NonReanalyzableNonClassDeclarationStructureElement */ fun foo(){/* ReanalyzableFunctionStructureElement */} - val x = 10/* NonReanalyzableDeclarationStructureElement */ + val x = 10/* NonReanalyzableNonClassDeclarationStructureElement */ - fun bar() = 10/* NonReanalyzableDeclarationStructureElement */ + fun bar() = 10/* NonReanalyzableNonClassDeclarationStructureElement */ } diff --git a/analysis/low-level-api-fir/testdata/fileStructure/enumClassWithBody.kt b/analysis/low-level-api-fir/testdata/fileStructure/enumClassWithBody.kt index 0c9907cb78b..2f48e86447b 100644 --- a/analysis/low-level-api-fir/testdata/fileStructure/enumClassWithBody.kt +++ b/analysis/low-level-api-fir/testdata/fileStructure/enumClassWithBody.kt @@ -1,13 +1,13 @@ -enum class A {/* NonReanalyzableDeclarationStructureElement */ - X {/* NonReanalyzableDeclarationStructureElement */ +enum class A {/* NonReanalyzableClassDeclarationStructureElement */ + X {/* NonReanalyzableNonClassDeclarationStructureElement */ fun localInX() = 1 }, - Y {/* NonReanalyzableDeclarationStructureElement */ + Y {/* NonReanalyzableNonClassDeclarationStructureElement */ override fun foo() {} }, Z, - ;/* NonReanalyzableDeclarationStructureElement */ + ;/* NonReanalyzableNonClassDeclarationStructureElement */ open fun foo() {/* ReanalyzableFunctionStructureElement */} } diff --git a/analysis/low-level-api-fir/testdata/fileStructure/initBlock.kt b/analysis/low-level-api-fir/testdata/fileStructure/initBlock.kt index 0e61f144c65..b144376ca16 100644 --- a/analysis/low-level-api-fir/testdata/fileStructure/initBlock.kt +++ b/analysis/low-level-api-fir/testdata/fileStructure/initBlock.kt @@ -1,6 +1,6 @@ -class A {/* NonReanalyzableDeclarationStructureElement */ - init { +class A {/* NonReanalyzableClassDeclarationStructureElement */ + init {/* NonReanalyzableNonClassDeclarationStructureElement */ val x = 10 class B } -} \ No newline at end of file +} diff --git a/analysis/low-level-api-fir/testdata/fileStructure/localClass.kt b/analysis/low-level-api-fir/testdata/fileStructure/localClass.kt index ce41e29aa54..c6d93243c00 100644 --- a/analysis/low-level-api-fir/testdata/fileStructure/localClass.kt +++ b/analysis/low-level-api-fir/testdata/fileStructure/localClass.kt @@ -2,8 +2,8 @@ fun a() {/* ReanalyzableFunctionStructureElement */ class X } -class Y {/* NonReanalyzableDeclarationStructureElement */ +class Y {/* NonReanalyzableClassDeclarationStructureElement */ fun b() {/* ReanalyzableFunctionStructureElement */ class Z } -} \ No newline at end of file +} diff --git a/analysis/low-level-api-fir/testdata/fileStructure/localFun.kt b/analysis/low-level-api-fir/testdata/fileStructure/localFun.kt index e10eeca4ee1..2b989f5182e 100644 --- a/analysis/low-level-api-fir/testdata/fileStructure/localFun.kt +++ b/analysis/low-level-api-fir/testdata/fileStructure/localFun.kt @@ -4,10 +4,10 @@ fun x() {/* ReanalyzableFunctionStructureElement */ } } -class A {/* NonReanalyzableDeclarationStructureElement */ +class A {/* NonReanalyzableClassDeclarationStructureElement */ fun z() {/* ReanalyzableFunctionStructureElement */ fun q() { } } -} \ No newline at end of file +} diff --git a/analysis/low-level-api-fir/testdata/fileStructure/localProperty.kt b/analysis/low-level-api-fir/testdata/fileStructure/localProperty.kt index 654d56f3ac9..bb957e60a81 100644 --- a/analysis/low-level-api-fir/testdata/fileStructure/localProperty.kt +++ b/analysis/low-level-api-fir/testdata/fileStructure/localProperty.kt @@ -1,13 +1,13 @@ fun foo() {/* ReanalyzableFunctionStructureElement */ var x: Int } -class A {/* NonReanalyzableDeclarationStructureElement */ +class A {/* NonReanalyzableClassDeclarationStructureElement */ fun q() {/* ReanalyzableFunctionStructureElement */ val y = 42 } } -class B {/* NonReanalyzableDeclarationStructureElement */ - class C {/* NonReanalyzableDeclarationStructureElement */ +class B {/* NonReanalyzableClassDeclarationStructureElement */ + class C {/* NonReanalyzableClassDeclarationStructureElement */ fun u() {/* ReanalyzableFunctionStructureElement */ var z: Int = 15 } diff --git a/analysis/low-level-api-fir/testdata/fileStructure/memberTypeAlias.kt b/analysis/low-level-api-fir/testdata/fileStructure/memberTypeAlias.kt index 94c06a9232b..43d4bcc8888 100644 --- a/analysis/low-level-api-fir/testdata/fileStructure/memberTypeAlias.kt +++ b/analysis/low-level-api-fir/testdata/fileStructure/memberTypeAlias.kt @@ -1,3 +1,3 @@ -class A {/* NonReanalyzableDeclarationStructureElement */ - typealias X = Int/* NonReanalyzableDeclarationStructureElement */ -} \ No newline at end of file +class A {/* NonReanalyzableClassDeclarationStructureElement */ + typealias X = Int/* NonReanalyzableNonClassDeclarationStructureElement */ +} diff --git a/analysis/low-level-api-fir/testdata/fileStructure/nestedClasses.kt b/analysis/low-level-api-fir/testdata/fileStructure/nestedClasses.kt index d21bcc065d8..cbe305e8a06 100644 --- a/analysis/low-level-api-fir/testdata/fileStructure/nestedClasses.kt +++ b/analysis/low-level-api-fir/testdata/fileStructure/nestedClasses.kt @@ -1,16 +1,16 @@ -class A {/* NonReanalyzableDeclarationStructureElement */ - class B {/* NonReanalyzableDeclarationStructureElement */ +class A {/* NonReanalyzableClassDeclarationStructureElement */ + class B {/* NonReanalyzableClassDeclarationStructureElement */ fun x() {/* ReanalyzableFunctionStructureElement */ } - class C {/* NonReanalyzableDeclarationStructureElement */ + class C {/* NonReanalyzableClassDeclarationStructureElement */ } } - class E {/* NonReanalyzableDeclarationStructureElement */ + class E {/* NonReanalyzableClassDeclarationStructureElement */ } fun y(): Int = 10/* ReanalyzableFunctionStructureElement */ -} \ No newline at end of file +} diff --git a/analysis/low-level-api-fir/testdata/fileStructure/propertyAccessors.kt b/analysis/low-level-api-fir/testdata/fileStructure/propertyAccessors.kt index 46d04abfcdc..baa56881652 100644 --- a/analysis/low-level-api-fir/testdata/fileStructure/propertyAccessors.kt +++ b/analysis/low-level-api-fir/testdata/fileStructure/propertyAccessors.kt @@ -4,10 +4,10 @@ var x: Int = 10/* ReanalyzablePropertyStructureElement */ field = value } -class X {/* NonReanalyzableDeclarationStructureElement */ +class X {/* NonReanalyzableClassDeclarationStructureElement */ var y: Int = 10/* ReanalyzablePropertyStructureElement */ get() = field set(value) { field = value } -} \ No newline at end of file +} diff --git a/analysis/low-level-api-fir/testdata/fileStructure/topLevelExpressionBodyFunWithoutType.kt b/analysis/low-level-api-fir/testdata/fileStructure/topLevelExpressionBodyFunWithoutType.kt index 089bd79a4e9..4211d88a39c 100644 --- a/analysis/low-level-api-fir/testdata/fileStructure/topLevelExpressionBodyFunWithoutType.kt +++ b/analysis/low-level-api-fir/testdata/fileStructure/topLevelExpressionBodyFunWithoutType.kt @@ -1 +1 @@ -fun foo() = 42/* NonReanalyzableDeclarationStructureElement */ \ No newline at end of file +fun foo() = 42/* NonReanalyzableNonClassDeclarationStructureElement */ diff --git a/analysis/low-level-api-fir/testdata/fileStructure/topLevelProperty.kt b/analysis/low-level-api-fir/testdata/fileStructure/topLevelProperty.kt index 120de847eef..af301be2b65 100644 --- a/analysis/low-level-api-fir/testdata/fileStructure/topLevelProperty.kt +++ b/analysis/low-level-api-fir/testdata/fileStructure/topLevelProperty.kt @@ -4,6 +4,6 @@ var x: Int/* ReanalyzablePropertyStructureElement */ field = value } -val y = 42/* NonReanalyzableDeclarationStructureElement */ +val y = 42/* NonReanalyzableNonClassDeclarationStructureElement */ -var z: Int = 15/* ReanalyzablePropertyStructureElement */ \ No newline at end of file +var z: Int = 15/* ReanalyzablePropertyStructureElement */ diff --git a/analysis/low-level-api-fir/testdata/fileStructure/typeAlias.kt b/analysis/low-level-api-fir/testdata/fileStructure/typeAlias.kt index 892ad16ba56..45f0b761bcd 100644 --- a/analysis/low-level-api-fir/testdata/fileStructure/typeAlias.kt +++ b/analysis/low-level-api-fir/testdata/fileStructure/typeAlias.kt @@ -1 +1 @@ -typealias A = 10/* NonReanalyzableDeclarationStructureElement */ \ No newline at end of file +typealias A = 10/* NonReanalyzableNonClassDeclarationStructureElement */ diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/superCallAnnotation.kt b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/superCallAnnotation.kt new file mode 100644 index 00000000000..4272fbfdb64 --- /dev/null +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/superCallAnnotation.kt @@ -0,0 +1,8 @@ +// LOOK_UP_FOR_ELEMENT_OF_TYPE: org.jetbrains.kotlin.psi.KtAnnotationEntry + +@Target(AnnotationTarget.TYPE) +annotation class Anno + +open class A + +class B : @Anno A() \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/superCallAnnotation.txt b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/superCallAnnotation.txt new file mode 100644 index 00000000000..15bc2c7fbb1 --- /dev/null +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/superCallAnnotation.txt @@ -0,0 +1,6 @@ +KT element: KtAnnotationEntry +FIR element: FirAnnotationCallImpl +FIR source kind: KtRealSourceElementKind + +FIR element rendered: +@R|Anno|[Types]() \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/superCallAnnotation2.kt b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/superCallAnnotation2.kt new file mode 100644 index 00000000000..4d82411b0dc --- /dev/null +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/superCallAnnotation2.kt @@ -0,0 +1,8 @@ +// LOOK_UP_FOR_ELEMENT_OF_TYPE: org.jetbrains.kotlin.psi.KtAnnotationEntry + +@Target(AnnotationTarget.TYPE) +annotation class Anno + +interface A + +class B : @Anno A \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/superCallAnnotation2.txt b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/superCallAnnotation2.txt new file mode 100644 index 00000000000..15bc2c7fbb1 --- /dev/null +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/superCallAnnotation2.txt @@ -0,0 +1,6 @@ +KT element: KtAnnotationEntry +FIR element: FirAnnotationCallImpl +FIR source kind: KtRealSourceElementKind + +FIR element rendered: +@R|Anno|[Types]() \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/delegate.kt b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/delegate.kt new file mode 100644 index 00000000000..3381dc20e85 --- /dev/null +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/delegate.kt @@ -0,0 +1,8 @@ +// LOOK_UP_FOR_ELEMENT_OF_TYPE: org.jetbrains.kotlin.psi.KtAnnotationEntry + +annotation class Ann + +class X { + @delegate:Ann + val a by lazy { 1 } +} \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/delegate.txt b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/delegate.txt new file mode 100644 index 00000000000..bf4f1f4c225 --- /dev/null +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/delegate.txt @@ -0,0 +1,6 @@ +KT element: KtAnnotationEntry +FIR element: FirAnnotationCallImpl +FIR source kind: KtRealSourceElementKind + +FIR element rendered: +@PROPERTY_DELEGATE_FIELD:R|Ann|[Types]() \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/field.kt b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/field.kt new file mode 100644 index 00000000000..470566f170e --- /dev/null +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/field.kt @@ -0,0 +1,5 @@ +// LOOK_UP_FOR_ELEMENT_OF_TYPE: org.jetbrains.kotlin.psi.KtAnnotationEntry + +annotation class Ann + +class X(@field:Ann var x: Int) \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/field.txt b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/field.txt new file mode 100644 index 00000000000..2f6fc3e36ba --- /dev/null +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/field.txt @@ -0,0 +1,6 @@ +KT element: KtAnnotationEntry +FIR element: FirAnnotationCallImpl +FIR source kind: KtRealSourceElementKind + +FIR element rendered: +@FIELD:R|Ann|[Types]() \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/file.kt b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/file.kt new file mode 100644 index 00000000000..7cb74844279 --- /dev/null +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/file.kt @@ -0,0 +1,5 @@ +// LOOK_UP_FOR_ELEMENT_OF_TYPE: org.jetbrains.kotlin.psi.KtAnnotationEntry + +@file:Ann + +annotation class Ann \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/file.txt b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/file.txt new file mode 100644 index 00000000000..2ebc67b38aa --- /dev/null +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/file.txt @@ -0,0 +1,6 @@ +KT element: KtAnnotationEntry +FIR element: FirAnnotationCallImpl +FIR source kind: KtRealSourceElementKind + +FIR element rendered: +@FILE:R|Ann|[Types]() \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/getter.kt b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/getter.kt new file mode 100644 index 00000000000..bf762918b16 --- /dev/null +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/getter.kt @@ -0,0 +1,5 @@ +// LOOK_UP_FOR_ELEMENT_OF_TYPE: org.jetbrains.kotlin.psi.KtAnnotationEntry + +annotation class Ann + +class X(@get:Ann var x: Int) \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/getter.txt b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/getter.txt new file mode 100644 index 00000000000..6000ec9b7dc --- /dev/null +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/getter.txt @@ -0,0 +1,6 @@ +KT element: KtAnnotationEntry +FIR element: FirAnnotationCallImpl +FIR source kind: FromUseSiteTarget + +FIR element rendered: +@PROPERTY_GETTER:R|Ann|[Types]() \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/param.kt b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/param.kt new file mode 100644 index 00000000000..c7e1277296b --- /dev/null +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/param.kt @@ -0,0 +1,5 @@ +// LOOK_UP_FOR_ELEMENT_OF_TYPE: org.jetbrains.kotlin.psi.KtAnnotationEntry + +annotation class Ann + +class X(@param:Ann var x: Int) \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/param.txt b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/param.txt new file mode 100644 index 00000000000..feca17c5ff4 --- /dev/null +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/param.txt @@ -0,0 +1,6 @@ +KT element: KtAnnotationEntry +FIR element: FirAnnotationCallImpl +FIR source kind: KtRealSourceElementKind + +FIR element rendered: +@CONSTRUCTOR_PARAMETER:R|Ann|[Types]() \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/property.kt b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/property.kt new file mode 100644 index 00000000000..d230074e73f --- /dev/null +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/property.kt @@ -0,0 +1,5 @@ +// LOOK_UP_FOR_ELEMENT_OF_TYPE: org.jetbrains.kotlin.psi.KtAnnotationEntry + +annotation class Ann + +class X(@property:Ann var x: Int) \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/property.txt b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/property.txt new file mode 100644 index 00000000000..09fe791daee --- /dev/null +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/property.txt @@ -0,0 +1,6 @@ +KT element: KtAnnotationEntry +FIR element: FirAnnotationCallImpl +FIR source kind: KtRealSourceElementKind + +FIR element rendered: +@PROPERTY:R|Ann|[Types]() \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/setParam.kt b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/setParam.kt new file mode 100644 index 00000000000..acf98cf2228 --- /dev/null +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/setParam.kt @@ -0,0 +1,5 @@ +// LOOK_UP_FOR_ELEMENT_OF_TYPE: org.jetbrains.kotlin.psi.KtAnnotationEntry + +annotation class Ann + +class X(@setparam:Ann var x: Int) \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/setParam.txt b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/setParam.txt new file mode 100644 index 00000000000..33756ef1f26 --- /dev/null +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/setParam.txt @@ -0,0 +1,6 @@ +KT element: KtAnnotationEntry +FIR element: FirAnnotationCallImpl +FIR source kind: FromUseSiteTarget + +FIR element rendered: +@SETTER_PARAMETER:R|Ann|[Types]() \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/setter.kt b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/setter.kt new file mode 100644 index 00000000000..ef0f0ea344e --- /dev/null +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/setter.kt @@ -0,0 +1,5 @@ +// LOOK_UP_FOR_ELEMENT_OF_TYPE: org.jetbrains.kotlin.psi.KtAnnotationEntry + +annotation class Ann + +class X(@set:Ann var x: Int) \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/setter.txt b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/setter.txt new file mode 100644 index 00000000000..af2e425e76a --- /dev/null +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/setter.txt @@ -0,0 +1,6 @@ +KT element: KtAnnotationEntry +FIR element: FirAnnotationCallImpl +FIR source kind: FromUseSiteTarget + +FIR element rendered: +@PROPERTY_SETTER:R|Ann|[Types]() \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/callInsideLambdaInsideSuperCallAndExplicitConstructor.kt b/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/callInsideLambdaInsideSuperCallAndExplicitConstructor.kt new file mode 100644 index 00000000000..6fc268eccbf --- /dev/null +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/callInsideLambdaInsideSuperCallAndExplicitConstructor.kt @@ -0,0 +1,9 @@ +// LOOK_UP_FOR_ELEMENT_OF_TYPE: org.jetbrains.kotlin.psi.KtCallExpression + +open class B(x: () -> Unit) + +class A() : B(1, { + foo() +}) + +fun foo() {} \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/callInsideLambdaInsideSuperCallAndExplicitConstructor.txt b/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/callInsideLambdaInsideSuperCallAndExplicitConstructor.txt new file mode 100644 index 00000000000..15b1f0bdf5c --- /dev/null +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/callInsideLambdaInsideSuperCallAndExplicitConstructor.txt @@ -0,0 +1,6 @@ +KT element: KtCallExpression +FIR element: FirFunctionCallImpl +FIR source kind: KtRealSourceElementKind + +FIR element rendered: +R|/foo|() \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/callInsideLambdaInsideSuperCallAndImplicitConstructor.kt b/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/callInsideLambdaInsideSuperCallAndImplicitConstructor.kt new file mode 100644 index 00000000000..b49dc747035 --- /dev/null +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/callInsideLambdaInsideSuperCallAndImplicitConstructor.kt @@ -0,0 +1,9 @@ +// LOOK_UP_FOR_ELEMENT_OF_TYPE: org.jetbrains.kotlin.psi.KtCallExpression + +open class B(x: () -> Unit) + +class A : B(1, { + foo() +}) + +fun foo() {} \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/callInsideLambdaInsideSuperCallAndImplicitConstructor.txt b/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/callInsideLambdaInsideSuperCallAndImplicitConstructor.txt new file mode 100644 index 00000000000..15b1f0bdf5c --- /dev/null +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/callInsideLambdaInsideSuperCallAndImplicitConstructor.txt @@ -0,0 +1,6 @@ +KT element: KtCallExpression +FIR element: FirFunctionCallImpl +FIR source kind: KtRealSourceElementKind + +FIR element rendered: +R|/foo|() \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/callInsideLambdaInsideSuperCallFromSecondaryConstructor.kt b/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/callInsideLambdaInsideSuperCallFromSecondaryConstructor.kt new file mode 100644 index 00000000000..df439ad794e --- /dev/null +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/callInsideLambdaInsideSuperCallFromSecondaryConstructor.kt @@ -0,0 +1,19 @@ +// LOOK_UP_FOR_ELEMENT_OF_TYPE: org.jetbrains.kotlin.psi.KtCallExpression + +open class A(x: () -> Unit) + +class B : A { + constructor(i: Int) : super( + { + foo(i) + } + ) + + constructor(l: Long) : super( + { + foo(l) + } + ) +} + +fun foo(any: Any) {} \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/callInsideLambdaInsideSuperCallFromSecondaryConstructor.txt b/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/callInsideLambdaInsideSuperCallFromSecondaryConstructor.txt new file mode 100644 index 00000000000..514cd613707 --- /dev/null +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/callInsideLambdaInsideSuperCallFromSecondaryConstructor.txt @@ -0,0 +1,6 @@ +KT element: KtCallExpression +FIR element: FirFunctionCallImpl +FIR source kind: KtRealSourceElementKind + +FIR element rendered: +R|/foo|(R|/l|) diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/callInsideLambdaInsideSuperCallFromSingleSecondaryConstructor.kt b/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/callInsideLambdaInsideSuperCallFromSingleSecondaryConstructor.kt new file mode 100644 index 00000000000..0e76713d6ed --- /dev/null +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/callInsideLambdaInsideSuperCallFromSingleSecondaryConstructor.kt @@ -0,0 +1,13 @@ +// LOOK_UP_FOR_ELEMENT_OF_TYPE: org.jetbrains.kotlin.psi.KtCallExpression + +open class A(x: () -> Unit) + +class B : A { + constructor(i: Int) : super( + { + foo(i) + } + ) +} + +fun foo(any: Any) {} \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/callInsideLambdaInsideSuperCallFromSingleSecondaryConstructor.txt b/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/callInsideLambdaInsideSuperCallFromSingleSecondaryConstructor.txt new file mode 100644 index 00000000000..b58d7878f2f --- /dev/null +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/callInsideLambdaInsideSuperCallFromSingleSecondaryConstructor.txt @@ -0,0 +1,6 @@ +KT element: KtCallExpression +FIR element: FirFunctionCallImpl +FIR source kind: KtRealSourceElementKind + +FIR element rendered: +R|/foo|(R|/i|) diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/superType.kt b/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/superType.kt new file mode 100644 index 00000000000..48a962d925d --- /dev/null +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/superType.kt @@ -0,0 +1,6 @@ +// LOOK_UP_FOR_ELEMENT_OF_TYPE: org.jetbrains.kotlin.psi.KtTypeReference +interface A + +class C : A { + constructor() +} \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/superType.txt b/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/superType.txt new file mode 100644 index 00000000000..c81c5b7e4b5 --- /dev/null +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/calls/superType.txt @@ -0,0 +1,6 @@ +KT element: KtTypeReference +FIR element: FirResolvedTypeRefImpl +FIR source kind: KtRealSourceElementKind + +FIR element rendered: +R|A| \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegate.out_of_src_roots.txt b/analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegate.out_of_src_roots.txt index 6f78b7eed07..48e99eb4463 100644 --- a/analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegate.out_of_src_roots.txt +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegate.out_of_src_roots.txt @@ -3,7 +3,7 @@ FIR element: FirFunctionCallImpl FIR source kind: KtRealSourceElementKind FIR element rendered: -#( = [ResolvedTo(BODY_RESOLVE)] lazy@fun (): R|kotlin/Int| { +#( = [ResolvedTo(RAW_FIR)] lazy@fun (): R|kotlin/Int| { ^ Int(1) } ) \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegate.txt b/analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegate.txt index aaff933b252..3dcb05356b7 100644 --- a/analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegate.txt +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegate.txt @@ -3,7 +3,7 @@ FIR element: FirFunctionCallImpl FIR source kind: KtRealSourceElementKind FIR element rendered: -R|kotlin/lazy|( = [ResolvedTo(BODY_RESOLVE)] lazy@fun (): R|kotlin/Int| { +R|kotlin/lazy|( = [ResolvedTo(RAW_FIR)] lazy@fun (): R|kotlin/Int| { ^ Int(1) } ) \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegateExpression.out_of_src_roots.txt b/analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegateExpression.out_of_src_roots.txt index 03f1b22f1af..ef5ffe25b1e 100644 --- a/analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegateExpression.out_of_src_roots.txt +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegateExpression.out_of_src_roots.txt @@ -3,7 +3,7 @@ FIR element: FirFunctionCallImpl FIR source kind: KtRealSourceElementKind FIR element rendered: -#( = [ResolvedTo(BODY_RESOLVE)] lazy@fun (): R|kotlin/Int| { +#( = [ResolvedTo(RAW_FIR)] lazy@fun (): R|kotlin/Int| { ^ Int(1) } ) \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegateExpression.txt b/analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegateExpression.txt index e6220b254d2..c35793a4a5c 100644 --- a/analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegateExpression.txt +++ b/analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegateExpression.txt @@ -3,7 +3,7 @@ FIR element: FirFunctionCallImpl FIR source kind: KtRealSourceElementKind FIR element rendered: -R|kotlin/lazy|( = [ResolvedTo(BODY_RESOLVE)] lazy@fun (): R|kotlin/Int| { +R|kotlin/lazy|( = [ResolvedTo(RAW_FIR)] lazy@fun (): R|kotlin/Int| { ^ Int(1) } ) \ No newline at end of file diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/annotationParameters.txt b/analysis/low-level-api-fir/testdata/lazyResolve/annotationParameters.txt index 71fe580d913..a727dc27538 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/annotationParameters.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/annotationParameters.txt @@ -183,7 +183,7 @@ FILE: [ResolvedTo(IMPORTS)] annotationParameters.kt public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] get(): A.X } - public? final? [ResolvedTo(RAW_FIR)] class B : R|kotlin/Any| { + public? final? [ResolvedTo(SUPER_TYPES)] class B : R|kotlin/Any| { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=B] constructor(): R|B| { LAZY_super } @@ -222,14 +222,14 @@ FILE: [ResolvedTo(IMPORTS)] annotationParameters.kt public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] get(): A.X } - public? final? [ResolvedTo(SUPER_TYPES)] class B : R|kotlin/Any| { - public? [ResolvedTo(SUPER_TYPES)] [ContainingClassKey=B] constructor(): R|B| { + public? final? [ResolvedTo(TYPES)] class B : R|kotlin/Any| { + public? [ResolvedTo(TYPES)] [ContainingClassKey=B] constructor(): R|B| { LAZY_super } @R|Anno|[Types](LAZY_EXPRESSION) public? final? [ResolvedTo(TYPES)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } - @Anno[Unresolved](LAZY_EXPRESSION) public? final? [ResolvedTo(SUPER_TYPES)] fun foo(): R|kotlin/Unit| { LAZY_BLOCK } + @Anno[Unresolved](LAZY_EXPRESSION) public? final? [ResolvedTo(RAW_FIR)] fun foo(): R|kotlin/Unit| { LAZY_BLOCK } } @@ -261,14 +261,14 @@ FILE: [ResolvedTo(IMPORTS)] annotationParameters.kt public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] get(): A.X } - public final [ResolvedTo(SUPER_TYPES)] class B : R|kotlin/Any| { - public [ResolvedTo(TYPES)] [ContainingClassKey=B] constructor(): R|B| { + public final [ResolvedTo(STATUS)] class B : R|kotlin/Any| { + public [ResolvedTo(STATUS)] [ContainingClassKey=B] constructor(): R|B| { LAZY_super } @R|Anno|[Types](LAZY_EXPRESSION) public final [ResolvedTo(STATUS)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } - @R|Anno|[Types](LAZY_EXPRESSION) public final [ResolvedTo(TYPES)] fun foo(): R|kotlin/Unit| { LAZY_BLOCK } + @R|Anno|[Types](LAZY_EXPRESSION) public final [ResolvedTo(STATUS)] fun foo(): R|kotlin/Unit| { LAZY_BLOCK } } @@ -300,15 +300,14 @@ FILE: [ResolvedTo(IMPORTS)] annotationParameters.kt public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] get(): A.X } - public final [ResolvedTo(SUPER_TYPES)] class B : R|kotlin/Any| { - public [ResolvedTo(TYPES)] [ContainingClassKey=B] constructor(): R|B| { + public final [ResolvedTo(STATUS)] class B : R|kotlin/Any| { + public [ResolvedTo(STATUS)] [ContainingClassKey=B] constructor(): R|B| { LAZY_super } - @R|Anno|[Types](X#.A#) public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe(): R|kotlin/Unit| { - } + @R|Anno|[Types](LAZY_EXPRESSION) public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } - @R|Anno|[Types](LAZY_EXPRESSION) public final [ResolvedTo(TYPES)] fun foo(): R|kotlin/Unit| { LAZY_BLOCK } + @R|Anno|[Types](LAZY_EXPRESSION) public final [ResolvedTo(STATUS)] fun foo(): R|kotlin/Unit| { LAZY_BLOCK } } @@ -345,8 +344,7 @@ FILE: [ResolvedTo(IMPORTS)] annotationParameters.kt LAZY_super } - @R|Anno|[Types](Q|X|.R|/X.A|) public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun resolveMe(): R|kotlin/Unit| { - } + @R|Anno|[Types](Q|X|.R|/X.A|) public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } @R|Anno|[Types](LAZY_EXPRESSION) public final [ResolvedTo(STATUS)] fun foo(): R|kotlin/Unit| { LAZY_BLOCK } @@ -451,13 +449,13 @@ FILE: [ResolvedTo(IMPORTS)] annotationParameters.kt public [ResolvedTo(STATUS)] get(): R|kotlin/enums/EnumEntries| } - public final [ResolvedTo(SUPER_TYPES)] annotation class Anno : R|kotlin/Annotation| { + public final [ResolvedTo(STATUS)] annotation class Anno : R|kotlin/Annotation| { public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] constructor([ResolvedTo(STATUS)] [CorrespondingProperty=/Anno.args] args: ): R|Anno| { LAZY_super } - public final [ResolvedTo(TYPES)] [IsFromPrimaryConstructor=true] val args: = R|/args| - public [ResolvedTo(TYPES)] [ContainingClassKey=Anno] get(): + public final [ResolvedTo(STATUS)] [IsFromPrimaryConstructor=true] val args: = R|/args| + public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] get(): } public final [ResolvedTo(STATUS)] class B : R|kotlin/Any| { @@ -468,7 +466,7 @@ FILE: [ResolvedTo(IMPORTS)] annotationParameters.kt @R|Anno|[Types](args = Q|X|.R|/X.A|) public final [ResolvedTo(ANNOTATIONS_ARGUMENTS_MAPPING)] fun resolveMe(): R|kotlin/Unit| { } - @R|Anno|[Types](X#.A#) public final [ResolvedTo(STATUS)] fun foo(): R|kotlin/Unit| { LAZY_BLOCK } + @R|Anno|[Types](LAZY_EXPRESSION) public final [ResolvedTo(STATUS)] fun foo(): R|kotlin/Unit| { LAZY_BLOCK } } @@ -491,13 +489,13 @@ FILE: [ResolvedTo(IMPORTS)] annotationParameters.kt public [ResolvedTo(STATUS)] get(): R|kotlin/enums/EnumEntries| } - public final [ResolvedTo(SUPER_TYPES)] annotation class Anno : R|kotlin/Annotation| { + public final [ResolvedTo(STATUS)] annotation class Anno : R|kotlin/Annotation| { public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] constructor([ResolvedTo(STATUS)] [CorrespondingProperty=/Anno.args] args: ): R|Anno| { LAZY_super } - public final [ResolvedTo(TYPES)] [IsFromPrimaryConstructor=true] val args: = R|/args| - public [ResolvedTo(TYPES)] [ContainingClassKey=Anno] get(): + public final [ResolvedTo(STATUS)] [IsFromPrimaryConstructor=true] val args: = R|/args| + public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] get(): } public final [ResolvedTo(STATUS)] class B : R|kotlin/Any| { @@ -508,7 +506,7 @@ FILE: [ResolvedTo(IMPORTS)] annotationParameters.kt @R|Anno|[Types](args = Q|X|.R|/X.A|) public final [ResolvedTo(BODY_RESOLVE)] fun resolveMe(): R|kotlin/Unit| { } - @R|Anno|[Types](X#.A#) public final [ResolvedTo(STATUS)] fun foo(): R|kotlin/Unit| { LAZY_BLOCK } + @R|Anno|[Types](LAZY_EXPRESSION) public final [ResolvedTo(STATUS)] fun foo(): R|kotlin/Unit| { LAZY_BLOCK } } diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/annotationWithTypeArgument.txt b/analysis/low-level-api-fir/testdata/lazyResolve/annotationWithTypeArgument.txt index 3160966c122..d8254e17f9d 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/annotationWithTypeArgument.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/annotationWithTypeArgument.txt @@ -1,3 +1,4 @@ + RAW_FIR: FILE: [ResolvedTo(RAW_FIR)] annotationWithTypeArgument.kt [ResolvedTo(RAW_FIR)] annotations container @@ -108,8 +109,7 @@ FILE: [ResolvedTo(IMPORTS)] annotationWithTypeArgument.kt public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] get(): KClass } - @R|one/Anno|[Types]((Int#)) public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe(): R|kotlin/Unit| { - } + @R|one/Anno|[Types](LAZY_EXPRESSION) public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } ARGUMENTS_OF_ANNOTATIONS: FILE: [ResolvedTo(IMPORTS)] annotationWithTypeArgument.kt @@ -123,8 +123,7 @@ FILE: [ResolvedTo(IMPORTS)] annotationWithTypeArgument.kt public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Anno] get(): KClass } - @R|one/Anno|[Types]((Q|kotlin/Int|)) public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun resolveMe(): R|kotlin/Unit| { - } + @R|one/Anno|[Types]((Q|kotlin/Int|)) public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } CONTRACTS: FILE: [ResolvedTo(IMPORTS)] annotationWithTypeArgument.kt @@ -159,13 +158,13 @@ FILE: [ResolvedTo(IMPORTS)] annotationWithTypeArgument.kt ANNOTATIONS_ARGUMENTS_MAPPING: FILE: [ResolvedTo(IMPORTS)] annotationWithTypeArgument.kt [ResolvedTo(RAW_FIR)] annotations container - public final [ResolvedTo(TYPES)] annotation class Anno<[ResolvedTo(TYPES)] T : R|kotlin/Number|> : R|kotlin/Annotation| { - public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] constructor<[ResolvedTo(TYPES)] T : R|kotlin/Number|>([ResolvedTo(STATUS)] [CorrespondingProperty=one/Anno.value] value: ): R|one/Anno| { + public final [ResolvedTo(STATUS)] annotation class Anno<[ResolvedTo(STATUS)] T : R|kotlin/Number|> : R|kotlin/Annotation| { + public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] constructor<[ResolvedTo(STATUS)] T : R|kotlin/Number|>([ResolvedTo(STATUS)] [CorrespondingProperty=one/Anno.value] value: ): R|one/Anno| { LAZY_super } - public final [ResolvedTo(TYPES)] [IsFromPrimaryConstructor=true] val value: = R|/value| - public [ResolvedTo(TYPES)] [ContainingClassKey=Anno] get(): + public final [ResolvedTo(STATUS)] [IsFromPrimaryConstructor=true] val value: = R|/value| + public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] get(): } @R|one/Anno|[Types](value = (Q|kotlin/Int|)) public final [ResolvedTo(ANNOTATIONS_ARGUMENTS_MAPPING)] fun resolveMe(): R|kotlin/Unit| { @@ -174,13 +173,13 @@ FILE: [ResolvedTo(IMPORTS)] annotationWithTypeArgument.kt BODY_RESOLVE: FILE: [ResolvedTo(IMPORTS)] annotationWithTypeArgument.kt [ResolvedTo(RAW_FIR)] annotations container - public final [ResolvedTo(TYPES)] annotation class Anno<[ResolvedTo(TYPES)] T : R|kotlin/Number|> : R|kotlin/Annotation| { - public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] constructor<[ResolvedTo(TYPES)] T : R|kotlin/Number|>([ResolvedTo(STATUS)] [CorrespondingProperty=one/Anno.value] value: ): R|one/Anno| { + public final [ResolvedTo(STATUS)] annotation class Anno<[ResolvedTo(STATUS)] T : R|kotlin/Number|> : R|kotlin/Annotation| { + public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] constructor<[ResolvedTo(STATUS)] T : R|kotlin/Number|>([ResolvedTo(STATUS)] [CorrespondingProperty=one/Anno.value] value: ): R|one/Anno| { LAZY_super } - public final [ResolvedTo(TYPES)] [IsFromPrimaryConstructor=true] val value: = R|/value| - public [ResolvedTo(TYPES)] [ContainingClassKey=Anno] get(): + public final [ResolvedTo(STATUS)] [IsFromPrimaryConstructor=true] val value: = R|/value| + public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] get(): } @R|one/Anno|[Types](value = (Q|kotlin/Int|)) public final [ResolvedTo(BODY_RESOLVE)] fun resolveMe(): R|kotlin/Unit| { diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/annotations.txt b/analysis/low-level-api-fir/testdata/lazyResolve/annotations.txt index 968a9a98480..a89c3da7ab0 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/annotations.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/annotations.txt @@ -14,72 +14,70 @@ FILE: [ResolvedTo(IMPORTS)] annotations.kt COMPILER_REQUIRED_ANNOTATIONS: FILE: [ResolvedTo(IMPORTS)] annotations.kt @FILE:Suppress[Unresolved](LAZY_EXPRESSION) - [ResolvedTo(RAW_FIR)] annotations container + [ResolvedTo(COMPILER_REQUIRED_ANNOTATIONS)] annotations container @Suppress[Unresolved](LAZY_EXPRESSION) public? final? [ResolvedTo(COMPILER_REQUIRED_ANNOTATIONS)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } COMPANION_GENERATION: FILE: [ResolvedTo(IMPORTS)] annotations.kt @FILE:Suppress[Unresolved](LAZY_EXPRESSION) - [ResolvedTo(RAW_FIR)] annotations container + [ResolvedTo(COMPANION_GENERATION)] annotations container @Suppress[Unresolved](LAZY_EXPRESSION) public? final? [ResolvedTo(COMPANION_GENERATION)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } SUPER_TYPES: FILE: [ResolvedTo(IMPORTS)] annotations.kt @FILE:Suppress[Unresolved](LAZY_EXPRESSION) - [ResolvedTo(RAW_FIR)] annotations container + [ResolvedTo(SUPER_TYPES)] annotations container @Suppress[Unresolved](LAZY_EXPRESSION) public? final? [ResolvedTo(SUPER_TYPES)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } TYPES: FILE: [ResolvedTo(IMPORTS)] annotations.kt - @FILE:Suppress[Unresolved](LAZY_EXPRESSION) - [ResolvedTo(RAW_FIR)] annotations container + @FILE:R|kotlin/Suppress|[Types](LAZY_EXPRESSION) + [ResolvedTo(TYPES)] annotations container @R|kotlin/Suppress|[Types](LAZY_EXPRESSION) public? final? [ResolvedTo(TYPES)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } STATUS: FILE: [ResolvedTo(IMPORTS)] annotations.kt - @FILE:Suppress[Unresolved](LAZY_EXPRESSION) - [ResolvedTo(RAW_FIR)] annotations container + @FILE:R|kotlin/Suppress|[Types](LAZY_EXPRESSION) + [ResolvedTo(STATUS)] annotations container @R|kotlin/Suppress|[Types](LAZY_EXPRESSION) public final [ResolvedTo(STATUS)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } EXPECT_ACTUAL_MATCHING: FILE: [ResolvedTo(IMPORTS)] annotations.kt - @FILE:Suppress[Unresolved](LAZY_EXPRESSION) - [ResolvedTo(RAW_FIR)] annotations container - @R|kotlin/Suppress|[Types](String(2)) public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe(): R|kotlin/Unit| { - } + @FILE:R|kotlin/Suppress|[Types](LAZY_EXPRESSION) + [ResolvedTo(EXPECT_ACTUAL_MATCHING)] annotations container + @R|kotlin/Suppress|[Types](LAZY_EXPRESSION) public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } ARGUMENTS_OF_ANNOTATIONS: FILE: [ResolvedTo(IMPORTS)] annotations.kt - @FILE:Suppress[Unresolved](LAZY_EXPRESSION) - [ResolvedTo(RAW_FIR)] annotations container - @R|kotlin/Suppress|[Types](String(2)) public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun resolveMe(): R|kotlin/Unit| { - } + @FILE:R|kotlin/Suppress|[Types](String(1)) + [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] annotations container + @R|kotlin/Suppress|[Types](String(2)) public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } CONTRACTS: FILE: [ResolvedTo(IMPORTS)] annotations.kt - @FILE:Suppress[Unresolved](LAZY_EXPRESSION) - [ResolvedTo(RAW_FIR)] annotations container + @FILE:R|kotlin/Suppress|[Types](String(1)) + [ResolvedTo(CONTRACTS)] annotations container @R|kotlin/Suppress|[Types](String(2)) public final [ResolvedTo(CONTRACTS)] fun resolveMe(): R|kotlin/Unit| { } IMPLICIT_TYPES_BODY_RESOLVE: FILE: [ResolvedTo(IMPORTS)] annotations.kt - @FILE:Suppress[Unresolved](LAZY_EXPRESSION) - [ResolvedTo(RAW_FIR)] annotations container + @FILE:R|kotlin/Suppress|[Types](String(1)) + [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] annotations container @R|kotlin/Suppress|[Types](String(2)) public final [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] fun resolveMe(): R|kotlin/Unit| { } ANNOTATIONS_ARGUMENTS_MAPPING: FILE: [ResolvedTo(IMPORTS)] annotations.kt - @FILE:Suppress[Unresolved](String(1)) - [ResolvedTo(RAW_FIR)] annotations container + @FILE:R|kotlin/Suppress|[Types](names = vararg(String(1))) + [ResolvedTo(ANNOTATIONS_ARGUMENTS_MAPPING)] annotations container @R|kotlin/Suppress|[Types](names = vararg(String(2))) public final [ResolvedTo(ANNOTATIONS_ARGUMENTS_MAPPING)] fun resolveMe(): R|kotlin/Unit| { } BODY_RESOLVE: FILE: [ResolvedTo(IMPORTS)] annotations.kt - @FILE:Suppress[Unresolved](String(1)) - [ResolvedTo(RAW_FIR)] annotations container + @FILE:R|kotlin/Suppress|[Types](names = vararg(String(1))) + [ResolvedTo(BODY_RESOLVE)] annotations container @R|kotlin/Suppress|[Types](names = vararg(String(2))) public final [ResolvedTo(BODY_RESOLVE)] fun resolveMe(): R|kotlin/Unit| { } diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/classMembers.txt b/analysis/low-level-api-fir/testdata/lazyResolve/classMembers.txt index eaa91f2373b..5038740a898 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/classMembers.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/classMembers.txt @@ -78,7 +78,7 @@ FILE: [ResolvedTo(IMPORTS)] classMembers.kt SUPER_TYPES: FILE: [ResolvedTo(IMPORTS)] classMembers.kt [ResolvedTo(RAW_FIR)] annotations container - public? final? [ResolvedTo(RAW_FIR)] class A : R|kotlin/Any| { + public? final? [ResolvedTo(SUPER_TYPES)] class A : R|kotlin/Any| { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=A] constructor(): R|A| { LAZY_super } @@ -97,59 +97,57 @@ FILE: [ResolvedTo(IMPORTS)] classMembers.kt TYPES: FILE: [ResolvedTo(IMPORTS)] classMembers.kt [ResolvedTo(RAW_FIR)] annotations container - public? final? [ResolvedTo(SUPER_TYPES)] class A : R|kotlin/Any| { - public? [ResolvedTo(SUPER_TYPES)] [ContainingClassKey=A] constructor(): R|A| { + public? final? [ResolvedTo(TYPES)] class A : R|kotlin/Any| { + public? [ResolvedTo(TYPES)] [ContainingClassKey=A] constructor(): R|A| { LAZY_super } public? final? [ResolvedTo(TYPES)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } - public? final? [ResolvedTo(SUPER_TYPES)] val x: Int = LAZY_EXPRESSION - public? [ResolvedTo(SUPER_TYPES)] [ContainingClassKey=A] get(): Int { LAZY_BLOCK } + public? final? [ResolvedTo(RAW_FIR)] val x: Int = LAZY_EXPRESSION + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=A] get(): Int { LAZY_BLOCK } - public? final? [ResolvedTo(SUPER_TYPES)] fun receive([ResolvedTo(SUPER_TYPES)] value: String): R|kotlin/Unit| { LAZY_BLOCK } + public? final? [ResolvedTo(RAW_FIR)] fun receive([ResolvedTo(RAW_FIR)] value: String): R|kotlin/Unit| { LAZY_BLOCK } - public? final? [ResolvedTo(SUPER_TYPES)] fun functionWithLazyBody(): String { LAZY_BLOCK } + public? final? [ResolvedTo(RAW_FIR)] fun functionWithLazyBody(): String { LAZY_BLOCK } } STATUS: FILE: [ResolvedTo(IMPORTS)] classMembers.kt [ResolvedTo(RAW_FIR)] annotations container - public final [ResolvedTo(SUPER_TYPES)] class A : R|kotlin/Any| { - public [ResolvedTo(TYPES)] [ContainingClassKey=A] constructor(): R|A| { + public final [ResolvedTo(STATUS)] class A : R|kotlin/Any| { + public [ResolvedTo(STATUS)] [ContainingClassKey=A] constructor(): R|A| { LAZY_super } public final [ResolvedTo(STATUS)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } - public final [ResolvedTo(TYPES)] val x: R|kotlin/Int| = LAZY_EXPRESSION - public [ResolvedTo(TYPES)] [ContainingClassKey=A] get(): R|kotlin/Int| { LAZY_BLOCK } + public final [ResolvedTo(STATUS)] val x: R|kotlin/Int| = LAZY_EXPRESSION + public [ResolvedTo(STATUS)] [ContainingClassKey=A] get(): R|kotlin/Int| { LAZY_BLOCK } - public final [ResolvedTo(TYPES)] fun receive([ResolvedTo(TYPES)] value: R|kotlin/String|): R|kotlin/Unit| { LAZY_BLOCK } + public final [ResolvedTo(STATUS)] fun receive([ResolvedTo(STATUS)] value: R|kotlin/String|): R|kotlin/Unit| { LAZY_BLOCK } - public final [ResolvedTo(TYPES)] fun functionWithLazyBody(): R|kotlin/String| { LAZY_BLOCK } + public final [ResolvedTo(STATUS)] fun functionWithLazyBody(): R|kotlin/String| { LAZY_BLOCK } } EXPECT_ACTUAL_MATCHING: FILE: [ResolvedTo(IMPORTS)] classMembers.kt [ResolvedTo(RAW_FIR)] annotations container - public final [ResolvedTo(SUPER_TYPES)] class A : R|kotlin/Any| { - public [ResolvedTo(TYPES)] [ContainingClassKey=A] constructor(): R|A| { + public final [ResolvedTo(STATUS)] class A : R|kotlin/Any| { + public [ResolvedTo(STATUS)] [ContainingClassKey=A] constructor(): R|A| { LAZY_super } - public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe(): R|kotlin/Unit| { - receive#(functionWithLazyBody#()) - } + public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } - public final [ResolvedTo(TYPES)] val x: R|kotlin/Int| = LAZY_EXPRESSION - public [ResolvedTo(TYPES)] [ContainingClassKey=A] get(): R|kotlin/Int| { LAZY_BLOCK } + public final [ResolvedTo(STATUS)] val x: R|kotlin/Int| = LAZY_EXPRESSION + public [ResolvedTo(STATUS)] [ContainingClassKey=A] get(): R|kotlin/Int| { LAZY_BLOCK } - public final [ResolvedTo(TYPES)] fun receive([ResolvedTo(TYPES)] value: R|kotlin/String|): R|kotlin/Unit| { LAZY_BLOCK } + public final [ResolvedTo(STATUS)] fun receive([ResolvedTo(STATUS)] value: R|kotlin/String|): R|kotlin/Unit| { LAZY_BLOCK } - public final [ResolvedTo(TYPES)] fun functionWithLazyBody(): R|kotlin/String| { LAZY_BLOCK } + public final [ResolvedTo(STATUS)] fun functionWithLazyBody(): R|kotlin/String| { LAZY_BLOCK } } @@ -161,9 +159,7 @@ FILE: [ResolvedTo(IMPORTS)] classMembers.kt LAZY_super } - public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun resolveMe(): R|kotlin/Unit| { - receive#(functionWithLazyBody#()) - } + public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } public final [ResolvedTo(STATUS)] val x: R|kotlin/Int| = LAZY_EXPRESSION public [ResolvedTo(STATUS)] [ContainingClassKey=A] get(): R|kotlin/Int| { LAZY_BLOCK } diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/classes/classWithTypeParameters.txt b/analysis/low-level-api-fir/testdata/lazyResolve/classes/classWithTypeParameters.txt index 467f34fb944..19f926fa081 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/classes/classWithTypeParameters.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/classes/classWithTypeParameters.txt @@ -23,7 +23,7 @@ COMPILER_REQUIRED_ANNOTATIONS: FILE: [ResolvedTo(IMPORTS)] classWithTypeParameters.kt [ResolvedTo(RAW_FIR)] annotations container public? final? [ResolvedTo(COMPILER_REQUIRED_ANNOTATIONS)] class ResolveMe<[ResolvedTo(COMPILER_REQUIRED_ANNOTATIONS)] T : Int, [ResolvedTo(COMPILER_REQUIRED_ANNOTATIONS)] K> : R|kotlin/Any| { - public? [ResolvedTo(COMPILER_REQUIRED_ANNOTATIONS)] [ContainingClassKey=ResolveMe] constructor<[ResolvedTo(COMPILER_REQUIRED_ANNOTATIONS)] T : Int, [ResolvedTo(COMPILER_REQUIRED_ANNOTATIONS)] K>(): R|ResolveMe| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=ResolveMe] constructor<[ResolvedTo(COMPILER_REQUIRED_ANNOTATIONS)] T : Int, [ResolvedTo(COMPILER_REQUIRED_ANNOTATIONS)] K>(): R|ResolveMe| { LAZY_super } @@ -33,7 +33,7 @@ COMPANION_GENERATION: FILE: [ResolvedTo(IMPORTS)] classWithTypeParameters.kt [ResolvedTo(RAW_FIR)] annotations container public? final? [ResolvedTo(COMPANION_GENERATION)] class ResolveMe<[ResolvedTo(COMPANION_GENERATION)] T : Int, [ResolvedTo(COMPANION_GENERATION)] K> : R|kotlin/Any| { - public? [ResolvedTo(COMPANION_GENERATION)] [ContainingClassKey=ResolveMe] constructor<[ResolvedTo(COMPANION_GENERATION)] T : Int, [ResolvedTo(COMPANION_GENERATION)] K>(): R|ResolveMe| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=ResolveMe] constructor<[ResolvedTo(COMPANION_GENERATION)] T : Int, [ResolvedTo(COMPANION_GENERATION)] K>(): R|ResolveMe| { LAZY_super } @@ -43,7 +43,7 @@ SUPER_TYPES: FILE: [ResolvedTo(IMPORTS)] classWithTypeParameters.kt [ResolvedTo(RAW_FIR)] annotations container public? final? [ResolvedTo(SUPER_TYPES)] class ResolveMe<[ResolvedTo(SUPER_TYPES)] T : Int, [ResolvedTo(SUPER_TYPES)] K> : R|kotlin/Any| { - public? [ResolvedTo(SUPER_TYPES)] [ContainingClassKey=ResolveMe] constructor<[ResolvedTo(SUPER_TYPES)] T : Int, [ResolvedTo(SUPER_TYPES)] K>(): R|ResolveMe| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=ResolveMe] constructor<[ResolvedTo(SUPER_TYPES)] T : Int, [ResolvedTo(SUPER_TYPES)] K>(): R|ResolveMe| { LAZY_super } @@ -53,7 +53,7 @@ TYPES: FILE: [ResolvedTo(IMPORTS)] classWithTypeParameters.kt [ResolvedTo(RAW_FIR)] annotations container public? final? [ResolvedTo(TYPES)] class ResolveMe<[ResolvedTo(TYPES)] T : R|kotlin/Int|, [ResolvedTo(TYPES)] K> : R|kotlin/Any| { - public? [ResolvedTo(TYPES)] [ContainingClassKey=ResolveMe] constructor<[ResolvedTo(TYPES)] T : R|kotlin/Int|, [ResolvedTo(TYPES)] K>(): R|ResolveMe| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=ResolveMe] constructor<[ResolvedTo(TYPES)] T : R|kotlin/Int|, [ResolvedTo(TYPES)] K>(): R|ResolveMe| { LAZY_super } @@ -73,8 +73,8 @@ EXPECT_ACTUAL_MATCHING: FILE: [ResolvedTo(IMPORTS)] classWithTypeParameters.kt [ResolvedTo(RAW_FIR)] annotations container public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] class ResolveMe<[ResolvedTo(EXPECT_ACTUAL_MATCHING)] T : R|kotlin/Int|, [ResolvedTo(EXPECT_ACTUAL_MATCHING)] K> : R|kotlin/Any| { - public [ResolvedTo(EXPECT_ACTUAL_MATCHING)] [ContainingClassKey=ResolveMe] constructor<[ResolvedTo(EXPECT_ACTUAL_MATCHING)] T : R|kotlin/Int|, [ResolvedTo(EXPECT_ACTUAL_MATCHING)] K>(): R|ResolveMe| { - super() + public [ResolvedTo(STATUS)] [ContainingClassKey=ResolveMe] constructor<[ResolvedTo(EXPECT_ACTUAL_MATCHING)] T : R|kotlin/Int|, [ResolvedTo(EXPECT_ACTUAL_MATCHING)] K>(): R|ResolveMe| { + LAZY_super } } @@ -83,8 +83,8 @@ ARGUMENTS_OF_ANNOTATIONS: FILE: [ResolvedTo(IMPORTS)] classWithTypeParameters.kt [ResolvedTo(RAW_FIR)] annotations container public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] class ResolveMe<[ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] T : R|kotlin/Int|, [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] K> : R|kotlin/Any| { - public [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] [ContainingClassKey=ResolveMe] constructor<[ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] T : R|kotlin/Int|, [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] K>(): R|ResolveMe| { - super() + public [ResolvedTo(STATUS)] [ContainingClassKey=ResolveMe] constructor<[ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] T : R|kotlin/Int|, [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] K>(): R|ResolveMe| { + LAZY_super } } @@ -93,8 +93,8 @@ CONTRACTS: FILE: [ResolvedTo(IMPORTS)] classWithTypeParameters.kt [ResolvedTo(RAW_FIR)] annotations container public final [ResolvedTo(CONTRACTS)] class ResolveMe<[ResolvedTo(CONTRACTS)] T : R|kotlin/Int|, [ResolvedTo(CONTRACTS)] K> : R|kotlin/Any| { - public [ResolvedTo(CONTRACTS)] [ContainingClassKey=ResolveMe] constructor<[ResolvedTo(CONTRACTS)] T : R|kotlin/Int|, [ResolvedTo(CONTRACTS)] K>(): R|ResolveMe| { - super() + public [ResolvedTo(STATUS)] [ContainingClassKey=ResolveMe] constructor<[ResolvedTo(CONTRACTS)] T : R|kotlin/Int|, [ResolvedTo(CONTRACTS)] K>(): R|ResolveMe| { + LAZY_super } } @@ -103,8 +103,8 @@ IMPLICIT_TYPES_BODY_RESOLVE: FILE: [ResolvedTo(IMPORTS)] classWithTypeParameters.kt [ResolvedTo(RAW_FIR)] annotations container public final [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] class ResolveMe<[ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] T : R|kotlin/Int|, [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] K> : R|kotlin/Any| { - public [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] [ContainingClassKey=ResolveMe] constructor<[ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] T : R|kotlin/Int|, [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] K>(): R|ResolveMe| { - super() + public [ResolvedTo(STATUS)] [ContainingClassKey=ResolveMe] constructor<[ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] T : R|kotlin/Int|, [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] K>(): R|ResolveMe| { + LAZY_super } } @@ -113,8 +113,8 @@ ANNOTATIONS_ARGUMENTS_MAPPING: FILE: [ResolvedTo(IMPORTS)] classWithTypeParameters.kt [ResolvedTo(RAW_FIR)] annotations container public final [ResolvedTo(ANNOTATIONS_ARGUMENTS_MAPPING)] class ResolveMe<[ResolvedTo(ANNOTATIONS_ARGUMENTS_MAPPING)] T : R|kotlin/Int|, [ResolvedTo(ANNOTATIONS_ARGUMENTS_MAPPING)] K> : R|kotlin/Any| { - public [ResolvedTo(ANNOTATIONS_ARGUMENTS_MAPPING)] [ContainingClassKey=ResolveMe] constructor<[ResolvedTo(ANNOTATIONS_ARGUMENTS_MAPPING)] T : R|kotlin/Int|, [ResolvedTo(ANNOTATIONS_ARGUMENTS_MAPPING)] K>(): R|ResolveMe| { - super() + public [ResolvedTo(STATUS)] [ContainingClassKey=ResolveMe] constructor<[ResolvedTo(ANNOTATIONS_ARGUMENTS_MAPPING)] T : R|kotlin/Int|, [ResolvedTo(ANNOTATIONS_ARGUMENTS_MAPPING)] K>(): R|ResolveMe| { + LAZY_super } } diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/classes/functionInValueClass.txt b/analysis/low-level-api-fir/testdata/lazyResolve/classes/functionInValueClass.txt index 70ccf4c69bf..7234c88bf3f 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/classes/functionInValueClass.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/classes/functionInValueClass.txt @@ -62,7 +62,7 @@ FILE: [ResolvedTo(IMPORTS)] functionInValueClass.kt SUPER_TYPES: FILE: [ResolvedTo(IMPORTS)] functionInValueClass.kt [ResolvedTo(RAW_FIR)] annotations container - @JvmInline[Unresolved]() public? final? inline [ResolvedTo(RAW_FIR)] class Value : R|kotlin/Any| { + @JvmInline[Unresolved]() public? final? inline [ResolvedTo(SUPER_TYPES)] class Value : R|kotlin/Any| { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Value] constructor([ResolvedTo(RAW_FIR)] [CorrespondingProperty=/Value.value] value: Int): R|Value| { LAZY_super } @@ -77,13 +77,13 @@ FILE: [ResolvedTo(IMPORTS)] functionInValueClass.kt TYPES: FILE: [ResolvedTo(IMPORTS)] functionInValueClass.kt [ResolvedTo(RAW_FIR)] annotations container - @R|kotlin/jvm/JvmInline|[Types]() public? final? inline [ResolvedTo(SUPER_TYPES)] class Value : R|kotlin/Any| { - public? [ResolvedTo(SUPER_TYPES)] [ContainingClassKey=Value] constructor([ResolvedTo(SUPER_TYPES)] [CorrespondingProperty=/Value.value] value: Int): R|Value| { + @R|kotlin/jvm/JvmInline|[Types]() public? final? inline [ResolvedTo(TYPES)] class Value : R|kotlin/Any| { + public? [ResolvedTo(TYPES)] [ContainingClassKey=Value] constructor([ResolvedTo(TYPES)] [CorrespondingProperty=/Value.value] value: R|kotlin/Int|): R|Value| { LAZY_super } - public? final? [ResolvedTo(SUPER_TYPES)] [IsFromPrimaryConstructor=true] val value: Int = R|/value| - public? [ResolvedTo(SUPER_TYPES)] [ContainingClassKey=Value] get(): Int + public? final? [ResolvedTo(RAW_FIR)] [IsFromPrimaryConstructor=true] val value: Int = R|/value| + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=Value] get(): Int public? final? [ResolvedTo(TYPES)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } @@ -92,13 +92,13 @@ FILE: [ResolvedTo(IMPORTS)] functionInValueClass.kt STATUS: FILE: [ResolvedTo(IMPORTS)] functionInValueClass.kt [ResolvedTo(RAW_FIR)] annotations container - @R|kotlin/jvm/JvmInline|[Types]() public final inline [ResolvedTo(SUPER_TYPES)] [FirValueClassRepresentationKey=InlineClassRepresentation(underlyingPropertyName=value, underlyingType=kotlin/Int)] class Value : R|kotlin/Any| { - public [ResolvedTo(TYPES)] [ContainingClassKey=Value] constructor([ResolvedTo(TYPES)] [CorrespondingProperty=/Value.value] value: R|kotlin/Int|): R|Value| { + @R|kotlin/jvm/JvmInline|[Types]() public final inline [ResolvedTo(STATUS)] [FirValueClassRepresentationKey=InlineClassRepresentation(underlyingPropertyName=value, underlyingType=kotlin/Int)] class Value : R|kotlin/Any| { + public [ResolvedTo(STATUS)] [ContainingClassKey=Value] constructor([ResolvedTo(STATUS)] [CorrespondingProperty=/Value.value] value: R|kotlin/Int|): R|Value| { LAZY_super } - public final [ResolvedTo(TYPES)] [IsFromPrimaryConstructor=true] val value: R|kotlin/Int| = R|/value| - public [ResolvedTo(TYPES)] [ContainingClassKey=Value] get(): R|kotlin/Int| + public final [ResolvedTo(STATUS)] [IsFromPrimaryConstructor=true] val value: R|kotlin/Int| = R|/value| + public [ResolvedTo(STATUS)] [ContainingClassKey=Value] get(): R|kotlin/Int| public final [ResolvedTo(STATUS)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } @@ -107,16 +107,15 @@ FILE: [ResolvedTo(IMPORTS)] functionInValueClass.kt EXPECT_ACTUAL_MATCHING: FILE: [ResolvedTo(IMPORTS)] functionInValueClass.kt [ResolvedTo(RAW_FIR)] annotations container - @R|kotlin/jvm/JvmInline|[Types]() public final inline [ResolvedTo(SUPER_TYPES)] [FirValueClassRepresentationKey=InlineClassRepresentation(underlyingPropertyName=value, underlyingType=kotlin/Int)] class Value : R|kotlin/Any| { - public [ResolvedTo(TYPES)] [ContainingClassKey=Value] constructor([ResolvedTo(TYPES)] [CorrespondingProperty=/Value.value] value: R|kotlin/Int|): R|Value| { + @R|kotlin/jvm/JvmInline|[Types]() public final inline [ResolvedTo(STATUS)] [FirValueClassRepresentationKey=InlineClassRepresentation(underlyingPropertyName=value, underlyingType=kotlin/Int)] class Value : R|kotlin/Any| { + public [ResolvedTo(STATUS)] [ContainingClassKey=Value] constructor([ResolvedTo(STATUS)] [CorrespondingProperty=/Value.value] value: R|kotlin/Int|): R|Value| { LAZY_super } - public final [ResolvedTo(TYPES)] [IsFromPrimaryConstructor=true] val value: R|kotlin/Int| = R|/value| - public [ResolvedTo(TYPES)] [ContainingClassKey=Value] get(): R|kotlin/Int| + public final [ResolvedTo(STATUS)] [IsFromPrimaryConstructor=true] val value: R|kotlin/Int| = R|/value| + public [ResolvedTo(STATUS)] [ContainingClassKey=Value] get(): R|kotlin/Int| - public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe(): R|kotlin/Unit| { - } + public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } } @@ -131,8 +130,7 @@ FILE: [ResolvedTo(IMPORTS)] functionInValueClass.kt public final [ResolvedTo(STATUS)] [IsFromPrimaryConstructor=true] val value: R|kotlin/Int| = R|/value| public [ResolvedTo(STATUS)] [ContainingClassKey=Value] get(): R|kotlin/Int| - public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun resolveMe(): R|kotlin/Unit| { - } + public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } } diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/classes/nestedClassWithPropertiesOverrides.txt b/analysis/low-level-api-fir/testdata/lazyResolve/classes/nestedClassWithPropertiesOverrides.txt index d2ce57b3ee1..b4372dd6c63 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/classes/nestedClassWithPropertiesOverrides.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/classes/nestedClassWithPropertiesOverrides.txt @@ -57,12 +57,12 @@ FILE: [ResolvedTo(IMPORTS)] nestedClassWithPropertiesOverrides.kt public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=OV] get(): A public? final? [ResolvedTo(COMPILER_REQUIRED_ANNOTATIONS)] class ResolveMe : OV { - public? [ResolvedTo(COMPILER_REQUIRED_ANNOTATIONS)] [ContainingClassKey=ResolveMe] constructor(): R|OV.ResolveMe| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=ResolveMe] constructor(): R|OV.ResolveMe| { LAZY_super<> } - public? open? override [ResolvedTo(COMPILER_REQUIRED_ANNOTATIONS)] val originalExpressions: A - public? [ResolvedTo(COMPILER_REQUIRED_ANNOTATIONS)] [ContainingClassKey=ResolveMe] get(): A + public? open? override [ResolvedTo(RAW_FIR)] val originalExpressions: A + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=ResolveMe] get(): A } @@ -82,12 +82,12 @@ FILE: [ResolvedTo(IMPORTS)] nestedClassWithPropertiesOverrides.kt public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=OV] get(): A public? final? [ResolvedTo(COMPANION_GENERATION)] class ResolveMe : OV { - public? [ResolvedTo(COMPANION_GENERATION)] [ContainingClassKey=ResolveMe] constructor(): R|OV.ResolveMe| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=ResolveMe] constructor(): R|OV.ResolveMe| { LAZY_super<> } - public? open? override [ResolvedTo(COMPANION_GENERATION)] val originalExpressions: A - public? [ResolvedTo(COMPANION_GENERATION)] [ContainingClassKey=ResolveMe] get(): A + public? open? override [ResolvedTo(RAW_FIR)] val originalExpressions: A + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=ResolveMe] get(): A } @@ -102,17 +102,17 @@ FILE: [ResolvedTo(IMPORTS)] nestedClassWithPropertiesOverrides.kt SUPER_TYPES: FILE: [ResolvedTo(IMPORTS)] nestedClassWithPropertiesOverrides.kt [ResolvedTo(RAW_FIR)] annotations container - public? final? [ResolvedTo(RAW_FIR)] interface OV : R|kotlin/Any| { + public? final? [ResolvedTo(SUPER_TYPES)] interface OV : R|kotlin/Any| { public? final? [ResolvedTo(RAW_FIR)] val originalExpressions: A public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=OV] get(): A public? final? [ResolvedTo(SUPER_TYPES)] class ResolveMe : R|OV| { - public? [ResolvedTo(SUPER_TYPES)] [ContainingClassKey=ResolveMe] constructor(): R|OV.ResolveMe| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=ResolveMe] constructor(): R|OV.ResolveMe| { LAZY_super<> } - public? open? override [ResolvedTo(SUPER_TYPES)] val originalExpressions: A - public? [ResolvedTo(SUPER_TYPES)] [ContainingClassKey=ResolveMe] get(): A + public? open? override [ResolvedTo(RAW_FIR)] val originalExpressions: A + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=ResolveMe] get(): A } @@ -127,17 +127,17 @@ FILE: [ResolvedTo(IMPORTS)] nestedClassWithPropertiesOverrides.kt TYPES: FILE: [ResolvedTo(IMPORTS)] nestedClassWithPropertiesOverrides.kt [ResolvedTo(RAW_FIR)] annotations container - public? final? [ResolvedTo(SUPER_TYPES)] interface OV : R|kotlin/Any| { - public? final? [ResolvedTo(SUPER_TYPES)] val originalExpressions: A - public? [ResolvedTo(SUPER_TYPES)] [ContainingClassKey=OV] get(): A + public? final? [ResolvedTo(TYPES)] interface OV : R|kotlin/Any| { + public? final? [ResolvedTo(RAW_FIR)] val originalExpressions: A + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=OV] get(): A public? final? [ResolvedTo(TYPES)] class ResolveMe : R|OV| { - public? [ResolvedTo(TYPES)] [ContainingClassKey=ResolveMe] constructor(): R|OV.ResolveMe| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=ResolveMe] constructor(): R|OV.ResolveMe| { LAZY_super<> } - public? open? override [ResolvedTo(TYPES)] val originalExpressions: R|A| - public? [ResolvedTo(TYPES)] [ContainingClassKey=ResolveMe] get(): R|A| + public? open? override [ResolvedTo(RAW_FIR)] val originalExpressions: A + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=ResolveMe] get(): A } @@ -152,9 +152,9 @@ FILE: [ResolvedTo(IMPORTS)] nestedClassWithPropertiesOverrides.kt STATUS: FILE: [ResolvedTo(IMPORTS)] nestedClassWithPropertiesOverrides.kt [ResolvedTo(RAW_FIR)] annotations container - public abstract [ResolvedTo(SUPER_TYPES)] interface OV : R|kotlin/Any| { - public abstract [ResolvedTo(TYPES)] val originalExpressions: R|A| - public [ResolvedTo(TYPES)] [ContainingClassKey=OV] get(): R|A| + public abstract [ResolvedTo(STATUS)] interface OV : R|kotlin/Any| { + public abstract [ResolvedTo(STATUS)] val originalExpressions: R|A| + public [ResolvedTo(STATUS)] [ContainingClassKey=OV] get(): R|A| public final [ResolvedTo(STATUS)] class ResolveMe : R|OV| { public [ResolvedTo(STATUS)] [ContainingClassKey=ResolveMe] constructor(): R|OV.ResolveMe| { @@ -177,17 +177,17 @@ FILE: [ResolvedTo(IMPORTS)] nestedClassWithPropertiesOverrides.kt EXPECT_ACTUAL_MATCHING: FILE: [ResolvedTo(IMPORTS)] nestedClassWithPropertiesOverrides.kt [ResolvedTo(RAW_FIR)] annotations container - public abstract [ResolvedTo(SUPER_TYPES)] interface OV : R|kotlin/Any| { - public abstract [ResolvedTo(TYPES)] val originalExpressions: R|A| - public [ResolvedTo(TYPES)] [ContainingClassKey=OV] get(): R|A| + public abstract [ResolvedTo(STATUS)] interface OV : R|kotlin/Any| { + public abstract [ResolvedTo(STATUS)] val originalExpressions: R|A| + public [ResolvedTo(STATUS)] [ContainingClassKey=OV] get(): R|A| public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] class ResolveMe : R|OV| { - public [ResolvedTo(EXPECT_ACTUAL_MATCHING)] [ContainingClassKey=ResolveMe] constructor(): R|OV.ResolveMe| { - super<>() + public [ResolvedTo(STATUS)] [ContainingClassKey=ResolveMe] constructor(): R|OV.ResolveMe| { + LAZY_super<> } - public open override [ResolvedTo(EXPECT_ACTUAL_MATCHING)] val originalExpressions: R|A| - public [ResolvedTo(EXPECT_ACTUAL_MATCHING)] [ContainingClassKey=ResolveMe] get(): R|A| + public open override [ResolvedTo(STATUS)] val originalExpressions: R|A| + public [ResolvedTo(STATUS)] [ContainingClassKey=ResolveMe] get(): R|A| } @@ -207,12 +207,12 @@ FILE: [ResolvedTo(IMPORTS)] nestedClassWithPropertiesOverrides.kt public [ResolvedTo(STATUS)] [ContainingClassKey=OV] get(): R|A| public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] class ResolveMe : R|OV| { - public [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] [ContainingClassKey=ResolveMe] constructor(): R|OV.ResolveMe| { - super<>() + public [ResolvedTo(STATUS)] [ContainingClassKey=ResolveMe] constructor(): R|OV.ResolveMe| { + LAZY_super<> } - public open override [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] val originalExpressions: R|A| - public [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] [ContainingClassKey=ResolveMe] get(): R|A| + public open override [ResolvedTo(STATUS)] val originalExpressions: R|A| + public [ResolvedTo(STATUS)] [ContainingClassKey=ResolveMe] get(): R|A| } @@ -232,12 +232,12 @@ FILE: [ResolvedTo(IMPORTS)] nestedClassWithPropertiesOverrides.kt public [ResolvedTo(STATUS)] [ContainingClassKey=OV] get(): R|A| public final [ResolvedTo(CONTRACTS)] class ResolveMe : R|OV| { - public [ResolvedTo(CONTRACTS)] [ContainingClassKey=ResolveMe] constructor(): R|OV.ResolveMe| { - super<>() + public [ResolvedTo(STATUS)] [ContainingClassKey=ResolveMe] constructor(): R|OV.ResolveMe| { + LAZY_super<> } - public open override [ResolvedTo(CONTRACTS)] val originalExpressions: R|A| - public [ResolvedTo(CONTRACTS)] [ContainingClassKey=ResolveMe] get(): R|A| + public open override [ResolvedTo(STATUS)] val originalExpressions: R|A| + public [ResolvedTo(STATUS)] [ContainingClassKey=ResolveMe] get(): R|A| } @@ -257,12 +257,12 @@ FILE: [ResolvedTo(IMPORTS)] nestedClassWithPropertiesOverrides.kt public [ResolvedTo(STATUS)] [ContainingClassKey=OV] get(): R|A| public final [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] class ResolveMe : R|OV| { - public [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] [ContainingClassKey=ResolveMe] constructor(): R|OV.ResolveMe| { - super<>() + public [ResolvedTo(STATUS)] [ContainingClassKey=ResolveMe] constructor(): R|OV.ResolveMe| { + LAZY_super<> } - public open override [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] val originalExpressions: R|A| - public [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] [ContainingClassKey=ResolveMe] get(): R|A| + public open override [ResolvedTo(STATUS)] val originalExpressions: R|A| + public [ResolvedTo(STATUS)] [ContainingClassKey=ResolveMe] get(): R|A| } @@ -282,12 +282,12 @@ FILE: [ResolvedTo(IMPORTS)] nestedClassWithPropertiesOverrides.kt public [ResolvedTo(STATUS)] [ContainingClassKey=OV] get(): R|A| public final [ResolvedTo(ANNOTATIONS_ARGUMENTS_MAPPING)] class ResolveMe : R|OV| { - public [ResolvedTo(ANNOTATIONS_ARGUMENTS_MAPPING)] [ContainingClassKey=ResolveMe] constructor(): R|OV.ResolveMe| { - super<>() + public [ResolvedTo(STATUS)] [ContainingClassKey=ResolveMe] constructor(): R|OV.ResolveMe| { + LAZY_super<> } - public open override [ResolvedTo(ANNOTATIONS_ARGUMENTS_MAPPING)] val originalExpressions: R|A| - public [ResolvedTo(ANNOTATIONS_ARGUMENTS_MAPPING)] [ContainingClassKey=ResolveMe] get(): R|A| + public open override [ResolvedTo(STATUS)] val originalExpressions: R|A| + public [ResolvedTo(STATUS)] [ContainingClassKey=ResolveMe] get(): R|A| } diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/delegates.txt b/analysis/low-level-api-fir/testdata/lazyResolve/delegates.txt index 31d972ec164..722ef810be4 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/delegates.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/delegates.txt @@ -212,12 +212,7 @@ FILE: [ResolvedTo(IMPORTS)] delegates.kt EXPECT_ACTUAL_MATCHING: FILE: [ResolvedTo(IMPORTS)] delegates.kt [ResolvedTo(RAW_FIR)] annotations container - public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe(): R|kotlin/Unit| { - receive#(valueWithExplicitType#) - receive#(valueWithImplicitType#) - variableWithExplicitType# = IntegerLiteral(10) - variableWithImplicitType# = IntegerLiteral(10) - } + public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } public? final? [ResolvedTo(RAW_FIR)] fun receive([ResolvedTo(RAW_FIR)] value: Int): R|kotlin/Unit| { LAZY_BLOCK } public? final? [ResolvedTo(RAW_FIR)] val delegate: = LAZY_EXPRESSION public? [ResolvedTo(RAW_FIR)] get(): @@ -247,12 +242,7 @@ FILE: [ResolvedTo(IMPORTS)] delegates.kt ARGUMENTS_OF_ANNOTATIONS: FILE: [ResolvedTo(IMPORTS)] delegates.kt [ResolvedTo(RAW_FIR)] annotations container - public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun resolveMe(): R|kotlin/Unit| { - receive#(valueWithExplicitType#) - receive#(valueWithImplicitType#) - variableWithExplicitType# = IntegerLiteral(10) - variableWithImplicitType# = IntegerLiteral(10) - } + public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } public? final? [ResolvedTo(RAW_FIR)] fun receive([ResolvedTo(RAW_FIR)] value: Int): R|kotlin/Unit| { LAZY_BLOCK } public? final? [ResolvedTo(RAW_FIR)] val delegate: = LAZY_EXPRESSION public? [ResolvedTo(RAW_FIR)] get(): @@ -414,8 +404,8 @@ FILE: [ResolvedTo(IMPORTS)] delegates.kt public [ResolvedTo(CONTRACTS)] get(): R|kotlin/Int| { ^ D|/valueWithExplicitType|.getValue#(Null(null), ::R|/valueWithExplicitType|) } - public final [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] val valueWithImplicitType: R|kotlin/Int|by R|/delegate| - public [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] get(): R|kotlin/Int| { + public final [ResolvedTo(CONTRACTS)] val valueWithImplicitType: R|kotlin/Int|by R|/delegate| + public [ResolvedTo(CONTRACTS)] get(): R|kotlin/Int| { ^ D|/valueWithImplicitType|.R|SubstitutionOverride|(Null(null), ::R|/valueWithImplicitType|) } public final [ResolvedTo(CONTRACTS)] var variableWithExplicitType: R|kotlin/Int|by delegate# @@ -425,11 +415,11 @@ FILE: [ResolvedTo(IMPORTS)] delegates.kt public [ResolvedTo(CONTRACTS)] set([ResolvedTo(CONTRACTS)] : R|kotlin/Int|): R|kotlin/Unit| { D|/variableWithExplicitType|.setValue#(Null(null), ::R|/variableWithExplicitType|, R|/variableWithExplicitType|) } - public final [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] var variableWithImplicitType: R|kotlin/Int|by R|/delegate| - public [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] get(): R|kotlin/Int| { + public final [ResolvedTo(CONTRACTS)] var variableWithImplicitType: R|kotlin/Int|by R|/delegate| + public [ResolvedTo(CONTRACTS)] get(): R|kotlin/Int| { ^ D|/variableWithImplicitType|.R|SubstitutionOverride|(Null(null), ::R|/variableWithImplicitType|) } - public [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] set([ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] : R|kotlin/Int|): R|kotlin/Unit| { + public [ResolvedTo(CONTRACTS)] set([ResolvedTo(CONTRACTS)] : R|kotlin/Int|): R|kotlin/Unit| { D|/variableWithImplicitType|.R|SubstitutionOverride|(Null(null), ::R|/variableWithImplicitType|, R|/variableWithImplicitType|) } diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/enumEntry.txt b/analysis/low-level-api-fir/testdata/lazyResolve/enumEntry.txt index cb041fee422..0d36b3698f4 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/enumEntry.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/enumEntry.txt @@ -112,7 +112,7 @@ FILE: [ResolvedTo(IMPORTS)] enumEntry.kt } } - public? final? [ResolvedTo(RAW_FIR)] enum class Foo : R|kotlin/Enum| { + public? final? [ResolvedTo(SUPER_TYPES)] enum class Foo : R|kotlin/Enum| { private [ResolvedTo(RAW_FIR)] [ContainingClassKey=Foo] constructor(): R|Foo| { LAZY_super|> } @@ -138,20 +138,20 @@ FILE: [ResolvedTo(IMPORTS)] enumEntry.kt } } - public? final? [ResolvedTo(SUPER_TYPES)] enum class Foo : R|kotlin/Enum| { - private [ResolvedTo(SUPER_TYPES)] [ContainingClassKey=Foo] constructor(): R|Foo| { + public? final? [ResolvedTo(TYPES)] enum class Foo : R|kotlin/Enum| { + private [ResolvedTo(TYPES)] [ContainingClassKey=Foo] constructor(): R|Foo| { LAZY_super|> } @R|Anno|[Types]() public final static [ResolvedTo(TYPES)] [ContainingClassKey=Foo] enum entry ResolveMe: R|Foo| = LAZY_EXPRESSION - public final static [ResolvedTo(SUPER_TYPES)] [ContainingClassKey=Foo] fun values(): R|kotlin/Array| { + public final static [ResolvedTo(RAW_FIR)] [ContainingClassKey=Foo] fun values(): R|kotlin/Array| { } - public final static [ResolvedTo(SUPER_TYPES)] [ContainingClassKey=Foo] fun valueOf([ResolvedTo(SUPER_TYPES)] value: R|kotlin/String|): R|Foo| { + public final static [ResolvedTo(RAW_FIR)] [ContainingClassKey=Foo] fun valueOf([ResolvedTo(RAW_FIR)] value: R|kotlin/String|): R|Foo| { } - public final static [ResolvedTo(SUPER_TYPES)] [ContainingClassKey=Foo] val entries: R|kotlin/enums/EnumEntries| - public [ResolvedTo(SUPER_TYPES)] get(): R|kotlin/enums/EnumEntries| + public final static [ResolvedTo(RAW_FIR)] [ContainingClassKey=Foo] val entries: R|kotlin/enums/EnumEntries| + public [ResolvedTo(RAW_FIR)] get(): R|kotlin/enums/EnumEntries| } @@ -164,20 +164,20 @@ FILE: [ResolvedTo(IMPORTS)] enumEntry.kt } } - public final [ResolvedTo(SUPER_TYPES)] enum class Foo : R|kotlin/Enum| { - private [ResolvedTo(TYPES)] [ContainingClassKey=Foo] constructor(): R|Foo| { + public final [ResolvedTo(STATUS)] enum class Foo : R|kotlin/Enum| { + private [ResolvedTo(STATUS)] [ContainingClassKey=Foo] constructor(): R|Foo| { LAZY_super|> } @R|Anno|[Types]() public final static [ResolvedTo(STATUS)] [ContainingClassKey=Foo] enum entry ResolveMe: R|Foo| = LAZY_EXPRESSION - public final static [ResolvedTo(TYPES)] [ContainingClassKey=Foo] fun values(): R|kotlin/Array| { + public final static [ResolvedTo(STATUS)] [ContainingClassKey=Foo] fun values(): R|kotlin/Array| { } - public final static [ResolvedTo(TYPES)] [ContainingClassKey=Foo] fun valueOf([ResolvedTo(TYPES)] value: R|kotlin/String|): R|Foo| { + public final static [ResolvedTo(STATUS)] [ContainingClassKey=Foo] fun valueOf([ResolvedTo(STATUS)] value: R|kotlin/String|): R|Foo| { } - public final static [ResolvedTo(TYPES)] [ContainingClassKey=Foo] val entries: R|kotlin/enums/EnumEntries| - public [ResolvedTo(TYPES)] get(): R|kotlin/enums/EnumEntries| + public final static [ResolvedTo(STATUS)] [ContainingClassKey=Foo] val entries: R|kotlin/enums/EnumEntries| + public [ResolvedTo(STATUS)] get(): R|kotlin/enums/EnumEntries| } @@ -190,26 +190,20 @@ FILE: [ResolvedTo(IMPORTS)] enumEntry.kt } } - public final [ResolvedTo(SUPER_TYPES)] enum class Foo : R|kotlin/Enum| { - private [ResolvedTo(TYPES)] [ContainingClassKey=Foo] constructor(): R|Foo| { + public final [ResolvedTo(STATUS)] enum class Foo : R|kotlin/Enum| { + private [ResolvedTo(STATUS)] [ContainingClassKey=Foo] constructor(): R|Foo| { LAZY_super|> } - @R|Anno|[Types]() public final static [ResolvedTo(EXPECT_ACTUAL_MATCHING)] [ContainingClassKey=Foo] enum entry ResolveMe: R|Foo| = object : R|Foo| { - private [ResolvedTo(RAW_FIR)] [ContainingClassKey=] constructor(): R|| { - super() - } - + @R|Anno|[Types]() public final static [ResolvedTo(EXPECT_ACTUAL_MATCHING)] [ContainingClassKey=Foo] enum entry ResolveMe: R|Foo| = LAZY_EXPRESSION + public final static [ResolvedTo(STATUS)] [ContainingClassKey=Foo] fun values(): R|kotlin/Array| { } - public final static [ResolvedTo(TYPES)] [ContainingClassKey=Foo] fun values(): R|kotlin/Array| { + public final static [ResolvedTo(STATUS)] [ContainingClassKey=Foo] fun valueOf([ResolvedTo(STATUS)] value: R|kotlin/String|): R|Foo| { } - public final static [ResolvedTo(TYPES)] [ContainingClassKey=Foo] fun valueOf([ResolvedTo(TYPES)] value: R|kotlin/String|): R|Foo| { - } - - public final static [ResolvedTo(TYPES)] [ContainingClassKey=Foo] val entries: R|kotlin/enums/EnumEntries| - public [ResolvedTo(TYPES)] get(): R|kotlin/enums/EnumEntries| + public final static [ResolvedTo(STATUS)] [ContainingClassKey=Foo] val entries: R|kotlin/enums/EnumEntries| + public [ResolvedTo(STATUS)] get(): R|kotlin/enums/EnumEntries| } @@ -227,13 +221,7 @@ FILE: [ResolvedTo(IMPORTS)] enumEntry.kt LAZY_super|> } - @R|Anno|[Types]() public final static [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] [ContainingClassKey=Foo] enum entry ResolveMe: R|Foo| = object : R|Foo| { - private [ResolvedTo(RAW_FIR)] [ContainingClassKey=] constructor(): R|| { - super() - } - - } - + @R|Anno|[Types]() public final static [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] [ContainingClassKey=Foo] enum entry ResolveMe: R|Foo| = LAZY_EXPRESSION public final static [ResolvedTo(STATUS)] [ContainingClassKey=Foo] fun values(): R|kotlin/Array| { } @@ -312,7 +300,7 @@ FILE: [ResolvedTo(IMPORTS)] enumEntry.kt ANNOTATIONS_ARGUMENTS_MAPPING: FILE: [ResolvedTo(IMPORTS)] enumEntry.kt [ResolvedTo(RAW_FIR)] annotations container - public final [ResolvedTo(SUPER_TYPES)] annotation class Anno : R|kotlin/Annotation| { + public final [ResolvedTo(STATUS)] annotation class Anno : R|kotlin/Annotation| { public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] constructor(): R|Anno| { LAZY_super } @@ -344,7 +332,7 @@ FILE: [ResolvedTo(IMPORTS)] enumEntry.kt BODY_RESOLVE: FILE: [ResolvedTo(IMPORTS)] enumEntry.kt [ResolvedTo(RAW_FIR)] annotations container - public final [ResolvedTo(SUPER_TYPES)] annotation class Anno : R|kotlin/Annotation| { + public final [ResolvedTo(STATUS)] annotation class Anno : R|kotlin/Annotation| { public [ResolvedTo(STATUS)] [ContainingClassKey=Anno] constructor(): R|Anno| { LAZY_super } diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/errors/anonymousObjectInInvalidPosition.txt b/analysis/low-level-api-fir/testdata/lazyResolve/errors/anonymousObjectInInvalidPosition.txt index d7cfa109820..986ffa75c47 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/errors/anonymousObjectInInvalidPosition.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/errors/anonymousObjectInInvalidPosition.txt @@ -72,16 +72,7 @@ FILE: [ResolvedTo(IMPORTS)] anonymousObjectInInvalidPosition.kt EXPECT_ACTUAL_MATCHING: FILE: [ResolvedTo(IMPORTS)] anonymousObjectInInvalidPosition.kt [ResolvedTo(RAW_FIR)] annotations container - private final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] val resolveMe: = ERROR_EXPR(Should have initializer)Null(null) = object : A { - private [ResolvedTo(RAW_FIR)] [ContainingClassKey=] constructor(): R|| { - super<>() - } - - public? open? override [ResolvedTo(RAW_FIR)] fun x(): R|kotlin/Unit| { - } - - } - + private final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] val resolveMe: = LAZY_EXPRESSION private [ResolvedTo(EXPECT_ACTUAL_MATCHING)] get(): public? final? [ResolvedTo(RAW_FIR)] interface A<[ResolvedTo(RAW_FIR)] T> : R|kotlin/Any| { public? final? [ResolvedTo(RAW_FIR)] fun x(): R|kotlin/Unit| @@ -91,16 +82,7 @@ FILE: [ResolvedTo(IMPORTS)] anonymousObjectInInvalidPosition.kt ARGUMENTS_OF_ANNOTATIONS: FILE: [ResolvedTo(IMPORTS)] anonymousObjectInInvalidPosition.kt [ResolvedTo(RAW_FIR)] annotations container - private final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] val resolveMe: = ERROR_EXPR(Should have initializer)Null(null) = object : A { - private [ResolvedTo(RAW_FIR)] [ContainingClassKey=] constructor(): R|| { - super<>() - } - - public? open? override [ResolvedTo(RAW_FIR)] fun x(): R|kotlin/Unit| { - } - - } - + private final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] val resolveMe: = LAZY_EXPRESSION private [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] get(): public? final? [ResolvedTo(RAW_FIR)] interface A<[ResolvedTo(RAW_FIR)] T> : R|kotlin/Any| { public? final? [ResolvedTo(RAW_FIR)] fun x(): R|kotlin/Unit| diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/functionWithParameter.txt b/analysis/low-level-api-fir/testdata/lazyResolve/functionWithParameter.txt index 11feeec84d5..dc821e20bae 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/functionWithParameter.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/functionWithParameter.txt @@ -53,18 +53,14 @@ FILE: [ResolvedTo(IMPORTS)] functionWithParameter.kt [ResolvedTo(RAW_FIR)] annotations container public? final? [ResolvedTo(RAW_FIR)] interface I : R|kotlin/Any| { } - public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe([ResolvedTo(EXPECT_ACTUAL_MATCHING)] param: R|I|): { - ^resolveMe Unit# - } + public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe([ResolvedTo(EXPECT_ACTUAL_MATCHING)] param: R|I|): { LAZY_BLOCK } ARGUMENTS_OF_ANNOTATIONS: FILE: [ResolvedTo(IMPORTS)] functionWithParameter.kt [ResolvedTo(RAW_FIR)] annotations container public? final? [ResolvedTo(RAW_FIR)] interface I : R|kotlin/Any| { } - public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun resolveMe([ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] param: R|I|): { - ^resolveMe Unit# - } + public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun resolveMe([ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] param: R|I|): { LAZY_BLOCK } CONTRACTS: FILE: [ResolvedTo(IMPORTS)] functionWithParameter.kt diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/functions/functionCallWithGenericResult.txt b/analysis/low-level-api-fir/testdata/lazyResolve/functions/functionCallWithGenericResult.txt index 3697e53941e..d0194dcda38 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/functions/functionCallWithGenericResult.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/functions/functionCallWithGenericResult.txt @@ -93,9 +93,7 @@ FILE: [ResolvedTo(IMPORTS)] functionCallWithGenericResult.kt } public? final? [ResolvedTo(RAW_FIR)] fun bar(): Foo? { LAZY_BLOCK } - public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe(): R|kotlin/Unit| { - [ResolvedTo(RAW_FIR)] lval x: = bar#() - } + public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } ARGUMENTS_OF_ANNOTATIONS: FILE: [ResolvedTo(IMPORTS)] functionCallWithGenericResult.kt @@ -107,9 +105,7 @@ FILE: [ResolvedTo(IMPORTS)] functionCallWithGenericResult.kt } public? final? [ResolvedTo(RAW_FIR)] fun bar(): Foo? { LAZY_BLOCK } - public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun resolveMe(): R|kotlin/Unit| { - [ResolvedTo(RAW_FIR)] lval x: = bar#() - } + public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } CONTRACTS: FILE: [ResolvedTo(IMPORTS)] functionCallWithGenericResult.kt diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/functions/functionWithGenericExpectedTypeInside.txt b/analysis/low-level-api-fir/testdata/lazyResolve/functions/functionWithGenericExpectedTypeInside.txt index 9c7f6e99294..df3e4cc6451 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/functions/functionWithGenericExpectedTypeInside.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/functions/functionWithGenericExpectedTypeInside.txt @@ -141,9 +141,7 @@ FILE: [ResolvedTo(IMPORTS)] functionWithGenericExpectedTypeInside.kt } public? final? [ResolvedTo(RAW_FIR)] fun bar(): { LAZY_BLOCK } - public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe(): R|kotlin/Unit| { - [ResolvedTo(RAW_FIR)] lval x: Foo = bar#() - } + public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } ARGUMENTS_OF_ANNOTATIONS: FILE: [ResolvedTo(IMPORTS)] functionWithGenericExpectedTypeInside.kt @@ -161,9 +159,7 @@ FILE: [ResolvedTo(IMPORTS)] functionWithGenericExpectedTypeInside.kt } public? final? [ResolvedTo(RAW_FIR)] fun bar(): { LAZY_BLOCK } - public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun resolveMe(): R|kotlin/Unit| { - [ResolvedTo(RAW_FIR)] lval x: Foo = bar#() - } + public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } CONTRACTS: FILE: [ResolvedTo(IMPORTS)] functionWithGenericExpectedTypeInside.kt @@ -228,19 +224,19 @@ FILE: [ResolvedTo(IMPORTS)] functionWithGenericExpectedTypeInside.kt BODY_RESOLVE: FILE: [ResolvedTo(IMPORTS)] functionWithGenericExpectedTypeInside.kt [ResolvedTo(RAW_FIR)] annotations container - public open [ResolvedTo(TYPES)] class Foo<[ResolvedTo(TYPES)] T : R|kotlin/CharSequence|> : R|kotlin/Any| { - public [ResolvedTo(TYPES)] [ContainingClassKey=Foo] constructor<[ResolvedTo(TYPES)] T : R|kotlin/CharSequence|>(): R|Foo| { + public open [ResolvedTo(STATUS)] class Foo<[ResolvedTo(STATUS)] T : R|kotlin/CharSequence|> : R|kotlin/Any| { + public [ResolvedTo(STATUS)] [ContainingClassKey=Foo] constructor<[ResolvedTo(STATUS)] T : R|kotlin/CharSequence|>(): R|Foo| { LAZY_super } } - public final [ResolvedTo(TYPES)] class Bar : R|Foo| { + public final [ResolvedTo(STATUS)] class Bar : R|Foo| { public [ResolvedTo(STATUS)] [ContainingClassKey=Bar] constructor(): R|Bar| { LAZY_super<> } } - public final [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] fun bar(): R|Bar| { + public final [ResolvedTo(CONTRACTS)] fun bar(): R|Bar| { ^bar R|/Bar.Bar|() } public final [ResolvedTo(BODY_RESOLVE)] fun resolveMe(): R|kotlin/Unit| { diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/functions/functionWithTypeParameters.txt b/analysis/low-level-api-fir/testdata/lazyResolve/functions/functionWithTypeParameters.txt index 3a2fdb5f9d9..f4397398e71 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/functions/functionWithTypeParameters.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/functions/functionWithTypeParameters.txt @@ -37,14 +37,12 @@ FILE: [ResolvedTo(IMPORTS)] functionWithTypeParameters.kt EXPECT_ACTUAL_MATCHING: FILE: [ResolvedTo(IMPORTS)] functionWithTypeParameters.kt [ResolvedTo(RAW_FIR)] annotations container - public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun <[ResolvedTo(EXPECT_ACTUAL_MATCHING)] T : R|kotlin/Int|, [ResolvedTo(EXPECT_ACTUAL_MATCHING)] K> resolveMe(): R|kotlin/Unit| { - } + public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun <[ResolvedTo(EXPECT_ACTUAL_MATCHING)] T : R|kotlin/Int|, [ResolvedTo(EXPECT_ACTUAL_MATCHING)] K> resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } ARGUMENTS_OF_ANNOTATIONS: FILE: [ResolvedTo(IMPORTS)] functionWithTypeParameters.kt [ResolvedTo(RAW_FIR)] annotations container - public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun <[ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] T : R|kotlin/Int|, [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] K> resolveMe(): R|kotlin/Unit| { - } + public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun <[ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] T : R|kotlin/Int|, [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] K> resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } CONTRACTS: FILE: [ResolvedTo(IMPORTS)] functionWithTypeParameters.kt diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/lambdaAsSAMInterface.txt b/analysis/low-level-api-fir/testdata/lazyResolve/lambdaAsSAMInterface.txt index 22322f92b98..cc8d0c9b07d 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/lambdaAsSAMInterface.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/lambdaAsSAMInterface.txt @@ -125,12 +125,7 @@ FILE: [ResolvedTo(IMPORTS)] lambdaAsSAMInterface.kt } public? final? [ResolvedTo(RAW_FIR)] fun testMe([ResolvedTo(RAW_FIR)] f: Foo): R|kotlin/Unit| { LAZY_BLOCK } - public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe(): R|kotlin/Unit| { - testMe#( = [ResolvedTo(RAW_FIR)] testMe@fun .([ResolvedTo(RAW_FIR)] b: ): { - b# - } - ) - } + public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } ARGUMENTS_OF_ANNOTATIONS: FILE: [ResolvedTo(IMPORTS)] lambdaAsSAMInterface.kt @@ -146,12 +141,7 @@ FILE: [ResolvedTo(IMPORTS)] lambdaAsSAMInterface.kt } public? final? [ResolvedTo(RAW_FIR)] fun testMe([ResolvedTo(RAW_FIR)] f: Foo): R|kotlin/Unit| { LAZY_BLOCK } - public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun resolveMe(): R|kotlin/Unit| { - testMe#( = [ResolvedTo(RAW_FIR)] testMe@fun .([ResolvedTo(RAW_FIR)] b: ): { - b# - } - ) - } + public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } CONTRACTS: FILE: [ResolvedTo(IMPORTS)] lambdaAsSAMInterface.kt @@ -225,7 +215,7 @@ FILE: [ResolvedTo(IMPORTS)] lambdaAsSAMInterface.kt } } - public abstract fun [ResolvedTo(SUPER_TYPES)] interface Foo : R|kotlin/Any| { + public abstract fun [ResolvedTo(STATUS)] interface Foo : R|kotlin/Any| { public abstract [ResolvedTo(STATUS)] fun foo([ResolvedTo(STATUS)] a: R|foo/Arg|): R|foo/Arg| } diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/parameterOfNonLocalSetter.txt b/analysis/low-level-api-fir/testdata/lazyResolve/parameterOfNonLocalSetter.txt index 7626c5debf3..b4ec131b6a9 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/parameterOfNonLocalSetter.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/parameterOfNonLocalSetter.txt @@ -58,7 +58,7 @@ FILE: [ResolvedTo(IMPORTS)] parameterOfNonLocalSetter.kt SUPER_TYPES: FILE: [ResolvedTo(IMPORTS)] parameterOfNonLocalSetter.kt [ResolvedTo(RAW_FIR)] annotations container - public? final? [ResolvedTo(RAW_FIR)] class X : R|kotlin/Any| { + public? final? [ResolvedTo(SUPER_TYPES)] class X : R|kotlin/Any| { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=X] constructor(): R|X| { LAZY_super } @@ -72,8 +72,8 @@ FILE: [ResolvedTo(IMPORTS)] parameterOfNonLocalSetter.kt TYPES: FILE: [ResolvedTo(IMPORTS)] parameterOfNonLocalSetter.kt [ResolvedTo(RAW_FIR)] annotations container - public? final? [ResolvedTo(SUPER_TYPES)] class X : R|kotlin/Any| { - public? [ResolvedTo(SUPER_TYPES)] [ContainingClassKey=X] constructor(): R|X| { + public? final? [ResolvedTo(TYPES)] class X : R|kotlin/Any| { + public? [ResolvedTo(TYPES)] [ContainingClassKey=X] constructor(): R|X| { LAZY_super } @@ -86,8 +86,8 @@ FILE: [ResolvedTo(IMPORTS)] parameterOfNonLocalSetter.kt STATUS: FILE: [ResolvedTo(IMPORTS)] parameterOfNonLocalSetter.kt [ResolvedTo(RAW_FIR)] annotations container - public final [ResolvedTo(SUPER_TYPES)] class X : R|kotlin/Any| { - public [ResolvedTo(TYPES)] [ContainingClassKey=X] constructor(): R|X| { + public final [ResolvedTo(STATUS)] class X : R|kotlin/Any| { + public [ResolvedTo(STATUS)] [ContainingClassKey=X] constructor(): R|X| { LAZY_super } @@ -100,16 +100,14 @@ FILE: [ResolvedTo(IMPORTS)] parameterOfNonLocalSetter.kt EXPECT_ACTUAL_MATCHING: FILE: [ResolvedTo(IMPORTS)] parameterOfNonLocalSetter.kt [ResolvedTo(RAW_FIR)] annotations container - public final [ResolvedTo(SUPER_TYPES)] class X : R|kotlin/Any| { - public [ResolvedTo(TYPES)] [ContainingClassKey=X] constructor(): R|X| { + public final [ResolvedTo(STATUS)] class X : R|kotlin/Any| { + public [ResolvedTo(STATUS)] [ContainingClassKey=X] constructor(): R|X| { LAZY_super } - public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] var x: R|kotlin/Int| = IntegerLiteral(2) + public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] var x: R|kotlin/Int| = LAZY_EXPRESSION public [ResolvedTo(EXPECT_ACTUAL_MATCHING)] [ContainingClassKey=X] get(): R|kotlin/Int| - public [ResolvedTo(EXPECT_ACTUAL_MATCHING)] [ContainingClassKey=X] set([ResolvedTo(EXPECT_ACTUAL_MATCHING)] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { - ^ Unit# - } + public [ResolvedTo(EXPECT_ACTUAL_MATCHING)] [ContainingClassKey=X] set([ResolvedTo(EXPECT_ACTUAL_MATCHING)] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { LAZY_BLOCK } } @@ -121,11 +119,9 @@ FILE: [ResolvedTo(IMPORTS)] parameterOfNonLocalSetter.kt LAZY_super } - public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] var x: R|kotlin/Int| = IntegerLiteral(2) + public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] var x: R|kotlin/Int| = LAZY_EXPRESSION public [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] [ContainingClassKey=X] get(): R|kotlin/Int| - public [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] [ContainingClassKey=X] set([ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { - ^ Unit# - } + public [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] [ContainingClassKey=X] set([ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { LAZY_BLOCK } } diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/properties/propertyWithTypeParameters.txt b/analysis/low-level-api-fir/testdata/lazyResolve/properties/propertyWithTypeParameters.txt index 5f3259bace6..322ad70c4c7 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/properties/propertyWithTypeParameters.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/properties/propertyWithTypeParameters.txt @@ -45,17 +45,13 @@ EXPECT_ACTUAL_MATCHING: FILE: [ResolvedTo(IMPORTS)] propertyWithTypeParameters.kt [ResolvedTo(RAW_FIR)] annotations container public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] val <[ResolvedTo(EXPECT_ACTUAL_MATCHING)] T : R|kotlin/Int|, [ResolvedTo(EXPECT_ACTUAL_MATCHING)] K> R|T|.resolveMe: R|K| - public [ResolvedTo(EXPECT_ACTUAL_MATCHING)] get(): R|K| { - ^ TODO#() - } + public [ResolvedTo(EXPECT_ACTUAL_MATCHING)] get(): R|K| { LAZY_BLOCK } ARGUMENTS_OF_ANNOTATIONS: FILE: [ResolvedTo(IMPORTS)] propertyWithTypeParameters.kt [ResolvedTo(RAW_FIR)] annotations container public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] val <[ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] T : R|kotlin/Int|, [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] K> R|T|.resolveMe: R|K| - public [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] get(): R|K| { - ^ TODO#() - } + public [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] get(): R|K| { LAZY_BLOCK } CONTRACTS: FILE: [ResolvedTo(IMPORTS)] propertyWithTypeParameters.kt diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/propertyWithGetter.txt b/analysis/low-level-api-fir/testdata/lazyResolve/propertyWithGetter.txt index 8724881be7b..dc0c43f5090 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/propertyWithGetter.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/propertyWithGetter.txt @@ -58,9 +58,7 @@ FILE: [ResolvedTo(IMPORTS)] propertyWithGetter.kt EXPECT_ACTUAL_MATCHING: FILE: [ResolvedTo(IMPORTS)] propertyWithGetter.kt [ResolvedTo(RAW_FIR)] annotations container - public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe(): R|kotlin/Unit| { - receive#(withGetter#) - } + public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } public? final? [ResolvedTo(RAW_FIR)] fun receive([ResolvedTo(RAW_FIR)] value: Int): R|kotlin/Unit| { LAZY_BLOCK } public? final? [ResolvedTo(RAW_FIR)] val withGetter: Int public? [ResolvedTo(RAW_FIR)] get(): Int { LAZY_BLOCK } @@ -68,9 +66,7 @@ FILE: [ResolvedTo(IMPORTS)] propertyWithGetter.kt ARGUMENTS_OF_ANNOTATIONS: FILE: [ResolvedTo(IMPORTS)] propertyWithGetter.kt [ResolvedTo(RAW_FIR)] annotations container - public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun resolveMe(): R|kotlin/Unit| { - receive#(withGetter#) - } + public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } public? final? [ResolvedTo(RAW_FIR)] fun receive([ResolvedTo(RAW_FIR)] value: Int): R|kotlin/Unit| { LAZY_BLOCK } public? final? [ResolvedTo(RAW_FIR)] val withGetter: Int public? [ResolvedTo(RAW_FIR)] get(): Int { LAZY_BLOCK } diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/propertyWithGetterAndSetter.txt b/analysis/low-level-api-fir/testdata/lazyResolve/propertyWithGetterAndSetter.txt index 170a17e9627..ca707fb5a74 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/propertyWithGetterAndSetter.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/propertyWithGetterAndSetter.txt @@ -65,10 +65,7 @@ FILE: [ResolvedTo(IMPORTS)] propertyWithGetterAndSetter.kt EXPECT_ACTUAL_MATCHING: FILE: [ResolvedTo(IMPORTS)] propertyWithGetterAndSetter.kt [ResolvedTo(RAW_FIR)] annotations container - public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe(): R|kotlin/Unit| { - receive#(withGetterAndSetter#) - withGetterAndSetter# = IntegerLiteral(123) - } + public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } public? final? [ResolvedTo(RAW_FIR)] fun receive([ResolvedTo(RAW_FIR)] value: Int): R|kotlin/Unit| { LAZY_BLOCK } public? final? [ResolvedTo(RAW_FIR)] var withGetterAndSetter: Int = LAZY_EXPRESSION public? [ResolvedTo(RAW_FIR)] get(): Int { LAZY_BLOCK } @@ -77,10 +74,7 @@ FILE: [ResolvedTo(IMPORTS)] propertyWithGetterAndSetter.kt ARGUMENTS_OF_ANNOTATIONS: FILE: [ResolvedTo(IMPORTS)] propertyWithGetterAndSetter.kt [ResolvedTo(RAW_FIR)] annotations container - public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun resolveMe(): R|kotlin/Unit| { - receive#(withGetterAndSetter#) - withGetterAndSetter# = IntegerLiteral(123) - } + public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } public? final? [ResolvedTo(RAW_FIR)] fun receive([ResolvedTo(RAW_FIR)] value: Int): R|kotlin/Unit| { LAZY_BLOCK } public? final? [ResolvedTo(RAW_FIR)] var withGetterAndSetter: Int = LAZY_EXPRESSION public? [ResolvedTo(RAW_FIR)] get(): Int { LAZY_BLOCK } diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/propertyWithInitializer.txt b/analysis/low-level-api-fir/testdata/lazyResolve/propertyWithInitializer.txt index c4230517705..2bdae3b8b62 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/propertyWithInitializer.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/propertyWithInitializer.txt @@ -51,18 +51,14 @@ FILE: [ResolvedTo(IMPORTS)] propertyWithInitializer.kt EXPECT_ACTUAL_MATCHING: FILE: [ResolvedTo(IMPORTS)] propertyWithInitializer.kt [ResolvedTo(RAW_FIR)] annotations container - public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe(): R|kotlin/Unit| { - receive#(property#) - } + public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } public? final? [ResolvedTo(RAW_FIR)] val property: Int = LAZY_EXPRESSION public? [ResolvedTo(RAW_FIR)] get(): Int ARGUMENTS_OF_ANNOTATIONS: FILE: [ResolvedTo(IMPORTS)] propertyWithInitializer.kt [ResolvedTo(RAW_FIR)] annotations container - public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun resolveMe(): R|kotlin/Unit| { - receive#(property#) - } + public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } public? final? [ResolvedTo(RAW_FIR)] val property: Int = LAZY_EXPRESSION public? [ResolvedTo(RAW_FIR)] get(): Int diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/secondaryConstructor.txt b/analysis/low-level-api-fir/testdata/lazyResolve/secondaryConstructor.txt index 0a7dbe0070f..462bc4c4136 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/secondaryConstructor.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/secondaryConstructor.txt @@ -72,9 +72,7 @@ FILE: [ResolvedTo(IMPORTS)] secondaryConstructor.kt EXPECT_ACTUAL_MATCHING: FILE: [ResolvedTo(IMPORTS)] secondaryConstructor.kt [ResolvedTo(RAW_FIR)] annotations container - public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe(): R|kotlin/Unit| { - receive#(A#(IntegerLiteral(42))) - } + public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } public? final? [ResolvedTo(RAW_FIR)] fun receive([ResolvedTo(RAW_FIR)] value: A): R|kotlin/Unit| { LAZY_BLOCK } public? final? [ResolvedTo(RAW_FIR)] class A : R|kotlin/Any| { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=A] constructor([ResolvedTo(RAW_FIR)] x: Int): R|A| { LAZY_BLOCK } @@ -84,9 +82,7 @@ FILE: [ResolvedTo(IMPORTS)] secondaryConstructor.kt ARGUMENTS_OF_ANNOTATIONS: FILE: [ResolvedTo(IMPORTS)] secondaryConstructor.kt [ResolvedTo(RAW_FIR)] annotations container - public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun resolveMe(): R|kotlin/Unit| { - receive#(A#(IntegerLiteral(42))) - } + public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } public? final? [ResolvedTo(RAW_FIR)] fun receive([ResolvedTo(RAW_FIR)] value: A): R|kotlin/Unit| { LAZY_BLOCK } public? final? [ResolvedTo(RAW_FIR)] class A : R|kotlin/Any| { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=A] constructor([ResolvedTo(RAW_FIR)] x: Int): R|A| { LAZY_BLOCK } diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/superTypes.txt b/analysis/low-level-api-fir/testdata/lazyResolve/superTypes.txt index 70c61973cf1..2d16d0acadb 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/superTypes.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/superTypes.txt @@ -59,7 +59,7 @@ FILE: [ResolvedTo(IMPORTS)] superTypes.kt } public? open [ResolvedTo(COMPILER_REQUIRED_ANNOTATIONS)] class resolveMe : A { - public? [ResolvedTo(COMPILER_REQUIRED_ANNOTATIONS)] [ContainingClassKey=resolveMe] constructor(): R|resolveMe| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=resolveMe] constructor(): R|resolveMe| { LAZY_super } @@ -81,7 +81,7 @@ FILE: [ResolvedTo(IMPORTS)] superTypes.kt } public? open [ResolvedTo(COMPANION_GENERATION)] class resolveMe : A { - public? [ResolvedTo(COMPANION_GENERATION)] [ContainingClassKey=resolveMe] constructor(): R|resolveMe| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=resolveMe] constructor(): R|resolveMe| { LAZY_super } @@ -90,7 +90,7 @@ FILE: [ResolvedTo(IMPORTS)] superTypes.kt SUPER_TYPES: FILE: [ResolvedTo(IMPORTS)] superTypes.kt [ResolvedTo(RAW_FIR)] annotations container - public? open [ResolvedTo(RAW_FIR)] class A : R|kotlin/Any| { + public? open [ResolvedTo(SUPER_TYPES)] class A : R|kotlin/Any| { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=A] constructor(): R|A| { LAZY_super } @@ -103,7 +103,7 @@ FILE: [ResolvedTo(IMPORTS)] superTypes.kt } public? open [ResolvedTo(SUPER_TYPES)] class resolveMe : R|A| { - public? [ResolvedTo(SUPER_TYPES)] [ContainingClassKey=resolveMe] constructor(): R|resolveMe| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=resolveMe] constructor(): R|resolveMe| { LAZY_super } @@ -113,7 +113,7 @@ TYPES: FILE: [ResolvedTo(IMPORTS)] superTypes.kt [ResolvedTo(RAW_FIR)] annotations container public? open [ResolvedTo(SUPER_TYPES)] class A : R|kotlin/Any| { - public? [ResolvedTo(SUPER_TYPES)] [ContainingClassKey=A] constructor(): R|A| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=A] constructor(): R|A| { LAZY_super } @@ -125,8 +125,8 @@ FILE: [ResolvedTo(IMPORTS)] superTypes.kt } public? open [ResolvedTo(TYPES)] class resolveMe : R|A| { - public? [ResolvedTo(TYPES)] [ContainingClassKey=resolveMe] constructor(): R|resolveMe| { - LAZY_super + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=resolveMe] constructor(): R|resolveMe| { + LAZY_super } } @@ -134,8 +134,8 @@ FILE: [ResolvedTo(IMPORTS)] superTypes.kt STATUS: FILE: [ResolvedTo(IMPORTS)] superTypes.kt [ResolvedTo(RAW_FIR)] annotations container - public open [ResolvedTo(TYPES)] class A : R|kotlin/Any| { - public [ResolvedTo(TYPES)] [ContainingClassKey=A] constructor(): R|A| { + public open [ResolvedTo(STATUS)] class A : R|kotlin/Any| { + public [ResolvedTo(STATUS)] [ContainingClassKey=A] constructor(): R|A| { LAZY_super } @@ -156,8 +156,8 @@ FILE: [ResolvedTo(IMPORTS)] superTypes.kt EXPECT_ACTUAL_MATCHING: FILE: [ResolvedTo(IMPORTS)] superTypes.kt [ResolvedTo(RAW_FIR)] annotations container - public open [ResolvedTo(TYPES)] class A : R|kotlin/Any| { - public [ResolvedTo(TYPES)] [ContainingClassKey=A] constructor(): R|A| { + public open [ResolvedTo(STATUS)] class A : R|kotlin/Any| { + public [ResolvedTo(STATUS)] [ContainingClassKey=A] constructor(): R|A| { LAZY_super } @@ -169,8 +169,8 @@ FILE: [ResolvedTo(IMPORTS)] superTypes.kt } public open [ResolvedTo(EXPECT_ACTUAL_MATCHING)] class resolveMe : R|A| { - public [ResolvedTo(EXPECT_ACTUAL_MATCHING)] [ContainingClassKey=resolveMe] constructor(): R|resolveMe| { - super() + public [ResolvedTo(STATUS)] [ContainingClassKey=resolveMe] constructor(): R|resolveMe| { + LAZY_super } } @@ -178,8 +178,8 @@ FILE: [ResolvedTo(IMPORTS)] superTypes.kt ARGUMENTS_OF_ANNOTATIONS: FILE: [ResolvedTo(IMPORTS)] superTypes.kt [ResolvedTo(RAW_FIR)] annotations container - public open [ResolvedTo(TYPES)] class A : R|kotlin/Any| { - public [ResolvedTo(TYPES)] [ContainingClassKey=A] constructor(): R|A| { + public open [ResolvedTo(STATUS)] class A : R|kotlin/Any| { + public [ResolvedTo(STATUS)] [ContainingClassKey=A] constructor(): R|A| { LAZY_super } @@ -191,8 +191,8 @@ FILE: [ResolvedTo(IMPORTS)] superTypes.kt } public open [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] class resolveMe : R|A| { - public [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] [ContainingClassKey=resolveMe] constructor(): R|resolveMe| { - super() + public [ResolvedTo(STATUS)] [ContainingClassKey=resolveMe] constructor(): R|resolveMe| { + LAZY_super } } @@ -200,8 +200,8 @@ FILE: [ResolvedTo(IMPORTS)] superTypes.kt CONTRACTS: FILE: [ResolvedTo(IMPORTS)] superTypes.kt [ResolvedTo(RAW_FIR)] annotations container - public open [ResolvedTo(TYPES)] class A : R|kotlin/Any| { - public [ResolvedTo(TYPES)] [ContainingClassKey=A] constructor(): R|A| { + public open [ResolvedTo(STATUS)] class A : R|kotlin/Any| { + public [ResolvedTo(STATUS)] [ContainingClassKey=A] constructor(): R|A| { LAZY_super } @@ -213,8 +213,8 @@ FILE: [ResolvedTo(IMPORTS)] superTypes.kt } public open [ResolvedTo(CONTRACTS)] class resolveMe : R|A| { - public [ResolvedTo(CONTRACTS)] [ContainingClassKey=resolveMe] constructor(): R|resolveMe| { - super() + public [ResolvedTo(STATUS)] [ContainingClassKey=resolveMe] constructor(): R|resolveMe| { + LAZY_super } } @@ -222,8 +222,8 @@ FILE: [ResolvedTo(IMPORTS)] superTypes.kt IMPLICIT_TYPES_BODY_RESOLVE: FILE: [ResolvedTo(IMPORTS)] superTypes.kt [ResolvedTo(RAW_FIR)] annotations container - public open [ResolvedTo(TYPES)] class A : R|kotlin/Any| { - public [ResolvedTo(TYPES)] [ContainingClassKey=A] constructor(): R|A| { + public open [ResolvedTo(STATUS)] class A : R|kotlin/Any| { + public [ResolvedTo(STATUS)] [ContainingClassKey=A] constructor(): R|A| { LAZY_super } @@ -235,8 +235,8 @@ FILE: [ResolvedTo(IMPORTS)] superTypes.kt } public open [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] class resolveMe : R|A| { - public [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] [ContainingClassKey=resolveMe] constructor(): R|resolveMe| { - super() + public [ResolvedTo(STATUS)] [ContainingClassKey=resolveMe] constructor(): R|resolveMe| { + LAZY_super } } @@ -244,8 +244,8 @@ FILE: [ResolvedTo(IMPORTS)] superTypes.kt ANNOTATIONS_ARGUMENTS_MAPPING: FILE: [ResolvedTo(IMPORTS)] superTypes.kt [ResolvedTo(RAW_FIR)] annotations container - public open [ResolvedTo(TYPES)] class A : R|kotlin/Any| { - public [ResolvedTo(TYPES)] [ContainingClassKey=A] constructor(): R|A| { + public open [ResolvedTo(STATUS)] class A : R|kotlin/Any| { + public [ResolvedTo(STATUS)] [ContainingClassKey=A] constructor(): R|A| { LAZY_super } @@ -257,8 +257,8 @@ FILE: [ResolvedTo(IMPORTS)] superTypes.kt } public open [ResolvedTo(ANNOTATIONS_ARGUMENTS_MAPPING)] class resolveMe : R|A| { - public [ResolvedTo(ANNOTATIONS_ARGUMENTS_MAPPING)] [ContainingClassKey=resolveMe] constructor(): R|resolveMe| { - super() + public [ResolvedTo(STATUS)] [ContainingClassKey=resolveMe] constructor(): R|resolveMe| { + LAZY_super } } diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/superTypesLoop.txt b/analysis/low-level-api-fir/testdata/lazyResolve/superTypesLoop.txt index 6c8386041c3..ae00de1ef71 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/superTypesLoop.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/superTypesLoop.txt @@ -59,7 +59,7 @@ COMPILER_REQUIRED_ANNOTATIONS: FILE: [ResolvedTo(IMPORTS)] superTypesLoop.kt [ResolvedTo(RAW_FIR)] annotations container public? open [ResolvedTo(COMPILER_REQUIRED_ANNOTATIONS)] class resolveMe : C { - public? [ResolvedTo(COMPILER_REQUIRED_ANNOTATIONS)] [ContainingClassKey=resolveMe] constructor(): R|resolveMe| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=resolveMe] constructor(): R|resolveMe| { LAZY_super } @@ -87,7 +87,7 @@ COMPANION_GENERATION: FILE: [ResolvedTo(IMPORTS)] superTypesLoop.kt [ResolvedTo(RAW_FIR)] annotations container public? open [ResolvedTo(COMPANION_GENERATION)] class resolveMe : C { - public? [ResolvedTo(COMPANION_GENERATION)] [ContainingClassKey=resolveMe] constructor(): R|resolveMe| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=resolveMe] constructor(): R|resolveMe| { LAZY_super } @@ -115,24 +115,24 @@ SUPER_TYPES: FILE: [ResolvedTo(IMPORTS)] superTypesLoop.kt [ResolvedTo(RAW_FIR)] annotations container public? open [ResolvedTo(SUPER_TYPES)] class resolveMe : R|C| { - public? [ResolvedTo(SUPER_TYPES)] [ContainingClassKey=resolveMe] constructor(): R|resolveMe| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=resolveMe] constructor(): R|resolveMe| { LAZY_super } } - public? open [ResolvedTo(RAW_FIR)] class A : /B> { + public? open [ResolvedTo(SUPER_TYPES)] class A : /B> { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=A] constructor(): R|A| { LAZY_super } } - public? open [ResolvedTo(RAW_FIR)] class B : /C> { + public? open [ResolvedTo(SUPER_TYPES)] class B : /C> { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=B] constructor(): R|B| { LAZY_super } } - public? open [ResolvedTo(RAW_FIR)] class C : /A> { + public? open [ResolvedTo(SUPER_TYPES)] class C : /A> { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=C] constructor(): R|C| { LAZY_super } @@ -143,25 +143,25 @@ TYPES: FILE: [ResolvedTo(IMPORTS)] superTypesLoop.kt [ResolvedTo(RAW_FIR)] annotations container public? open [ResolvedTo(TYPES)] class resolveMe : R|C| { - public? [ResolvedTo(TYPES)] [ContainingClassKey=resolveMe] constructor(): R|resolveMe| { - LAZY_super + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=resolveMe] constructor(): R|resolveMe| { + LAZY_super } } - public? open [ResolvedTo(RAW_FIR)] class A : /B> { + public? open [ResolvedTo(SUPER_TYPES)] class A : /B> { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=A] constructor(): R|A| { LAZY_super } } - public? open [ResolvedTo(RAW_FIR)] class B : /C> { + public? open [ResolvedTo(SUPER_TYPES)] class B : /C> { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=B] constructor(): R|B| { LAZY_super } } public? open [ResolvedTo(SUPER_TYPES)] class C : /A> { - public? [ResolvedTo(SUPER_TYPES)] [ContainingClassKey=C] constructor(): R|C| { + public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=C] constructor(): R|C| { LAZY_super } @@ -176,20 +176,20 @@ FILE: [ResolvedTo(IMPORTS)] superTypesLoop.kt } } - public? open [ResolvedTo(RAW_FIR)] class A : /B> { + public? open [ResolvedTo(SUPER_TYPES)] class A : /B> { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=A] constructor(): R|A| { LAZY_super } } - public? open [ResolvedTo(RAW_FIR)] class B : /C> { + public? open [ResolvedTo(SUPER_TYPES)] class B : /C> { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=B] constructor(): R|B| { LAZY_super } } - public open [ResolvedTo(TYPES)] class C : /A> { - public [ResolvedTo(TYPES)] [ContainingClassKey=C] constructor(): R|C| { + public open [ResolvedTo(STATUS)] class C : /A> { + public [ResolvedTo(STATUS)] [ContainingClassKey=C] constructor(): R|C| { LAZY_super } @@ -199,25 +199,25 @@ EXPECT_ACTUAL_MATCHING: FILE: [ResolvedTo(IMPORTS)] superTypesLoop.kt [ResolvedTo(RAW_FIR)] annotations container public open [ResolvedTo(EXPECT_ACTUAL_MATCHING)] class resolveMe : R|C| { - public [ResolvedTo(EXPECT_ACTUAL_MATCHING)] [ContainingClassKey=resolveMe] constructor(): R|resolveMe| { - super() + public [ResolvedTo(STATUS)] [ContainingClassKey=resolveMe] constructor(): R|resolveMe| { + LAZY_super } } - public? open [ResolvedTo(RAW_FIR)] class A : /B> { + public? open [ResolvedTo(SUPER_TYPES)] class A : /B> { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=A] constructor(): R|A| { LAZY_super } } - public? open [ResolvedTo(RAW_FIR)] class B : /C> { + public? open [ResolvedTo(SUPER_TYPES)] class B : /C> { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=B] constructor(): R|B| { LAZY_super } } - public open [ResolvedTo(TYPES)] class C : /A> { - public [ResolvedTo(TYPES)] [ContainingClassKey=C] constructor(): R|C| { + public open [ResolvedTo(STATUS)] class C : /A> { + public [ResolvedTo(STATUS)] [ContainingClassKey=C] constructor(): R|C| { LAZY_super } @@ -227,25 +227,25 @@ ARGUMENTS_OF_ANNOTATIONS: FILE: [ResolvedTo(IMPORTS)] superTypesLoop.kt [ResolvedTo(RAW_FIR)] annotations container public open [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] class resolveMe : R|C| { - public [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] [ContainingClassKey=resolveMe] constructor(): R|resolveMe| { - super() + public [ResolvedTo(STATUS)] [ContainingClassKey=resolveMe] constructor(): R|resolveMe| { + LAZY_super } } - public? open [ResolvedTo(RAW_FIR)] class A : /B> { + public? open [ResolvedTo(SUPER_TYPES)] class A : /B> { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=A] constructor(): R|A| { LAZY_super } } - public? open [ResolvedTo(RAW_FIR)] class B : /C> { + public? open [ResolvedTo(SUPER_TYPES)] class B : /C> { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=B] constructor(): R|B| { LAZY_super } } - public open [ResolvedTo(TYPES)] class C : /A> { - public [ResolvedTo(TYPES)] [ContainingClassKey=C] constructor(): R|C| { + public open [ResolvedTo(STATUS)] class C : /A> { + public [ResolvedTo(STATUS)] [ContainingClassKey=C] constructor(): R|C| { LAZY_super } @@ -255,25 +255,25 @@ CONTRACTS: FILE: [ResolvedTo(IMPORTS)] superTypesLoop.kt [ResolvedTo(RAW_FIR)] annotations container public open [ResolvedTo(CONTRACTS)] class resolveMe : R|C| { - public [ResolvedTo(CONTRACTS)] [ContainingClassKey=resolveMe] constructor(): R|resolveMe| { - super() + public [ResolvedTo(STATUS)] [ContainingClassKey=resolveMe] constructor(): R|resolveMe| { + LAZY_super } } - public? open [ResolvedTo(RAW_FIR)] class A : /B> { + public? open [ResolvedTo(SUPER_TYPES)] class A : /B> { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=A] constructor(): R|A| { LAZY_super } } - public? open [ResolvedTo(RAW_FIR)] class B : /C> { + public? open [ResolvedTo(SUPER_TYPES)] class B : /C> { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=B] constructor(): R|B| { LAZY_super } } - public open [ResolvedTo(TYPES)] class C : /A> { - public [ResolvedTo(TYPES)] [ContainingClassKey=C] constructor(): R|C| { + public open [ResolvedTo(STATUS)] class C : /A> { + public [ResolvedTo(STATUS)] [ContainingClassKey=C] constructor(): R|C| { LAZY_super } @@ -283,25 +283,25 @@ IMPLICIT_TYPES_BODY_RESOLVE: FILE: [ResolvedTo(IMPORTS)] superTypesLoop.kt [ResolvedTo(RAW_FIR)] annotations container public open [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] class resolveMe : R|C| { - public [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] [ContainingClassKey=resolveMe] constructor(): R|resolveMe| { - super() + public [ResolvedTo(STATUS)] [ContainingClassKey=resolveMe] constructor(): R|resolveMe| { + LAZY_super } } - public? open [ResolvedTo(RAW_FIR)] class A : /B> { + public? open [ResolvedTo(SUPER_TYPES)] class A : /B> { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=A] constructor(): R|A| { LAZY_super } } - public? open [ResolvedTo(RAW_FIR)] class B : /C> { + public? open [ResolvedTo(SUPER_TYPES)] class B : /C> { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=B] constructor(): R|B| { LAZY_super } } - public open [ResolvedTo(TYPES)] class C : /A> { - public [ResolvedTo(TYPES)] [ContainingClassKey=C] constructor(): R|C| { + public open [ResolvedTo(STATUS)] class C : /A> { + public [ResolvedTo(STATUS)] [ContainingClassKey=C] constructor(): R|C| { LAZY_super } @@ -311,25 +311,25 @@ ANNOTATIONS_ARGUMENTS_MAPPING: FILE: [ResolvedTo(IMPORTS)] superTypesLoop.kt [ResolvedTo(RAW_FIR)] annotations container public open [ResolvedTo(ANNOTATIONS_ARGUMENTS_MAPPING)] class resolveMe : R|C| { - public [ResolvedTo(ANNOTATIONS_ARGUMENTS_MAPPING)] [ContainingClassKey=resolveMe] constructor(): R|resolveMe| { - super() + public [ResolvedTo(STATUS)] [ContainingClassKey=resolveMe] constructor(): R|resolveMe| { + LAZY_super } } - public? open [ResolvedTo(RAW_FIR)] class A : /B> { + public? open [ResolvedTo(SUPER_TYPES)] class A : /B> { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=A] constructor(): R|A| { LAZY_super } } - public? open [ResolvedTo(RAW_FIR)] class B : /C> { + public? open [ResolvedTo(SUPER_TYPES)] class B : /C> { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=B] constructor(): R|B| { LAZY_super } } - public open [ResolvedTo(TYPES)] class C : /A> { - public [ResolvedTo(TYPES)] [ContainingClassKey=C] constructor(): R|C| { + public open [ResolvedTo(STATUS)] class C : /A> { + public [ResolvedTo(STATUS)] [ContainingClassKey=C] constructor(): R|C| { LAZY_super } @@ -344,13 +344,13 @@ FILE: [ResolvedTo(IMPORTS)] superTypesLoop.kt } } - public? open [ResolvedTo(RAW_FIR)] class A : /B> { + public? open [ResolvedTo(SUPER_TYPES)] class A : /B> { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=A] constructor(): R|A| { LAZY_super } } - public? open [ResolvedTo(RAW_FIR)] class B : /C> { + public? open [ResolvedTo(SUPER_TYPES)] class B : /C> { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=B] constructor(): R|B| { LAZY_super } diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/topLevelFunctions.txt b/analysis/low-level-api-fir/testdata/lazyResolve/topLevelFunctions.txt index c961dca32d4..2b38dd86842 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/topLevelFunctions.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/topLevelFunctions.txt @@ -51,18 +51,14 @@ FILE: [ResolvedTo(IMPORTS)] topLevelFunctions.kt EXPECT_ACTUAL_MATCHING: FILE: [ResolvedTo(IMPORTS)] topLevelFunctions.kt [ResolvedTo(RAW_FIR)] annotations container - public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe(): R|kotlin/Unit| { - receive#(functionWithLazyBody#()) - } + public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } public? final? [ResolvedTo(RAW_FIR)] fun receive([ResolvedTo(RAW_FIR)] value: String): R|kotlin/Unit| { LAZY_BLOCK } public? final? [ResolvedTo(RAW_FIR)] fun functionWithLazyBody(): String { LAZY_BLOCK } ARGUMENTS_OF_ANNOTATIONS: FILE: [ResolvedTo(IMPORTS)] topLevelFunctions.kt [ResolvedTo(RAW_FIR)] annotations container - public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun resolveMe(): R|kotlin/Unit| { - receive#(functionWithLazyBody#()) - } + public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } public? final? [ResolvedTo(RAW_FIR)] fun receive([ResolvedTo(RAW_FIR)] value: String): R|kotlin/Unit| { LAZY_BLOCK } public? final? [ResolvedTo(RAW_FIR)] fun functionWithLazyBody(): String { LAZY_BLOCK } diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/topLevelFunctionsWithExpressionBodyAndExplicitType.txt b/analysis/low-level-api-fir/testdata/lazyResolve/topLevelFunctionsWithExpressionBodyAndExplicitType.txt index 939f3a5e67a..d4e5e635ae2 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/topLevelFunctionsWithExpressionBodyAndExplicitType.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/topLevelFunctionsWithExpressionBodyAndExplicitType.txt @@ -51,18 +51,14 @@ FILE: [ResolvedTo(IMPORTS)] topLevelFunctionsWithExpressionBodyAndExplicitType.k EXPECT_ACTUAL_MATCHING: FILE: [ResolvedTo(IMPORTS)] topLevelFunctionsWithExpressionBodyAndExplicitType.kt [ResolvedTo(RAW_FIR)] annotations container - public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe(): R|kotlin/Unit| { - receive#(functionWithLazyBody#()) - } + public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } public? final? [ResolvedTo(RAW_FIR)] fun receive([ResolvedTo(RAW_FIR)] value: String): R|kotlin/Unit| { LAZY_BLOCK } public? final? [ResolvedTo(RAW_FIR)] fun functionWithLazyBody(): String { LAZY_BLOCK } ARGUMENTS_OF_ANNOTATIONS: FILE: [ResolvedTo(IMPORTS)] topLevelFunctionsWithExpressionBodyAndExplicitType.kt [ResolvedTo(RAW_FIR)] annotations container - public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun resolveMe(): R|kotlin/Unit| { - receive#(functionWithLazyBody#()) - } + public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } public? final? [ResolvedTo(RAW_FIR)] fun receive([ResolvedTo(RAW_FIR)] value: String): R|kotlin/Unit| { LAZY_BLOCK } public? final? [ResolvedTo(RAW_FIR)] fun functionWithLazyBody(): String { LAZY_BLOCK } diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/topLevelFunctionsWithImplicitType.txt b/analysis/low-level-api-fir/testdata/lazyResolve/topLevelFunctionsWithImplicitType.txt index 5a8a28b39b7..2da9fb0b9ae 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/topLevelFunctionsWithImplicitType.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/topLevelFunctionsWithImplicitType.txt @@ -51,18 +51,14 @@ FILE: [ResolvedTo(IMPORTS)] topLevelFunctionsWithImplicitType.kt EXPECT_ACTUAL_MATCHING: FILE: [ResolvedTo(IMPORTS)] topLevelFunctionsWithImplicitType.kt [ResolvedTo(RAW_FIR)] annotations container - public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe(): R|kotlin/Unit| { - receive#(functionWithLazyBody#()) - } + public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } public? final? [ResolvedTo(RAW_FIR)] fun receive([ResolvedTo(RAW_FIR)] value: String): R|kotlin/Unit| { LAZY_BLOCK } public? final? [ResolvedTo(RAW_FIR)] fun functionWithLazyBody(): { LAZY_BLOCK } ARGUMENTS_OF_ANNOTATIONS: FILE: [ResolvedTo(IMPORTS)] topLevelFunctionsWithImplicitType.kt [ResolvedTo(RAW_FIR)] annotations container - public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun resolveMe(): R|kotlin/Unit| { - receive#(functionWithLazyBody#()) - } + public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun resolveMe(): R|kotlin/Unit| { LAZY_BLOCK } public? final? [ResolvedTo(RAW_FIR)] fun receive([ResolvedTo(RAW_FIR)] value: String): R|kotlin/Unit| { LAZY_BLOCK } public? final? [ResolvedTo(RAW_FIR)] fun functionWithLazyBody(): { LAZY_BLOCK } @@ -101,7 +97,7 @@ FILE: [ResolvedTo(IMPORTS)] topLevelFunctionsWithImplicitType.kt } public final [ResolvedTo(CONTRACTS)] fun receive([ResolvedTo(CONTRACTS)] value: R|kotlin/String|): R|kotlin/Unit| { } - public final [ResolvedTo(IMPLICIT_TYPES_BODY_RESOLVE)] fun functionWithLazyBody(): R|kotlin/String| { + public final [ResolvedTo(CONTRACTS)] fun functionWithLazyBody(): R|kotlin/String| { ^functionWithLazyBody String(42) } diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/typeParameterBounds.txt b/analysis/low-level-api-fir/testdata/lazyResolve/typeParameterBounds.txt index 44119f829ac..af3551f8b78 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/typeParameterBounds.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/typeParameterBounds.txt @@ -72,9 +72,7 @@ FILE: [ResolvedTo(IMPORTS)] typeParameterBounds.kt EXPECT_ACTUAL_MATCHING: FILE: [ResolvedTo(IMPORTS)] typeParameterBounds.kt [ResolvedTo(RAW_FIR)] annotations container - public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe([ResolvedTo(EXPECT_ACTUAL_MATCHING)] foo: R|Foo|): R|kotlin/Unit| { - foo#.util#() - } + public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun resolveMe([ResolvedTo(EXPECT_ACTUAL_MATCHING)] foo: R|Foo|): R|kotlin/Unit| { LAZY_BLOCK } public? final? [ResolvedTo(RAW_FIR)] interface Foo : R|kotlin/Any| { } public? final? [ResolvedTo(RAW_FIR)] interface Bar<[ResolvedTo(RAW_FIR)] T : Foo> : R|kotlin/Any| { @@ -84,9 +82,7 @@ FILE: [ResolvedTo(IMPORTS)] typeParameterBounds.kt ARGUMENTS_OF_ANNOTATIONS: FILE: [ResolvedTo(IMPORTS)] typeParameterBounds.kt [ResolvedTo(RAW_FIR)] annotations container - public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun resolveMe([ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] foo: R|Foo|): R|kotlin/Unit| { - foo#.util#() - } + public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun resolveMe([ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] foo: R|Foo|): R|kotlin/Unit| { LAZY_BLOCK } public? final? [ResolvedTo(RAW_FIR)] interface Foo : R|kotlin/Any| { } public? final? [ResolvedTo(RAW_FIR)] interface Bar<[ResolvedTo(RAW_FIR)] T : Foo> : R|kotlin/Any| { diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/typeParameterOfNonLocalFunction.txt b/analysis/low-level-api-fir/testdata/lazyResolve/typeParameterOfNonLocalFunction.txt index 4d692e95b10..a1c279079f5 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/typeParameterOfNonLocalFunction.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/typeParameterOfNonLocalFunction.txt @@ -50,7 +50,7 @@ FILE: [ResolvedTo(IMPORTS)] typeParameterOfNonLocalFunction.kt SUPER_TYPES: FILE: [ResolvedTo(IMPORTS)] typeParameterOfNonLocalFunction.kt [ResolvedTo(RAW_FIR)] annotations container - public? final? [ResolvedTo(RAW_FIR)] class X : R|kotlin/Any| { + public? final? [ResolvedTo(SUPER_TYPES)] class X : R|kotlin/Any| { public? [ResolvedTo(RAW_FIR)] [ContainingClassKey=X] constructor(): R|X| { LAZY_super } @@ -62,8 +62,8 @@ FILE: [ResolvedTo(IMPORTS)] typeParameterOfNonLocalFunction.kt TYPES: FILE: [ResolvedTo(IMPORTS)] typeParameterOfNonLocalFunction.kt [ResolvedTo(RAW_FIR)] annotations container - public? final? [ResolvedTo(SUPER_TYPES)] class X : R|kotlin/Any| { - public? [ResolvedTo(SUPER_TYPES)] [ContainingClassKey=X] constructor(): R|X| { + public? final? [ResolvedTo(TYPES)] class X : R|kotlin/Any| { + public? [ResolvedTo(TYPES)] [ContainingClassKey=X] constructor(): R|X| { LAZY_super } @@ -74,8 +74,8 @@ FILE: [ResolvedTo(IMPORTS)] typeParameterOfNonLocalFunction.kt STATUS: FILE: [ResolvedTo(IMPORTS)] typeParameterOfNonLocalFunction.kt [ResolvedTo(RAW_FIR)] annotations container - public final [ResolvedTo(SUPER_TYPES)] class X : R|kotlin/Any| { - public [ResolvedTo(TYPES)] [ContainingClassKey=X] constructor(): R|X| { + public final [ResolvedTo(STATUS)] class X : R|kotlin/Any| { + public [ResolvedTo(STATUS)] [ContainingClassKey=X] constructor(): R|X| { LAZY_super } @@ -86,13 +86,12 @@ FILE: [ResolvedTo(IMPORTS)] typeParameterOfNonLocalFunction.kt EXPECT_ACTUAL_MATCHING: FILE: [ResolvedTo(IMPORTS)] typeParameterOfNonLocalFunction.kt [ResolvedTo(RAW_FIR)] annotations container - public final [ResolvedTo(SUPER_TYPES)] class X : R|kotlin/Any| { - public [ResolvedTo(TYPES)] [ContainingClassKey=X] constructor(): R|X| { + public final [ResolvedTo(STATUS)] class X : R|kotlin/Any| { + public [ResolvedTo(STATUS)] [ContainingClassKey=X] constructor(): R|X| { LAZY_super } - public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun <[ResolvedTo(EXPECT_ACTUAL_MATCHING)] resolveMe> ddd(): R|kotlin/Unit| { - } + public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun <[ResolvedTo(EXPECT_ACTUAL_MATCHING)] resolveMe> ddd(): R|kotlin/Unit| { LAZY_BLOCK } } @@ -104,8 +103,7 @@ FILE: [ResolvedTo(IMPORTS)] typeParameterOfNonLocalFunction.kt LAZY_super } - public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun <[ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] resolveMe> ddd(): R|kotlin/Unit| { - } + public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun <[ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] resolveMe> ddd(): R|kotlin/Unit| { LAZY_BLOCK } } diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/typeParameterOfTopFunction.txt b/analysis/low-level-api-fir/testdata/lazyResolve/typeParameterOfTopFunction.txt index 412f55f0401..32cfde754a3 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/typeParameterOfTopFunction.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/typeParameterOfTopFunction.txt @@ -37,14 +37,12 @@ FILE: [ResolvedTo(IMPORTS)] typeParameterOfTopFunction.kt EXPECT_ACTUAL_MATCHING: FILE: [ResolvedTo(IMPORTS)] typeParameterOfTopFunction.kt [ResolvedTo(RAW_FIR)] annotations container - public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun <[ResolvedTo(EXPECT_ACTUAL_MATCHING)] resolveMe> ddd(): R|kotlin/Unit| { - } + public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] fun <[ResolvedTo(EXPECT_ACTUAL_MATCHING)] resolveMe> ddd(): R|kotlin/Unit| { LAZY_BLOCK } ARGUMENTS_OF_ANNOTATIONS: FILE: [ResolvedTo(IMPORTS)] typeParameterOfTopFunction.kt [ResolvedTo(RAW_FIR)] annotations container - public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun <[ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] resolveMe> ddd(): R|kotlin/Unit| { - } + public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] fun <[ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] resolveMe> ddd(): R|kotlin/Unit| { LAZY_BLOCK } CONTRACTS: FILE: [ResolvedTo(IMPORTS)] typeParameterOfTopFunction.kt diff --git a/analysis/low-level-api-fir/testdata/lazyResolve/typeParameterOfTopSetter.txt b/analysis/low-level-api-fir/testdata/lazyResolve/typeParameterOfTopSetter.txt index 881737dde70..dec858a928b 100644 --- a/analysis/low-level-api-fir/testdata/lazyResolve/typeParameterOfTopSetter.txt +++ b/analysis/low-level-api-fir/testdata/lazyResolve/typeParameterOfTopSetter.txt @@ -51,20 +51,16 @@ FILE: [ResolvedTo(IMPORTS)] typeParameterOfTopSetter.kt EXPECT_ACTUAL_MATCHING: FILE: [ResolvedTo(IMPORTS)] typeParameterOfTopSetter.kt [ResolvedTo(RAW_FIR)] annotations container - public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] var x: R|kotlin/Int| = IntegerLiteral(2) + public final [ResolvedTo(EXPECT_ACTUAL_MATCHING)] var x: R|kotlin/Int| = LAZY_EXPRESSION public [ResolvedTo(EXPECT_ACTUAL_MATCHING)] get(): R|kotlin/Int| - public [ResolvedTo(EXPECT_ACTUAL_MATCHING)] set([ResolvedTo(EXPECT_ACTUAL_MATCHING)] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { - ^ Unit# - } + public [ResolvedTo(EXPECT_ACTUAL_MATCHING)] set([ResolvedTo(EXPECT_ACTUAL_MATCHING)] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { LAZY_BLOCK } ARGUMENTS_OF_ANNOTATIONS: FILE: [ResolvedTo(IMPORTS)] typeParameterOfTopSetter.kt [ResolvedTo(RAW_FIR)] annotations container - public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] var x: R|kotlin/Int| = IntegerLiteral(2) + public final [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] var x: R|kotlin/Int| = LAZY_EXPRESSION public [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] get(): R|kotlin/Int| - public [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] set([ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { - ^ Unit# - } + public [ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] set([ResolvedTo(ARGUMENTS_OF_ANNOTATIONS)] resolveMe: R|kotlin/Int|): R|kotlin/Unit| { LAZY_BLOCK } CONTRACTS: FILE: [ResolvedTo(IMPORTS)] typeParameterOfTopSetter.kt diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/AbstractGetOrBuildFirTest.kt b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/AbstractGetOrBuildFirTest.kt index 713f591e2d1..103c657ccdc 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/AbstractGetOrBuildFirTest.kt +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/AbstractGetOrBuildFirTest.kt @@ -6,7 +6,6 @@ package org.jetbrains.kotlin.analysis.low.level.api.fir import com.intellij.psi.PsiElement -import com.intellij.psi.util.PsiTreeUtil import org.jetbrains.kotlin.analysis.low.level.api.fir.api.getOrBuildFir import org.jetbrains.kotlin.analysis.low.level.api.fir.test.base.AbstractLowLevelApiSingleFileTest import org.jetbrains.kotlin.analysis.low.level.api.fir.test.configurators.AnalysisApiFirOutOfContentRootTestConfigurator @@ -20,6 +19,7 @@ import org.jetbrains.kotlin.fir.renderer.FirRenderer import org.jetbrains.kotlin.fir.renderer.FirResolvePhaseRenderer import org.jetbrains.kotlin.psi.KtElement import org.jetbrains.kotlin.psi.KtFile +import org.jetbrains.kotlin.psi.psiUtil.collectDescendantsOfType import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder import org.jetbrains.kotlin.test.directives.model.SimpleDirectivesContainer import org.jetbrains.kotlin.test.services.TestModuleStructure @@ -55,9 +55,9 @@ abstract class AbstractGetOrBuildFirTest : AbstractLowLevelApiSingleFileTest() { @Suppress("UNCHECKED_CAST") val expectedClass = Class.forName(expectedType) as Class if (expectedClass.isInstance(selectedElement)) return selectedElement - return listOfNotNull( - PsiTreeUtil.getChildOfType(selectedElement, expectedClass), - ).single { it.textRange == selectedElement.textRange } + return selectedElement.collectDescendantsOfType { + expectedClass.isInstance(it) + }.single { it.textRange == selectedElement.textRange } } private fun render(firElement: FirElement?): String = when (firElement) { diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/OutOfContentRootGetOrBuildFirTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/OutOfContentRootGetOrBuildFirTestGenerated.java index 40e12d048fc..aa94e18b67b 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/OutOfContentRootGetOrBuildFirTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/OutOfContentRootGetOrBuildFirTestGenerated.java @@ -92,6 +92,76 @@ public class OutOfContentRootGetOrBuildFirTestGenerated extends AbstractOutOfCon public void testRetentionValue() throws Exception { runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/retentionValue.kt"); } + + @Test + @TestMetadata("superCallAnnotation.kt") + public void testSuperCallAnnotation() throws Exception { + runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/superCallAnnotation.kt"); + } + + @Test + @TestMetadata("superCallAnnotation2.kt") + public void testSuperCallAnnotation2() throws Exception { + runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/superCallAnnotation2.kt"); + } + + @Nested + @TestMetadata("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite") + @TestDataPath("$PROJECT_ROOT") + public class UseSite { + @Test + public void testAllFilesPresentInUseSite() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @Test + @TestMetadata("delegate.kt") + public void testDelegate() throws Exception { + runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/delegate.kt"); + } + + @Test + @TestMetadata("field.kt") + public void testField() throws Exception { + runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/field.kt"); + } + + @Test + @TestMetadata("file.kt") + public void testFile() throws Exception { + runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/file.kt"); + } + + @Test + @TestMetadata("getter.kt") + public void testGetter() throws Exception { + runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/getter.kt"); + } + + @Test + @TestMetadata("param.kt") + public void testParam() throws Exception { + runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/param.kt"); + } + + @Test + @TestMetadata("property.kt") + public void testProperty() throws Exception { + runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/property.kt"); + } + + @Test + @TestMetadata("setParam.kt") + public void testSetParam() throws Exception { + runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/setParam.kt"); + } + + @Test + @TestMetadata("setter.kt") + public void testSetter() throws Exception { + runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/setter.kt"); + } + } } @Nested @@ -109,6 +179,30 @@ public class OutOfContentRootGetOrBuildFirTestGenerated extends AbstractOutOfCon runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/callArgument.kt"); } + @Test + @TestMetadata("callInsideLambdaInsideSuperCallAndExplicitConstructor.kt") + public void testCallInsideLambdaInsideSuperCallAndExplicitConstructor() throws Exception { + runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/callInsideLambdaInsideSuperCallAndExplicitConstructor.kt"); + } + + @Test + @TestMetadata("callInsideLambdaInsideSuperCallAndImplicitConstructor.kt") + public void testCallInsideLambdaInsideSuperCallAndImplicitConstructor() throws Exception { + runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/callInsideLambdaInsideSuperCallAndImplicitConstructor.kt"); + } + + @Test + @TestMetadata("callInsideLambdaInsideSuperCallFromSecondaryConstructor.kt") + public void testCallInsideLambdaInsideSuperCallFromSecondaryConstructor() throws Exception { + runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/callInsideLambdaInsideSuperCallFromSecondaryConstructor.kt"); + } + + @Test + @TestMetadata("callInsideLambdaInsideSuperCallFromSingleSecondaryConstructor.kt") + public void testCallInsideLambdaInsideSuperCallFromSingleSecondaryConstructor() throws Exception { + runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/callInsideLambdaInsideSuperCallFromSingleSecondaryConstructor.kt"); + } + @Test @TestMetadata("calllTypeArguments.kt") public void testCalllTypeArguments() throws Exception { @@ -228,6 +322,12 @@ public class OutOfContentRootGetOrBuildFirTestGenerated extends AbstractOutOfCon public void testSetOperator() throws Exception { runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/setOperator.kt"); } + + @Test + @TestMetadata("superType.kt") + public void testSuperType() throws Exception { + runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/superType.kt"); + } } @Nested diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/SourceGetOrBuildFirTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/SourceGetOrBuildFirTestGenerated.java index e442c80790d..65deb8c9075 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/SourceGetOrBuildFirTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/SourceGetOrBuildFirTestGenerated.java @@ -92,6 +92,76 @@ public class SourceGetOrBuildFirTestGenerated extends AbstractSourceGetOrBuildFi public void testRetentionValue() throws Exception { runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/retentionValue.kt"); } + + @Test + @TestMetadata("superCallAnnotation.kt") + public void testSuperCallAnnotation() throws Exception { + runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/superCallAnnotation.kt"); + } + + @Test + @TestMetadata("superCallAnnotation2.kt") + public void testSuperCallAnnotation2() throws Exception { + runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/superCallAnnotation2.kt"); + } + + @Nested + @TestMetadata("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite") + @TestDataPath("$PROJECT_ROOT") + public class UseSite { + @Test + public void testAllFilesPresentInUseSite() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @Test + @TestMetadata("delegate.kt") + public void testDelegate() throws Exception { + runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/delegate.kt"); + } + + @Test + @TestMetadata("field.kt") + public void testField() throws Exception { + runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/field.kt"); + } + + @Test + @TestMetadata("file.kt") + public void testFile() throws Exception { + runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/file.kt"); + } + + @Test + @TestMetadata("getter.kt") + public void testGetter() throws Exception { + runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/getter.kt"); + } + + @Test + @TestMetadata("param.kt") + public void testParam() throws Exception { + runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/param.kt"); + } + + @Test + @TestMetadata("property.kt") + public void testProperty() throws Exception { + runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/property.kt"); + } + + @Test + @TestMetadata("setParam.kt") + public void testSetParam() throws Exception { + runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/setParam.kt"); + } + + @Test + @TestMetadata("setter.kt") + public void testSetter() throws Exception { + runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/useSite/setter.kt"); + } + } } @Nested @@ -109,6 +179,30 @@ public class SourceGetOrBuildFirTestGenerated extends AbstractSourceGetOrBuildFi runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/callArgument.kt"); } + @Test + @TestMetadata("callInsideLambdaInsideSuperCallAndExplicitConstructor.kt") + public void testCallInsideLambdaInsideSuperCallAndExplicitConstructor() throws Exception { + runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/callInsideLambdaInsideSuperCallAndExplicitConstructor.kt"); + } + + @Test + @TestMetadata("callInsideLambdaInsideSuperCallAndImplicitConstructor.kt") + public void testCallInsideLambdaInsideSuperCallAndImplicitConstructor() throws Exception { + runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/callInsideLambdaInsideSuperCallAndImplicitConstructor.kt"); + } + + @Test + @TestMetadata("callInsideLambdaInsideSuperCallFromSecondaryConstructor.kt") + public void testCallInsideLambdaInsideSuperCallFromSecondaryConstructor() throws Exception { + runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/callInsideLambdaInsideSuperCallFromSecondaryConstructor.kt"); + } + + @Test + @TestMetadata("callInsideLambdaInsideSuperCallFromSingleSecondaryConstructor.kt") + public void testCallInsideLambdaInsideSuperCallFromSingleSecondaryConstructor() throws Exception { + runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/callInsideLambdaInsideSuperCallFromSingleSecondaryConstructor.kt"); + } + @Test @TestMetadata("calllTypeArguments.kt") public void testCalllTypeArguments() throws Exception { @@ -228,6 +322,12 @@ public class SourceGetOrBuildFirTestGenerated extends AbstractSourceGetOrBuildFi public void testSetOperator() throws Exception { runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/setOperator.kt"); } + + @Test + @TestMetadata("superType.kt") + public void testSuperType() throws Exception { + runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/superType.kt"); + } } @Nested diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/compiler/based/AbstractCompilerBasedTestForFir.kt b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/compiler/based/AbstractCompilerBasedTestForFir.kt index edb37edd48e..263bb8a5f30 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/compiler/based/AbstractCompilerBasedTestForFir.kt +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/compiler/based/AbstractCompilerBasedTestForFir.kt @@ -31,9 +31,7 @@ import org.jetbrains.kotlin.test.frontend.fir.FirOutputPartForDependsOnModule import org.jetbrains.kotlin.test.model.DependencyKind import org.jetbrains.kotlin.test.model.FrontendKinds import org.jetbrains.kotlin.test.model.TestModule -import org.jetbrains.kotlin.test.services.ServiceRegistrationData -import org.jetbrains.kotlin.test.services.TestServices -import org.jetbrains.kotlin.test.services.isKtFile +import org.jetbrains.kotlin.test.services.* abstract class AbstractCompilerBasedTestForFir : AbstractCompilerBasedTest() { final override fun TestConfigurationBuilder.configuration() { diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/AbstractDiagnosticTraversalCounterTest.kt b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/AbstractDiagnosticTraversalCounterTest.kt index 201ff785e91..bca8e14d55c 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/AbstractDiagnosticTraversalCounterTest.kt +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/AbstractDiagnosticTraversalCounterTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -10,7 +10,7 @@ import org.jetbrains.kotlin.analysis.low.level.api.fir.api.DiagnosticCheckerFilt import org.jetbrains.kotlin.analysis.low.level.api.fir.api.collectDiagnosticsForFile import org.jetbrains.kotlin.analysis.low.level.api.fir.api.getOrBuildFirOfType import org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostics.BeforeElementDiagnosticCollectionHandler -import org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostics.SingleNonLocalDeclarationDiagnosticRetriever +import org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostics.ClassDiagnosticRetriever import org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostics.beforeElementDiagnosticCollectionHandler import org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostics.fir.PersistentCheckerContextFactory import org.jetbrains.kotlin.analysis.low.level.api.fir.renderWithClassName @@ -93,10 +93,11 @@ abstract class AbstractDiagnosticTraversalCounterTest : AbstractLowLevelApiSingl false } element.source?.kind == KtRealSourceElementKind -> true - SingleNonLocalDeclarationDiagnosticRetriever.shouldDiagnosticsAlwaysBeCheckedOn(element) -> true + ClassDiagnosticRetriever.shouldDiagnosticsAlwaysBeCheckedOn(element) -> true else -> false } } + firFile.accept(object : FirVisitorVoid() { override fun visitElement(element: FirElement) { if (element !in nonDuplicatingElements) return @@ -107,6 +108,7 @@ abstract class AbstractDiagnosticTraversalCounterTest : AbstractLowLevelApiSingl element.acceptChildren(this) } }) + return errorElements } diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/AbstractFirContextCollectionTest.kt b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/AbstractFirContextCollectionTest.kt index 2c932394426..b9bc99da249 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/AbstractFirContextCollectionTest.kt +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/AbstractFirContextCollectionTest.kt @@ -1,16 +1,10 @@ /* - * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostic -import org.jetbrains.kotlin.fir.SessionConfiguration -import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext -import org.jetbrains.kotlin.fir.declarations.FirDeclaration -import org.jetbrains.kotlin.fir.declarations.FirFile -import org.jetbrains.kotlin.fir.resolve.ImplicitReceiverStack -import org.jetbrains.kotlin.fir.resolve.SessionHolderImpl import org.jetbrains.kotlin.analysis.low.level.api.fir.api.DiagnosticCheckerFilter import org.jetbrains.kotlin.analysis.low.level.api.fir.api.getDiagnostics import org.jetbrains.kotlin.analysis.low.level.api.fir.api.getOrBuildFirFile @@ -18,11 +12,6 @@ import org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostics.BeforeElement import org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostics.beforeElementDiagnosticCollectionHandler import org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostics.fir.PersistenceContextCollector import org.jetbrains.kotlin.analysis.low.level.api.fir.file.structure.* -import org.jetbrains.kotlin.analysis.low.level.api.fir.file.structure.DanglingTopLevelModifierListStructureElement -import org.jetbrains.kotlin.analysis.low.level.api.fir.file.structure.FileStructureElement -import org.jetbrains.kotlin.analysis.low.level.api.fir.file.structure.NonReanalyzableDeclarationStructureElement -import org.jetbrains.kotlin.analysis.low.level.api.fir.file.structure.ReanalyzableStructureElement -import org.jetbrains.kotlin.analysis.low.level.api.fir.file.structure.RootStructureElement import org.jetbrains.kotlin.analysis.low.level.api.fir.isSourceSession import org.jetbrains.kotlin.analysis.low.level.api.fir.name import org.jetbrains.kotlin.analysis.low.level.api.fir.resolveWithClearCaches @@ -34,6 +23,12 @@ import org.jetbrains.kotlin.analysis.low.level.api.fir.test.configurators.Analys import org.jetbrains.kotlin.analysis.low.level.api.fir.test.configurators.AnalysisApiFirSourceTestConfigurator import org.jetbrains.kotlin.analysis.low.level.api.fir.useFirSessionConfigurator import org.jetbrains.kotlin.analysis.project.structure.getKtModule +import org.jetbrains.kotlin.fir.SessionConfiguration +import org.jetbrains.kotlin.fir.analysis.checkers.context.CheckerContext +import org.jetbrains.kotlin.fir.declarations.FirDeclaration +import org.jetbrains.kotlin.fir.declarations.FirFile +import org.jetbrains.kotlin.fir.resolve.ImplicitReceiverStack +import org.jetbrains.kotlin.fir.resolve.SessionHolderImpl import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder import org.jetbrains.kotlin.test.services.* @@ -66,10 +61,11 @@ abstract class AbstractFirContextCollectionTest : AbstractLowLevelApiSingleFileT } private fun FileStructureElement.getFirDeclaration(): FirDeclaration = when (this) { - is NonReanalyzableDeclarationStructureElement -> fir is ReanalyzableStructureElement<*, *> -> firSymbol.fir is RootStructureElement -> firFile is DanglingTopLevelModifierListStructureElement -> fir + is NonReanalyzableClassDeclarationStructureElement -> fir + is NonReanalyzableNonClassDeclarationStructureElement -> fir } private class BeforeElementLLFirSessionConfigurator(private val testServices: TestServices) : LLFirSessionConfigurator { diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/DiagnosticTraversalCounterTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/DiagnosticTraversalCounterTestGenerated.java index f27f6a733e3..b7ad690a8d1 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/DiagnosticTraversalCounterTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/DiagnosticTraversalCounterTestGenerated.java @@ -24,6 +24,30 @@ public class DiagnosticTraversalCounterTestGenerated extends AbstractDiagnosticT KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/diagnosticTraversalCounter"), Pattern.compile("^(.+)\\.kt$"), null, true); } + @Test + @TestMetadata("callInsideLambdaInsideSuperCallAndExplicitConstructor.kt") + public void testCallInsideLambdaInsideSuperCallAndExplicitConstructor() throws Exception { + runTest("analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/callInsideLambdaInsideSuperCallAndExplicitConstructor.kt"); + } + + @Test + @TestMetadata("callInsideLambdaInsideSuperCallAndImplicitConstructor.kt") + public void testCallInsideLambdaInsideSuperCallAndImplicitConstructor() throws Exception { + runTest("analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/callInsideLambdaInsideSuperCallAndImplicitConstructor.kt"); + } + + @Test + @TestMetadata("callInsideLambdaInsideSuperCallFromSecondaryConstructor.kt") + public void testCallInsideLambdaInsideSuperCallFromSecondaryConstructor() throws Exception { + runTest("analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/callInsideLambdaInsideSuperCallFromSecondaryConstructor.kt"); + } + + @Test + @TestMetadata("callInsideLambdaInsideSuperCallFromSingleSecondaryConstructor.kt") + public void testCallInsideLambdaInsideSuperCallFromSingleSecondaryConstructor() throws Exception { + runTest("analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/callInsideLambdaInsideSuperCallFromSingleSecondaryConstructor.kt"); + } + @Test @TestMetadata("constructor.kt") public void testConstructor() throws Exception { @@ -150,9 +174,49 @@ public class DiagnosticTraversalCounterTestGenerated extends AbstractDiagnosticT runTest("analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/secondaryConstructor.kt"); } + @Test + @TestMetadata("superCallAnnotation.kt") + public void testSuperCallAnnotation() throws Exception { + runTest("analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/superCallAnnotation.kt"); + } + + @Test + @TestMetadata("superCallAnnotation2.kt") + public void testSuperCallAnnotation2() throws Exception { + runTest("analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/superCallAnnotation2.kt"); + } + + @Test + @TestMetadata("superType.kt") + public void testSuperType() throws Exception { + runTest("analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/superType.kt"); + } + @Test @TestMetadata("typeAlias.kt") public void testTypeAlias() throws Exception { runTest("analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/typeAlias.kt"); } + + @Nested + @TestMetadata("analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/constructorParameters") + @TestDataPath("$PROJECT_ROOT") + public class ConstructorParameters { + @Test + public void testAllFilesPresentInConstructorParameters() throws Exception { + KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/constructorParameters"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @Test + @TestMetadata("constructorParameter.kt") + public void testConstructorParameter() throws Exception { + runTest("analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/constructorParameters/constructorParameter.kt"); + } + + @Test + @TestMetadata("constructorParameterWithAnnotations.kt") + public void testConstructorParameterWithAnnotations() throws Exception { + runTest("analysis/low-level-api-fir/testdata/diagnosticTraversalCounter/constructorParameters/constructorParameterWithAnnotations.kt"); + } + } } diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/FirOutOfContentRootContextCollectionTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/FirOutOfContentRootContextCollectionTestGenerated.java index 3b3fd2912ae..29611f33a29 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/FirOutOfContentRootContextCollectionTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/FirOutOfContentRootContextCollectionTestGenerated.java @@ -36,6 +36,12 @@ public class FirOutOfContentRootContextCollectionTestGenerated extends AbstractF runTest("analysis/low-level-api-fir/testdata/fileStructure/classMemberProperty.kt"); } + @Test + @TestMetadata("constructors.kt") + public void testConstructors() throws Exception { + runTest("analysis/low-level-api-fir/testdata/fileStructure/constructors.kt"); + } + @Test @TestMetadata("danglingAnnotationClassLevel.kt") public void testDanglingAnnotationClassLevel() throws Exception { diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/FirSourceContextCollectionTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/FirSourceContextCollectionTestGenerated.java index ec6b073bd2e..5201cd90eb0 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/FirSourceContextCollectionTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/FirSourceContextCollectionTestGenerated.java @@ -36,6 +36,12 @@ public class FirSourceContextCollectionTestGenerated extends AbstractFirSourceCo runTest("analysis/low-level-api-fir/testdata/fileStructure/classMemberProperty.kt"); } + @Test + @TestMetadata("constructors.kt") + public void testConstructors() throws Exception { + runTest("analysis/low-level-api-fir/testdata/fileStructure/constructors.kt"); + } + @Test @TestMetadata("danglingAnnotationClassLevel.kt") public void testDanglingAnnotationClassLevel() throws Exception { diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/AbstractDiagnosticCompilerTestDataTest.kt b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/AbstractDiagnosticCompilerTestDataTest.kt index 3bba3e01f1e..9fd2201bcbd 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/AbstractDiagnosticCompilerTestDataTest.kt +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/AbstractDiagnosticCompilerTestDataTest.kt @@ -7,12 +7,47 @@ package org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostic.compiler.base import org.jetbrains.kotlin.analysis.low.level.api.fir.compiler.based.AbstractCompilerBasedTestForFir import org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostic.compiler.based.facades.LLFirAnalyzerFacadeFactoryWithoutPreresolve +import org.jetbrains.kotlin.fir.symbols.FirLazyResolveContractViolationException +import org.jetbrains.kotlin.test.WrappedException import org.jetbrains.kotlin.test.bind import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder +import org.jetbrains.kotlin.test.directives.model.DirectivesContainer +import org.jetbrains.kotlin.test.directives.model.SimpleDirectivesContainer +import org.jetbrains.kotlin.test.model.AfterAnalysisChecker import org.jetbrains.kotlin.test.runners.baseFirDiagnosticTestConfiguration +import org.jetbrains.kotlin.test.services.TestServices +import org.jetbrains.kotlin.test.services.moduleStructure abstract class AbstractDiagnosticCompilerTestDataTest : AbstractCompilerBasedTestForFir() { override fun TestConfigurationBuilder.configureTest() { baseFirDiagnosticTestConfiguration(frontendFacade = ::LowLevelFirFrontendFacade.bind(LLFirAnalyzerFacadeFactoryWithoutPreresolve)) + useAfterAnalysisCheckers(::ContractViolationSuppressor) + } +} + +private class ContractViolationSuppressor(testServices: TestServices) : AfterAnalysisChecker(testServices) { + override val directiveContainers: List get() = listOf(Companion) + + override fun suppressIfNeeded(failedAssertions: List): List { + if (!isDisabled()) { + return failedAssertions + } + + val filteredExceptions = failedAssertions.filterNot { it.cause is FirLazyResolveContractViolationException } + return if (filteredExceptions.isEmpty()) { + listOf( + AssertionError( + "Test contains $IGNORE_CONTRACT_VIOLATIONS directive but no errors was reported. Please remove directive", + ).wrap() + ) + } else { + emptyList() + } + } + + private fun isDisabled(): Boolean = IGNORE_CONTRACT_VIOLATIONS in testServices.moduleStructure.allDirectives + + companion object : SimpleDirectivesContainer() { + val IGNORE_CONTRACT_VIOLATIONS by directive("Temporary disables test with contract violation until the issue is fixed") } } diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/file/structure/AbstractFileStructureTest.kt b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/file/structure/AbstractFileStructureTest.kt index baf45a96336..99f81b6e751 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/file/structure/AbstractFileStructureTest.kt +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/file/structure/AbstractFileStructureTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -63,6 +63,9 @@ abstract class AbstractFileStructureTest : AbstractLowLevelApiSingleFileTest() { is KtTypeAlias -> { elementToComment[ktDeclaration.getTypeReference()!!] = comment } + is KtClassInitializer -> { + elementToComment[ktDeclaration.openBraceNode!!] = comment + } else -> error("Unsupported declaration $ktDeclaration") } } diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/file/structure/OutOfContentRootFileStructureTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/file/structure/OutOfContentRootFileStructureTestGenerated.java index 56b428d1bad..a3ba2a2edaa 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/file/structure/OutOfContentRootFileStructureTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/file/structure/OutOfContentRootFileStructureTestGenerated.java @@ -36,6 +36,12 @@ public class OutOfContentRootFileStructureTestGenerated extends AbstractOutOfCon runTest("analysis/low-level-api-fir/testdata/fileStructure/classMemberProperty.kt"); } + @Test + @TestMetadata("constructors.kt") + public void testConstructors() throws Exception { + runTest("analysis/low-level-api-fir/testdata/fileStructure/constructors.kt"); + } + @Test @TestMetadata("danglingAnnotationClassLevel.kt") public void testDanglingAnnotationClassLevel() throws Exception { diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/file/structure/SourceFileStructureTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/file/structure/SourceFileStructureTestGenerated.java index 137c8bbc3d2..b41293cbec0 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/file/structure/SourceFileStructureTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/file/structure/SourceFileStructureTestGenerated.java @@ -36,6 +36,12 @@ public class SourceFileStructureTestGenerated extends AbstractSourceFileStructur runTest("analysis/low-level-api-fir/testdata/fileStructure/classMemberProperty.kt"); } + @Test + @TestMetadata("constructors.kt") + public void testConstructors() throws Exception { + runTest("analysis/low-level-api-fir/testdata/fileStructure/constructors.kt"); + } + @Test @TestMetadata("danglingAnnotationClassLevel.kt") public void testDanglingAnnotationClassLevel() throws Exception { diff --git a/compiler/fir/analysis-tests/testData/resolve/annotationOnDeclarationWithDifferentArguments.kt b/compiler/fir/analysis-tests/testData/resolve/annotationOnDeclarationWithDifferentArguments.kt index a47500009bf..e7d4b1a3414 100644 --- a/compiler/fir/analysis-tests/testData/resolve/annotationOnDeclarationWithDifferentArguments.kt +++ b/compiler/fir/analysis-tests/testData/resolve/annotationOnDeclarationWithDifferentArguments.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE import kotlin.reflect.KClass enum class SomeEnum { diff --git a/compiler/fir/analysis-tests/testData/resolve/cfa/reassignOfNonLocalProperty_initializedProperties.kt b/compiler/fir/analysis-tests/testData/resolve/cfa/reassignOfNonLocalProperty_initializedProperties.kt index 08044301684..5d5a2c458d1 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfa/reassignOfNonLocalProperty_initializedProperties.kt +++ b/compiler/fir/analysis-tests/testData/resolve/cfa/reassignOfNonLocalProperty_initializedProperties.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // ISSUE: KT-55493 // WITH_STDLIB diff --git a/compiler/fir/analysis-tests/testData/resolve/cfa/reassignOfNonMemberProperty_lateInitialization.kt b/compiler/fir/analysis-tests/testData/resolve/cfa/reassignOfNonMemberProperty_lateInitialization.kt index e576076acba..d9dd5c0828d 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfa/reassignOfNonMemberProperty_lateInitialization.kt +++ b/compiler/fir/analysis-tests/testData/resolve/cfa/reassignOfNonMemberProperty_lateInitialization.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // ISSUE: KT-55493 // WITH_STDLIB diff --git a/compiler/fir/analysis-tests/testData/resolve/cfa/smartcastOnThisDuringClassInitialization.kt b/compiler/fir/analysis-tests/testData/resolve/cfa/smartcastOnThisDuringClassInitialization.kt index 1f60296a3f6..d450c98948a 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfa/smartcastOnThisDuringClassInitialization.kt +++ b/compiler/fir/analysis-tests/testData/resolve/cfa/smartcastOnThisDuringClassInitialization.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // ISSUE: KT-56863 interface I diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/annotatedLocalClass.kt b/compiler/fir/analysis-tests/testData/resolve/cfg/annotatedLocalClass.kt index 5b1883cde87..794013aabe4 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfg/annotatedLocalClass.kt +++ b/compiler/fir/analysis-tests/testData/resolve/cfg/annotatedLocalClass.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DUMP_CFG annotation class Ann diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/complex.kt b/compiler/fir/analysis-tests/testData/resolve/cfg/complex.kt index f8af1f9d020..064c92a92d7 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfg/complex.kt +++ b/compiler/fir/analysis-tests/testData/resolve/cfg/complex.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DUMP_CFG interface AutoCloseable { fun close() diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/initBlock.kt b/compiler/fir/analysis-tests/testData/resolve/cfg/initBlock.kt index 1ba10334688..53799431123 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfg/initBlock.kt +++ b/compiler/fir/analysis-tests/testData/resolve/cfg/initBlock.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DUMP_CFG class Foo { init { diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/initBlockAndInPlaceLambda.kt b/compiler/fir/analysis-tests/testData/resolve/cfg/initBlockAndInPlaceLambda.kt index e17648d5fa6..06f6dffba56 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfg/initBlockAndInPlaceLambda.kt +++ b/compiler/fir/analysis-tests/testData/resolve/cfg/initBlockAndInPlaceLambda.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DUMP_CFG interface B diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/lambdaReturningObject.kt b/compiler/fir/analysis-tests/testData/resolve/cfg/lambdaReturningObject.kt index 21990b7de25..0cf43a7165a 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfg/lambdaReturningObject.kt +++ b/compiler/fir/analysis-tests/testData/resolve/cfg/lambdaReturningObject.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DUMP_CFG interface Out diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/postponedLambdaInConstructor.kt b/compiler/fir/analysis-tests/testData/resolve/cfg/postponedLambdaInConstructor.kt index da0030b9556..302d1b95bf8 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfg/postponedLambdaInConstructor.kt +++ b/compiler/fir/analysis-tests/testData/resolve/cfg/postponedLambdaInConstructor.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DUMP_CFG abstract class A(func: () -> String) diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/postponedLambdaInReturn.kt b/compiler/fir/analysis-tests/testData/resolve/cfg/postponedLambdaInReturn.kt index d6a8d51ced2..8559de2a0b6 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfg/postponedLambdaInReturn.kt +++ b/compiler/fir/analysis-tests/testData/resolve/cfg/postponedLambdaInReturn.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DUMP_CFG import kotlin.contracts.* diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/returnValuesFromLambda.kt b/compiler/fir/analysis-tests/testData/resolve/cfg/returnValuesFromLambda.kt index 20890ed7f7f..e0d1b079569 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfg/returnValuesFromLambda.kt +++ b/compiler/fir/analysis-tests/testData/resolve/cfg/returnValuesFromLambda.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DUMP_CFG interface A diff --git a/compiler/fir/analysis-tests/testData/resolve/cfg/safeCalls.kt b/compiler/fir/analysis-tests/testData/resolve/cfg/safeCalls.kt index a79555c2a90..f1e8859e0bc 100644 --- a/compiler/fir/analysis-tests/testData/resolve/cfg/safeCalls.kt +++ b/compiler/fir/analysis-tests/testData/resolve/cfg/safeCalls.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DUMP_CFG interface A { fun foo(): A diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/annotationArgumentMustBeConst.kt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/annotationArgumentMustBeConst.kt index 4e3c33606c8..86984c64a8d 100644 --- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/annotationArgumentMustBeConst.kt +++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/annotationArgumentMustBeConst.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE annotation class Ann1(vararg val a: String) annotation class Ann2(val a: IntArray) annotation class Ann3(val a: Array) diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/annotationArgumentMustBeKClassLiteral.kt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/annotationArgumentMustBeKClassLiteral.kt index 6f051ccf8f1..f32955807db 100644 --- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/annotationArgumentMustBeKClassLiteral.kt +++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/annotationArgumentMustBeKClassLiteral.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE import kotlin.reflect.KClass @Repeatable diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/annotationClassMember.kt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/annotationClassMember.kt index 908260933f4..c216b670713 100644 --- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/annotationClassMember.kt +++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/annotationClassMember.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE annotation class A() { constructor(s: Nothing?) {} init {} diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/nonConstValInAnnotationArgument.kt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/nonConstValInAnnotationArgument.kt index 5b3c57a00ee..8a9dfbb7c40 100644 --- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/nonConstValInAnnotationArgument.kt +++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/nonConstValInAnnotationArgument.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE annotation class Ann(val a: Array) val foo = "" diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/propertyTypeMismatchOnOverride.kt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/propertyTypeMismatchOnOverride.kt index 5353dde97f8..85502ea44e4 100644 --- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/propertyTypeMismatchOnOverride.kt +++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/propertyTypeMismatchOnOverride.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE open class A { open var test: Number = 10 } diff --git a/compiler/fir/analysis-tests/testData/resolve/diagnostics/repeatedModifier.kt b/compiler/fir/analysis-tests/testData/resolve/diagnostics/repeatedModifier.kt index e48b6b4c649..adbb0b1c8a3 100644 --- a/compiler/fir/analysis-tests/testData/resolve/diagnostics/repeatedModifier.kt +++ b/compiler/fir/analysis-tests/testData/resolve/diagnostics/repeatedModifier.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE open open class A internal internal object B diff --git a/compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveWhenAndDNNType.kt b/compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveWhenAndDNNType.kt index 5a7621a7791..be8412c5e42 100644 --- a/compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveWhenAndDNNType.kt +++ b/compiler/fir/analysis-tests/testData/resolve/exhaustiveness/positive/exhaustiveWhenAndDNNType.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DUMP_CFG // ISSUE: KT-37091 diff --git a/compiler/fir/analysis-tests/testData/resolve/expresssions/CallBasedInExpressionGenerator.kt b/compiler/fir/analysis-tests/testData/resolve/expresssions/CallBasedInExpressionGenerator.kt index b068490f9e2..0284552e9c9 100644 --- a/compiler/fir/analysis-tests/testData/resolve/expresssions/CallBasedInExpressionGenerator.kt +++ b/compiler/fir/analysis-tests/testData/resolve/expresssions/CallBasedInExpressionGenerator.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE package org.jetbrains.kotlin.codegen.range.inExpression interface ExpressionCodegen diff --git a/compiler/fir/analysis-tests/testData/resolve/fromBuilder/enums.kt b/compiler/fir/analysis-tests/testData/resolve/fromBuilder/enums.kt index 21fecd461f1..509ae144ff8 100644 --- a/compiler/fir/analysis-tests/testData/resolve/fromBuilder/enums.kt +++ b/compiler/fir/analysis-tests/testData/resolve/fromBuilder/enums.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // Ignore reason: KT-57619 import my.println diff --git a/compiler/fir/analysis-tests/testData/resolve/fromBuilder/noPrimaryConstructor.kt b/compiler/fir/analysis-tests/testData/resolve/fromBuilder/noPrimaryConstructor.kt index db20c9ba0a5..5f0a3dcd069 100644 --- a/compiler/fir/analysis-tests/testData/resolve/fromBuilder/noPrimaryConstructor.kt +++ b/compiler/fir/analysis-tests/testData/resolve/fromBuilder/noPrimaryConstructor.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class NoPrimary { val x: String diff --git a/compiler/fir/analysis-tests/testData/resolve/lambdaPropertyTypeInference.kt b/compiler/fir/analysis-tests/testData/resolve/lambdaPropertyTypeInference.kt index 0d3825e0b89..28b067e535e 100644 --- a/compiler/fir/analysis-tests/testData/resolve/lambdaPropertyTypeInference.kt +++ b/compiler/fir/analysis-tests/testData/resolve/lambdaPropertyTypeInference.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !CHECK_TYPE // UNEXPECTED BEHAVIOUR // ISSUES: KT-37066 diff --git a/compiler/fir/analysis-tests/testData/resolve/problems/kt42346.kt b/compiler/fir/analysis-tests/testData/resolve/problems/kt42346.kt index 512580a0b9c..045eced24e1 100644 --- a/compiler/fir/analysis-tests/testData/resolve/problems/kt42346.kt +++ b/compiler/fir/analysis-tests/testData/resolve/problems/kt42346.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FILE: MagicConstant.java public @interface MagicConstant { diff --git a/compiler/fir/analysis-tests/testData/resolve/problems/secondaryConstructorCfg.kt b/compiler/fir/analysis-tests/testData/resolve/problems/secondaryConstructorCfg.kt index a31f58b9a45..4eab56422cc 100644 --- a/compiler/fir/analysis-tests/testData/resolve/problems/secondaryConstructorCfg.kt +++ b/compiler/fir/analysis-tests/testData/resolve/problems/secondaryConstructorCfg.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DUMP_CFG class B(p0: String) { val p1 = p0 diff --git a/compiler/fir/analysis-tests/testData/resolve/scopes/kotlinAccessorsLikeFunctionsThrowJavaClass.kt b/compiler/fir/analysis-tests/testData/resolve/scopes/kotlinAccessorsLikeFunctionsThrowJavaClass.kt index 3c8cd07490e..92be1b74eac 100644 --- a/compiler/fir/analysis-tests/testData/resolve/scopes/kotlinAccessorsLikeFunctionsThrowJavaClass.kt +++ b/compiler/fir/analysis-tests/testData/resolve/scopes/kotlinAccessorsLikeFunctionsThrowJavaClass.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FILE: A.kt open class A { open fun getScope(): String? = null diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/bangbang.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/bangbang.kt index 034fdd1db98..327e8273b11 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/bangbang.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/bangbang.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DUMP_CFG interface A { fun foo(): Boolean diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/booleanOperators.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/booleanOperators.kt index 86c8efa0a68..4f293d49cd0 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/booleanOperators.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/booleanOperators.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DUMP_CFG interface A { fun foo() diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/equalsToBoolean.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/equalsToBoolean.kt index 8aa65dd526c..f954bff67f3 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/equalsToBoolean.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/equalsToBoolean.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DUMP_CFG interface A { fun foo() diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/jumpFromRhsOfOperator.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/jumpFromRhsOfOperator.kt index 28566f4aa1b..076f593e151 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/jumpFromRhsOfOperator.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/booleans/jumpFromRhsOfOperator.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DUMP_CFG interface A { diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcasts.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcasts.kt index 96c37389f9e..148f8af2c9b 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcasts.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcasts.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DUMP_CFG interface A { fun foo() diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcastsInBranches.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcastsInBranches.kt index d2e7db746a0..22feafe6f32 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcastsInBranches.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/boundSmartcastsInBranches.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DUMP_CFG class A { val s: String = "" diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/functionCallBound.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/functionCallBound.kt index 5d4512b87e7..d40567e90db 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/functionCallBound.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/boundSmartcasts/functionCallBound.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DUMP_CFG open class Base diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/elvis.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/elvis.kt index d9bb35a7d50..8891abd774d 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/elvis.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/elvis.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DUMP_CFG interface A { fun foo() diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/returns.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/returns.kt index 39194b8b0c3..cacf8dcd98e 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/returns.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/returns.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DUMP_CFG fun test_0(x: Any) { if (x is String) { diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/smartcastFromArgument.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/smartcastFromArgument.kt index 013d25677e2..3ce26ed8eea 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/smartcastFromArgument.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/smartcastFromArgument.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DUMP_CFG interface A { fun foo() diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/when.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/when.kt index b2cceb0107a..a5e84e1accd 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/when.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/controlStructures/when.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DUMP_CFG interface A { fun foo() diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/equalsAndIdentity.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/equalsAndIdentity.kt index 83530aec682..fcf5c715f73 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/equalsAndIdentity.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/equalsAndIdentity.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DUMP_CFG interface A { fun foo() diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/lambdas/inPlaceLambdas.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/lambdas/inPlaceLambdas.kt index 0623d39d291..abc7a141b50 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/lambdas/inPlaceLambdas.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/lambdas/inPlaceLambdas.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DUMP_CFG interface A { fun foo() diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/lambdas/lambdaInWhenBranch.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/lambdas/lambdaInWhenBranch.kt index ba63b24b295..8f1be2f0d9d 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/lambdas/lambdaInWhenBranch.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/lambdas/lambdaInWhenBranch.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // ISSUE: KT-39080 // !DUMP_CFG diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/loops/dataFlowInfoFromWhileCondition.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/loops/dataFlowInfoFromWhileCondition.kt index c66d69761ed..7008375bcb0 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/loops/dataFlowInfoFromWhileCondition.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/loops/dataFlowInfoFromWhileCondition.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DUMP_CFG interface A { fun foo(): Boolean diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/loops/endlessLoops.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/loops/endlessLoops.kt index c3180ab8cc5..1776f00f971 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/loops/endlessLoops.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/loops/endlessLoops.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DUMP_CFG interface A { fun foo() diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/multipleCasts.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/multipleCasts.kt index bc211b39e39..c9b0b837694 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/multipleCasts.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/multipleCasts.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DUMP_CFG // There would be ambiguities if some expression was smartcasted to (A & B) and foo() was called. // There was a bug where 2 variables were "bound" together if they are assigned from the same function call or property. diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/nullability.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/nullability.kt index cb3dda18b2d..ff5547b3153 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/nullability.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/nullability.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DUMP_CFG // CONTAINS ERRORS diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/receivers/implicitReceivers.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/receivers/implicitReceivers.kt index 04ba79c149e..b1ddb729fcc 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/receivers/implicitReceivers.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/receivers/implicitReceivers.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DUMP_CFG class A { fun foo() {} diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/assignSafeCall.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/assignSafeCall.kt index 8c0cc813ee5..8e51020f74a 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/assignSafeCall.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/assignSafeCall.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DUMP_CFG // ----------------- Stable ----------------- diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCalls.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCalls.kt index 13c8c3d2ea5..3c681bde320 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCalls.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/safeCalls/safeCalls.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DUMP_CFG fun String.foo(b: Boolean): String = "" diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartCastInInit.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartCastInInit.kt index e41e93d116e..6c04bd27d89 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartCastInInit.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartCastInInit.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DUMP_CFG interface I interface S : I { diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastInByClause.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastInByClause.kt index 2a4800dc88a..0ce7e645d12 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastInByClause.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastInByClause.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // ISSUE: KT-49747 // DUMP_CFG diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastToNothing.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastToNothing.kt index 19822b1349f..7bf0acfa9b3 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastToNothing.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/smartcastToNothing.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DUMP_CFG fun getNothing(): Nothing = throw Exception() fun getNullableNothing(): Nothing? = null diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/stability/overridenOpenVal.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/stability/overridenOpenVal.kt index ba2a7d16017..98b6ef64964 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/stability/overridenOpenVal.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/stability/overridenOpenVal.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DUMP_CFG open class A(open val x: Any) diff --git a/compiler/fir/analysis-tests/testData/resolve/smartcasts/variables/delayedAssignment.kt b/compiler/fir/analysis-tests/testData/resolve/smartcasts/variables/delayedAssignment.kt index 3261a82411c..05c62c6d6d5 100644 --- a/compiler/fir/analysis-tests/testData/resolve/smartcasts/variables/delayedAssignment.kt +++ b/compiler/fir/analysis-tests/testData/resolve/smartcasts/variables/delayedAssignment.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DUMP_CFG class A { fun foo() {} diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/delegateWithAnonymousObject.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/delegateWithAnonymousObject.kt index 4382aadd0f3..8bfe0d4bc69 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/delegateWithAnonymousObject.kt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/delegateWithAnonymousObject.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DUMP_CFG import kotlin.properties.ReadWriteProperty diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/simpleDelegatedToMap.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/simpleDelegatedToMap.kt index 05ad315b70f..09535d63d34 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/simpleDelegatedToMap.kt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/delegates/simpleDelegatedToMap.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class C(val map: MutableMap) { var foo by map } diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/inference/plusAssignWithLambdaInRhs.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/inference/plusAssignWithLambdaInRhs.kt index 1b898adc027..a2248ca2899 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/inference/plusAssignWithLambdaInRhs.kt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/inference/plusAssignWithLambdaInRhs.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // ISSUE: KT-39005 // !DUMP_CFG diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/reinitializations/constructorVarWrite.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/reinitializations/constructorVarWrite.kt index 15425f08f84..3d4e5944d22 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/reinitializations/constructorVarWrite.kt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/reinitializations/constructorVarWrite.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class Some(var foo: Int) { init { if (foo < 0) { diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/runOnIntegerLiteral.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/runOnIntegerLiteral.kt index 8afc58c9743..ad72a5de69a 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/runOnIntegerLiteral.kt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/runOnIntegerLiteral.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class TestInitValInLambdaCalledOnce { val x: Int init { diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirStatusResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirStatusResolveTransformer.kt index ae74e2bca21..0cf9bf6625d 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirStatusResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirStatusResolveTransformer.kt @@ -1,16 +1,16 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package org.jetbrains.kotlin.fir.resolve.transformers import org.jetbrains.kotlin.fir.FirSession +import org.jetbrains.kotlin.fir.PrivateForInline import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.declarations.utils.isInline import org.jetbrains.kotlin.fir.expressions.FirBlock import org.jetbrains.kotlin.fir.expressions.FirStatement -import org.jetbrains.kotlin.fir.render import org.jetbrains.kotlin.fir.resolve.ScopeSession import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.LocalClassesNavigationInfo import org.jetbrains.kotlin.fir.scopes.FirCompositeScope @@ -90,14 +90,13 @@ open class FirStatusResolveTransformer( val computationStatus = statusComputationSession.startComputing(firClass) forceResolveStatusesOfSupertypes(firClass) /* - * Status of class may be already calculated if that class was in supertypes of one of previous classes + * Status of class may be already calculated if that class was in supertypes of one of the previous classes */ if (computationStatus != StatusComputationSession.StatusComputationStatus.Computed) { - firClass.transformStatus(this, statusResolver.resolveStatus(firClass, containingClass, isLocal = false)) - if (firClass is FirRegularClass && firClass.isInline) { - firClass.valueClassRepresentation = computeValueClassRepresentation(firClass, session) - } + transformClassStatus(firClass) + transformValueClassRepresentation(firClass) } + return transformClass(firClass, data).also { statusComputationSession.endComputing(firClass) } @@ -187,13 +186,15 @@ class StatusComputationSession { abstract class AbstractFirStatusResolveTransformer( final override val session: FirSession, val scopeSession: ScopeSession, - protected val statusComputationSession: StatusComputationSession, + val statusComputationSession: StatusComputationSession, private val designationMapForLocalClasses: Map, private val scopeForLocalClass: FirScope? ) : FirAbstractTreeTransformer(phase = FirResolvePhase.STATUS) { - protected val classes = mutableListOf() - protected val statusResolver = FirStatusResolver(session, scopeSession) + @PrivateForInline + val classes = mutableListOf() + val statusResolver = FirStatusResolver(session, scopeSession) + @OptIn(PrivateForInline::class) protected val containingClass: FirClass? get() = classes.lastOrNull() protected abstract fun FirDeclaration.needResolveMembers(): Boolean @@ -213,7 +214,8 @@ abstract class AbstractFirStatusResolveTransformer( return (data ?: declarationStatus) } - protected inline fun storeClass( + @OptIn(PrivateForInline::class) + inline fun storeClass( klass: FirClass, computeResult: () -> FirDeclaration ): FirDeclaration { @@ -309,7 +311,17 @@ abstract class AbstractFirStatusResolveTransformer( } as FirStatement } - protected fun forceResolveStatusesOfSupertypes(regularClass: FirClass) { + fun transformValueClassRepresentation(firClass: FirClass) { + if (firClass is FirRegularClass && firClass.isInline) { + firClass.valueClassRepresentation = computeValueClassRepresentation(firClass, session) + } + } + + fun transformClassStatus(firClass: FirClass) { + firClass.transformStatus(this, statusResolver.resolveStatus(firClass, containingClass, isLocal = false)) + } + + fun forceResolveStatusesOfSupertypes(regularClass: FirClass) { for (superTypeRef in regularClass.superTypeRefs) { forceResolveStatusOfCorrespondingClass(superTypeRef) } @@ -317,7 +329,7 @@ abstract class AbstractFirStatusResolveTransformer( private fun forceResolveStatusOfCorrespondingClass(typeRef: FirTypeRef) { val superClassSymbol = typeRef.coneType.toSymbol(session) - superClassSymbol?.lazyResolveToPhase(FirResolvePhase.SUPER_TYPES) + superClassSymbol?.lazyResolveToPhase(FirResolvePhase.STATUS.previous) when (superClassSymbol) { is FirRegularClassSymbol -> forceResolveStatusesOfClass(superClassSymbol.fir) is FirTypeAliasSymbol -> forceResolveStatusOfCorrespondingClass(superClassSymbol.fir.expandedTypeRef) @@ -349,7 +361,12 @@ abstract class AbstractFirStatusResolveTransformer( statusComputationSession.endComputing(regularClass) return } - val designation = DesignationState.create(regularClass.symbol, designationMapForLocalClasses, includeFile = false) ?: return + if (!resolveClassForSuperType(regularClass)) return + statusComputationSession.endComputing(regularClass) + } + + protected open fun resolveClassForSuperType(regularClass: FirRegularClass): Boolean { + val designation = DesignationState.create(regularClass.symbol, designationMapForLocalClasses, includeFile = false) ?: return false val transformer = FirDesignatedStatusResolveTransformer( session, @@ -359,8 +376,9 @@ abstract class AbstractFirStatusResolveTransformer( designationMapForLocalClasses, scopeForLocalClass ) + designation.firstDeclaration.transformSingle(transformer, null) - statusComputationSession.endComputing(regularClass) + return true } private fun transformPropertyAccessor( diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirTypeResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirTypeResolveTransformer.kt index 0f58f595892..e79098d7a52 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirTypeResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/FirTypeResolveTransformer.kt @@ -9,6 +9,7 @@ import kotlinx.collections.immutable.* import org.jetbrains.kotlin.KtFakeSourceElementKind import org.jetbrains.kotlin.descriptors.annotations.AnnotationUseSiteTarget import org.jetbrains.kotlin.fir.FirSession +import org.jetbrains.kotlin.fir.PrivateForInline import org.jetbrains.kotlin.fir.correspondingProperty import org.jetbrains.kotlin.fir.copyWithNewSourceKind import org.jetbrains.kotlin.fir.declarations.* @@ -57,22 +58,25 @@ fun F.runTypeResolvePhaseForLocalClass( return this.transform(transformer, null) } +@OptIn(PrivateForInline::class) open class FirTypeResolveTransformer( final override val session: FirSession, - private val scopeSession: ScopeSession, + @property:PrivateForInline val scopeSession: ScopeSession, initialScopes: List = emptyList(), initialCurrentFile: FirFile? = null, - private val classDeclarationsStack: ArrayDeque = ArrayDeque() + @property:PrivateForInline val classDeclarationsStack: ArrayDeque = ArrayDeque() ) : FirAbstractTreeTransformer(FirResolvePhase.TYPES) { /** * All current scopes sorted from outermost to innermost. */ - private var scopes = initialScopes.asReversed().toPersistentList() + @PrivateForInline + var scopes = initialScopes.asReversed().toPersistentList() /** * Scopes that are accessible statically, i.e. [scopes] minus type parameter scopes. */ - private var staticScopes = scopes + @PrivateForInline + var staticScopes = scopes private var currentDeclaration: FirDeclaration? = null @@ -87,33 +91,48 @@ open class FirTypeResolveTransformer( } private val typeResolverTransformer: FirSpecificTypeResolverTransformer = FirSpecificTypeResolverTransformer(session) - private var currentFile: FirFile? = initialCurrentFile + + @PrivateForInline + var currentFile: FirFile? = initialCurrentFile override fun transformFile(file: FirFile, data: Any?): FirFile { checkSessionConsistency(file) + return withFileScope(file) { + super.transformFile(file, data) + } + } + + inline fun withFileScope(file: FirFile, crossinline action: () -> R): R { currentFile = file return withScopeCleanup { addScopes(createImportingScopes(file, session, scopeSession)) - super.transformFile(file, data) + action() } } override fun transformRegularClass(regularClass: FirRegularClass, data: Any?): FirStatement { whileAnalysing(session, regularClass) { - withClassDeclarationCleanup(classDeclarationsStack, regularClass) { - withScopeCleanup { - regularClass.addTypeParametersScope() - regularClass.typeParameters.forEach { - it.accept(this, data) - } - unboundCyclesInTypeParametersSupertypes(regularClass) - } - + withClassDeclarationCleanup(regularClass) { + transformClassTypeParameters(regularClass, data) return resolveClassContent(regularClass, data) } } } + fun transformClassTypeParameters(regularClass: FirRegularClass, data: Any?) { + withScopeCleanup { + addTypeParametersScope(regularClass) + regularClass.typeParameters.forEach { + it.accept(this, data) + } + unboundCyclesInTypeParametersSupertypes(regularClass) + } + } + + inline fun withClassDeclarationCleanup(regularClass: FirRegularClass, action: () -> R): R { + return withClassDeclarationCleanup(classDeclarationsStack, regularClass, action) + } + override fun transformAnonymousObject(anonymousObject: FirAnonymousObject, data: Any?): FirStatement { withClassDeclarationCleanup(classDeclarationsStack, anonymousObject) { return resolveClassContent(anonymousObject, data) @@ -122,7 +141,7 @@ open class FirTypeResolveTransformer( override fun transformConstructor(constructor: FirConstructor, data: Any?): FirConstructor = whileAnalysing(session, constructor) { return withScopeCleanup { - constructor.addTypeParametersScope() + addTypeParametersScope(constructor) val result = transformDeclaration(constructor, data) as FirConstructor if (result.isPrimary) { @@ -140,7 +159,7 @@ open class FirTypeResolveTransformer( override fun transformTypeAlias(typeAlias: FirTypeAlias, data: Any?): FirTypeAlias = whileAnalysing(session, typeAlias) { withScopeCleanup { - typeAlias.addTypeParametersScope() + addTypeParametersScope(typeAlias) transformDeclaration(typeAlias, data) } as FirTypeAlias } @@ -160,7 +179,7 @@ open class FirTypeResolveTransformer( override fun transformProperty(property: FirProperty, data: Any?): FirProperty = whileAnalysing(session, property) { withScopeCleanup { withDeclaration(property) { - property.addTypeParametersScope() + addTypeParametersScope(property) property.transformTypeParameters(this, data) .transformReturnTypeRef(this, data) .transformReceiverParameter(this, data) @@ -182,9 +201,18 @@ open class FirTypeResolveTransformer( } property.returnTypeRef !is FirResolvedTypeRef && property.initializer == null && property.getter?.returnTypeRef is FirResolvedTypeRef -> { - property.replaceReturnTypeRef( - property.getter!!.returnTypeRef.copyWithNewSourceKind(KtFakeSourceElementKind.PropertyTypeFromGetterReturnType) + val returnTypeRef = property.getter!!.returnTypeRef + + property.replaceReturnTypeRef(returnTypeRef.copyWithNewSourceKind(KtFakeSourceElementKind.PropertyTypeFromGetterReturnType)) + property.backingField?.replaceReturnTypeRef( + returnTypeRef.copyWithNewSourceKind(KtFakeSourceElementKind.PropertyTypeFromGetterReturnType) ) + + property.setter?.valueParameters?.forEach { + it.replaceReturnTypeRef( + returnTypeRef.copyWithNewSourceKind(KtFakeSourceElementKind.PropertyTypeFromGetterReturnType) + ) + } } } @@ -219,7 +247,7 @@ open class FirTypeResolveTransformer( ): FirSimpleFunction = whileAnalysing(session, simpleFunction) { withScopeCleanup { withDeclaration(simpleFunction) { - simpleFunction.addTypeParametersScope() + addTypeParametersScope(simpleFunction) transformDeclaration(simpleFunction, data).also { unboundCyclesInTypeParametersSupertypes(it as FirTypeParametersOwner) calculateDeprecations(simpleFunction) @@ -339,10 +367,11 @@ open class FirTypeResolveTransformer( annotationCall.replaceAnnotationTypeRef(transformedTypeRef) } } + return annotationCall } - private inline fun withScopeCleanup(crossinline l: () -> T): T { + inline fun withScopeCleanup(crossinline l: () -> T): T { val scopesBefore = scopes val staticScopesBefore = staticScopes @@ -357,80 +386,92 @@ open class FirTypeResolveTransformer( private fun resolveClassContent( firClass: FirClass, data: Any? - ): FirStatement { - - return withScopeCleanup { - // Remove type parameter scopes for classes that are neither inner nor local - if (!firClass.isInner && !firClass.isLocal) { - this.scopes = staticScopes - } - + ): FirStatement = withClassScopes( + firClass, + actionInsideStaticScope = { withScopeCleanup { firClass.transformAnnotations(this, null) if (firClass is FirRegularClass) { - firClass.addTypeParametersScope() + addTypeParametersScope(firClass) } // ConstructedTypeRef should be resolved only with type parameters, but not with nested classes and classes from supertypes for (constructor in firClass.declarations.filterIsInstance()) { - constructor.delegatedConstructor?.let(this::resolveConstructedTypeRefForDelegatedConstructorCall) + transformDelegatedConstructorCall(constructor) } } - - // ? Is it Ok to use original file session here ? - val superTypes = lookupSuperTypes( - firClass, - lookupInterfaces = false, - deep = true, - substituteTypes = true, - useSiteSession = session - ).asReversed() - - val scopesToAdd = mutableListOf() - - for (superType in superTypes) { - superType.lookupTag.getNestedClassifierScope(session, scopeSession)?.let { nestedClassifierScope -> - val scope = nestedClassifierScope.wrapNestedClassifierScopeWithSubstitutionForSuperType(superType, session) - scopesToAdd.add(scope) - } - } - session.nestedClassifierScope(firClass)?.let(scopesToAdd::add) - if (firClass is FirRegularClass) { - val companionObject = firClass.companionObjectSymbol?.fir - if (companionObject != null) { - session.nestedClassifierScope(companionObject)?.let(scopesToAdd::add) - } - - addScopes(scopesToAdd) - firClass.addTypeParametersScope() - } else { - addScopes(scopesToAdd) - } - - // Note that annotations are still visited here - // again, although there's no need in it - transformElement(firClass, data) } + ) { + // Note that annotations are still visited here + // again, although there's no need in it + transformElement(firClass, data) + } + + fun transformDelegatedConstructorCall(constructor: FirConstructor) { + constructor.delegatedConstructor?.let(this::resolveConstructedTypeRefForDelegatedConstructorCall) + } + + inline fun withClassScopes( + firClass: FirClass, + crossinline actionInsideStaticScope: () -> Unit = {}, + crossinline action: () -> R, + ): R = withScopeCleanup { + // Remove type parameter scopes for classes that are neither inner nor local + if (!firClass.isInner && !firClass.isLocal) { + this.scopes = staticScopes + } + + actionInsideStaticScope() + + // ? Is it Ok to use original file session here ? + val superTypes = lookupSuperTypes( + firClass, + lookupInterfaces = false, + deep = true, + substituteTypes = true, + useSiteSession = session + ).asReversed() + + val scopesToAdd = mutableListOf() + + for (superType in superTypes) { + superType.lookupTag.getNestedClassifierScope(session, scopeSession)?.let { nestedClassifierScope -> + val scope = nestedClassifierScope.wrapNestedClassifierScopeWithSubstitutionForSuperType(superType, session) + scopesToAdd.add(scope) + } + } + + session.nestedClassifierScope(firClass)?.let(scopesToAdd::add) + if (firClass is FirRegularClass) { + val companionObject = firClass.companionObjectSymbol?.fir + if (companionObject != null) { + session.nestedClassifierScope(companionObject)?.let(scopesToAdd::add) + } + + addScopes(scopesToAdd) + addTypeParametersScope(firClass) + } else { + addScopes(scopesToAdd) + } + + action() } private fun resolveConstructedTypeRefForDelegatedConstructorCall( delegatedConstructorCall: FirDelegatedConstructorCall ) { - delegatedConstructorCall.replaceConstructedTypeRef( - delegatedConstructorCall.constructedTypeRef.transform(this, null) - ) - + delegatedConstructorCall.replaceConstructedTypeRef(delegatedConstructorCall.constructedTypeRef.transformSingle(this, null)) delegatedConstructorCall.transformCalleeReference(this, null) } - private fun FirMemberDeclaration.addTypeParametersScope() { - if (typeParameters.isNotEmpty()) { - scopes = scopes.add(FirMemberTypeParameterScope(this)) + fun addTypeParametersScope(firMemberDeclaration: FirMemberDeclaration) { + if (firMemberDeclaration.typeParameters.isNotEmpty()) { + scopes = scopes.add(FirMemberTypeParameterScope(firMemberDeclaration)) } } - private fun addScopes(list: List) { + fun addScopes(list: List) { // small optimization to skip unnecessary allocations val scopesAreTheSame = scopes === staticScopes diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirAbstractBodyResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirAbstractBodyResolveTransformer.kt index fda42927deb..1bec1cf736b 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirAbstractBodyResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirAbstractBodyResolveTransformer.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -33,9 +33,6 @@ abstract class FirAbstractBodyResolveTransformer(phase: FirResolvePhase) : FirAb abstract var implicitTypeOnly: Boolean internal set - override val transformerPhase: FirResolvePhase - get() = if (implicitTypeOnly) baseTransformerPhase else FirResolvePhase.BODY_RESOLVE - final override val session: FirSession get() = components.session @OptIn(PrivateForInline::class) @@ -66,7 +63,7 @@ abstract class FirAbstractBodyResolveTransformer(phase: FirResolvePhase) : FirAb protected inline val typeResolverTransformer: FirSpecificTypeResolverTransformer get() = components.typeResolverTransformer protected inline val callResolver: FirCallResolver get() = components.callResolver protected inline val callCompleter: FirCallCompleter get() = components.callCompleter - protected inline val dataFlowAnalyzer: FirDataFlowAnalyzer get() = components.dataFlowAnalyzer + inline val dataFlowAnalyzer: FirDataFlowAnalyzer get() = components.dataFlowAnalyzer protected inline val scopeSession: ScopeSession get() = components.scopeSession protected inline val file: FirFile get() = components.file diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirAbstractBodyResolveTransformerDispatcher.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirAbstractBodyResolveTransformerDispatcher.kt index b06298e7a44..8b6201bea40 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirAbstractBodyResolveTransformerDispatcher.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirAbstractBodyResolveTransformerDispatcher.kt @@ -1,19 +1,27 @@ /* - * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package org.jetbrains.kotlin.fir.resolve.transformers.body.resolve -import org.jetbrains.kotlin.fir.* +import org.jetbrains.kotlin.fir.FirElement +import org.jetbrains.kotlin.fir.FirSession +import org.jetbrains.kotlin.fir.FirTargetElement import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.expressions.* -import org.jetbrains.kotlin.fir.resolve.* +import org.jetbrains.kotlin.fir.render +import org.jetbrains.kotlin.fir.resolve.ResolutionMode +import org.jetbrains.kotlin.fir.resolve.ScopeSession import org.jetbrains.kotlin.fir.resolve.calls.ResolutionContext +import org.jetbrains.kotlin.fir.resolve.createCurrentScopeList import org.jetbrains.kotlin.fir.resolve.dfa.DataFlowAnalyzerContext -import org.jetbrains.kotlin.fir.resolve.transformers.* +import org.jetbrains.kotlin.fir.resolve.transformers.ReturnTypeCalculator +import org.jetbrains.kotlin.fir.resolve.transformers.ReturnTypeCalculatorForFullBodyResolve +import org.jetbrains.kotlin.fir.resolve.transformers.ScopeClassDeclaration import org.jetbrains.kotlin.fir.types.* import org.jetbrains.kotlin.fir.visitors.FirTransformer +import org.jetbrains.kotlin.fir.withFileAnalysisExceptionWrapping abstract class FirAbstractBodyResolveTransformerDispatcher( session: FirSession, @@ -25,6 +33,8 @@ abstract class FirAbstractBodyResolveTransformerDispatcher( val firTowerDataContextCollector: FirTowerDataContextCollector? = null, ) : FirAbstractBodyResolveTransformer(phase) { + open val preserveCFGForClasses: Boolean get() = !implicitTypeOnly + final override val context: BodyResolveContext = outerBodyResolveContext ?: BodyResolveContext(returnTypeCalculator, DataFlowAnalyzerContext(session)) final override val components: BodyResolveTransformerComponents = @@ -32,8 +42,10 @@ abstract class FirAbstractBodyResolveTransformerDispatcher( final override val resolutionContext: ResolutionContext = ResolutionContext(session, components, context) - internal abstract val expressionsTransformer: FirExpressionsResolveTransformer - protected abstract val declarationsTransformer: FirDeclarationsResolveTransformer + abstract val expressionsTransformer: FirExpressionsResolveTransformer + + abstract val declarationsTransformer: FirDeclarationsResolveTransformer + private val controlFlowStatementsTransformer = FirControlFlowStatementsResolveTransformer(this) override fun transformFile(file: FirFile, data: ResolutionMode): FirFile { @@ -194,7 +206,10 @@ abstract class FirAbstractBodyResolveTransformerDispatcher( desugaredAssignmentValueReferenceExpression: FirDesugaredAssignmentValueReferenceExpression, data: ResolutionMode ): FirStatement { - return expressionsTransformer.transformDesugaredAssignmentValueReferenceExpression(desugaredAssignmentValueReferenceExpression, data) + return expressionsTransformer.transformDesugaredAssignmentValueReferenceExpression( + desugaredAssignmentValueReferenceExpression, + data, + ) } override fun transformVariableAssignment( diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt index 33121d3fd52..bfd28a9818f 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirDeclarationsResolveTransformer.kt @@ -535,18 +535,27 @@ open class FirDeclarationsResolveTransformer( return typeAlias } - private fun doTransformRegularClass( + protected fun doTransformRegularClass( regularClass: FirRegularClass, data: ResolutionMode + ): FirRegularClass = withRegularClass(regularClass) { + transformDeclarationContent(regularClass, data) as FirRegularClass + } + + open fun withRegularClass( + regularClass: FirRegularClass, + action: () -> FirRegularClass ): FirRegularClass { - dataFlowAnalyzer.enterClass(regularClass, !implicitTypeOnly) + dataFlowAnalyzer.enterClass(regularClass, buildGraph = transformer.preserveCFGForClasses) val result = context.withRegularClass(regularClass, components) { - transformDeclarationContent(regularClass, data) as FirRegularClass + action() } + val controlFlowGraph = dataFlowAnalyzer.exitClass() if (controlFlowGraph != null) { result.replaceControlFlowGraphReference(FirControlFlowGraphReferenceImpl(controlFlowGraph)) } + return result } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/contracts/FirAbstractContractResolveTransformerDispatcher.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/contracts/FirAbstractContractResolveTransformerDispatcher.kt index 8d98af3956b..d7526e8412e 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/contracts/FirAbstractContractResolveTransformerDispatcher.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/contracts/FirAbstractContractResolveTransformerDispatcher.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -256,10 +256,16 @@ abstract class FirAbstractContractResolveTransformerDispatcher( } override fun transformRegularClass(regularClass: FirRegularClass, data: ResolutionMode): FirStatement { - context.withRegularClass(regularClass, components) { + return withRegularClass(regularClass) { transformDeclarationContent(regularClass, data) + regularClass + } + } + + override fun withRegularClass(regularClass: FirRegularClass, action: () -> FirRegularClass): FirRegularClass { + return context.withRegularClass(regularClass, components) { + action() } - return regularClass } override fun transformAnonymousObject( diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/mpp/FirExpectActualMatcherTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/mpp/FirExpectActualMatcherTransformer.kt index 65b1668efc3..6af0b78aa6a 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/mpp/FirExpectActualMatcherTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/mpp/FirExpectActualMatcherTransformer.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -15,7 +15,6 @@ import org.jetbrains.kotlin.fir.resolve.ScopeSession import org.jetbrains.kotlin.fir.resolve.transformers.FirAbstractTreeTransformer import org.jetbrains.kotlin.fir.resolve.transformers.FirTransformerBasedResolveProcessor import org.jetbrains.kotlin.fir.visitors.FirTransformer -import org.jetbrains.kotlin.resolve.multiplatform.compatible class FirExpectActualMatcherProcessor( session: FirSession, @@ -76,7 +75,7 @@ open class FirExpectActualMatcherTransformer( // ------------------------------------------------------ - private fun transformMemberDeclaration(memberDeclaration: FirMemberDeclaration) { + fun transformMemberDeclaration(memberDeclaration: FirMemberDeclaration) { if (!memberDeclaration.isActual) return val actualSymbol = memberDeclaration.symbol diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/AbstractFirSpecificAnnotationResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/AbstractFirSpecificAnnotationResolveTransformer.kt index 4339925551a..11d5de094c5 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/AbstractFirSpecificAnnotationResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/AbstractFirSpecificAnnotationResolveTransformer.kt @@ -30,7 +30,6 @@ import org.jetbrains.kotlin.fir.scopes.createImportingScopes import org.jetbrains.kotlin.fir.scopes.getProperties import org.jetbrains.kotlin.fir.scopes.getSingleClassifier import org.jetbrains.kotlin.fir.scopes.impl.FirAbstractImportingScope -import org.jetbrains.kotlin.fir.symbols.impl.FirCallableSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirClassSymbol import org.jetbrains.kotlin.fir.symbols.impl.FirEnumEntrySymbol import org.jetbrains.kotlin.fir.types.* @@ -67,10 +66,11 @@ object CompilerRequiredAnnotationsHelper { ) } -internal abstract class AbstractFirSpecificAnnotationResolveTransformer( - protected val session: FirSession, - protected val scopeSession: ScopeSession, - protected val computationSession: CompilerRequiredAnnotationsComputationSession, +@OptIn(PrivateForInline::class) +abstract class AbstractFirSpecificAnnotationResolveTransformer( + @property:PrivateForInline val session: FirSession, + @property:PrivateForInline val scopeSession: ScopeSession, + @property:PrivateForInline val computationSession: CompilerRequiredAnnotationsComputationSession, containingDeclarations: List = emptyList() ) : FirDefaultTransformer() { companion object { @@ -202,8 +202,11 @@ internal abstract class AbstractFirSpecificAnnotationResolveTransformer( @PrivateForInline val argumentsTransformer = FirEnumAnnotationArgumentsTransformerDispatcher() - private var owners: PersistentList = persistentListOf() - private val classDeclarationsStack = ArrayDeque().apply { + @PrivateForInline + var owners: PersistentList = persistentListOf() + + @PrivateForInline + val classDeclarationsStack = ArrayDeque().apply { for (declaration in containingDeclarations) { if (declaration is FirClass) { add(declaration) @@ -211,7 +214,6 @@ internal abstract class AbstractFirSpecificAnnotationResolveTransformer( } } - @OptIn(PrivateForInline::class) override fun transformAnnotationCall(annotationCall: FirAnnotationCall, data: Nothing?): FirStatement { val annotationTypeRef = annotationCall.annotationTypeRef if (annotationTypeRef !is FirUserTypeRef) return annotationCall @@ -277,16 +279,42 @@ internal abstract class AbstractFirSpecificAnnotationResolveTransformer( override fun transformRegularClass(regularClass: FirRegularClass, data: Nothing?): FirStatement { - withClassDeclarationCleanup(classDeclarationsStack, regularClass) { - if (!shouldTransformDeclaration(regularClass)) return regularClass - computationSession.recordThatAnnotationsAreResolved(regularClass) - return transformDeclaration(regularClass, data).also { - val state = beforeTransformingChildren(regularClass) + resolveRegularClass( + regularClass, + transformChildren = { regularClass.transformDeclarations(this, data) regularClass.transformSuperTypeRefs(this, data) - afterTransformingChildren(state) + }, + afterChildrenTransform = { calculateDeprecations(regularClass) - } as FirStatement + } + ) + return regularClass + } + + inline fun resolveRegularClass( + regularClass: FirRegularClass, + transformChildren: () -> Unit, + afterChildrenTransform: () -> Unit + ) { + withRegularClass(regularClass) { + if (!shouldTransformDeclaration(regularClass)) return + computationSession.recordThatAnnotationsAreResolved(regularClass) + transformDeclaration(regularClass, null).also { + transformChildren(regularClass) { + transformChildren() + } + afterChildrenTransform() + } + } + } + + inline fun withRegularClass( + regularClass: FirRegularClass, + action: () -> Unit + ) { + withClassDeclarationCleanup(classDeclarationsStack, regularClass) { + action() } } @@ -309,20 +337,24 @@ internal abstract class AbstractFirSpecificAnnotationResolveTransformer( override fun transformFile(file: FirFile, data: Nothing?): FirFile { if (!shouldTransformDeclaration(file)) return file - return withFile(file) { + withFileAndFileScopes(file) { + file.transformDeclarations(this, data) + } + + return file + } + + fun withFileAndFileScopes(file: FirFile, action: () -> Unit) { + withFile(file) { withFileScopes(file) { scopes = createImportingScopes(file, session, scopeSession, useCaching = false) - val state = beforeTransformingChildren(file) - try { - file.transformDeclarations(this, data) - } finally { - afterTransformingChildren(state) + transformChildren(file) { + action() } } } } - @OptIn(PrivateForInline::class) inline fun withFile(file: FirFile, f: () -> T): T { typeResolverTransformer.withFile(file) { argumentsTransformer.context.withFile(file, argumentsTransformer.components) { @@ -333,7 +365,7 @@ internal abstract class AbstractFirSpecificAnnotationResolveTransformer( } } - private fun calculateDeprecations(classLikeDeclaration: FirClassLikeDeclaration) { + fun calculateDeprecations(classLikeDeclaration: FirClassLikeDeclaration) { if (classLikeDeclaration.deprecationsProvider == UnresolvedDeprecationProvider) { classLikeDeclaration.replaceDeprecationsProvider( classLikeDeclaration.getDeprecationsProvider(session) @@ -341,14 +373,14 @@ internal abstract class AbstractFirSpecificAnnotationResolveTransformer( } } - protected lateinit var scopes: List + lateinit var scopes: List inline fun withFileScopes(file: FirFile, f: () -> T): T { scopes = createImportingScopes(file, session, scopeSession, useCaching = false) return f() } - protected abstract fun shouldTransformDeclaration(declaration: FirDeclaration): Boolean + abstract fun shouldTransformDeclaration(declaration: FirDeclaration): Boolean override fun transformProperty(property: FirProperty, data: Nothing?): FirProperty { if (!shouldTransformDeclaration(property)) return property @@ -363,9 +395,9 @@ internal abstract class AbstractFirSpecificAnnotationResolveTransformer( if (!shouldTransformDeclaration(simpleFunction)) return simpleFunction computationSession.recordThatAnnotationsAreResolved(simpleFunction) return transformDeclaration(simpleFunction, data).also { - val state = beforeTransformingChildren(simpleFunction) - simpleFunction.transformValueParameters(this, data) - afterTransformingChildren(state) + transformChildren(simpleFunction) { + simpleFunction.transformValueParameters(this, data) + } } as FirSimpleFunction } @@ -376,9 +408,9 @@ internal abstract class AbstractFirSpecificAnnotationResolveTransformer( if (!shouldTransformDeclaration(constructor)) return constructor computationSession.recordThatAnnotationsAreResolved(constructor) return transformDeclaration(constructor, data).also { - val state = beforeTransformingChildren(constructor) - constructor.transformValueParameters(this, data) - afterTransformingChildren(state) + transformChildren(constructor) { + constructor.transformValueParameters(this, data) + } } as FirConstructor } @@ -413,7 +445,7 @@ internal abstract class AbstractFirSpecificAnnotationResolveTransformer( * @return Some state of the transformer; when the nested declarations are transformed, this state will be * passed to the [afterTransformingChildren]. */ - private fun beforeTransformingChildren(parentDeclaration: FirDeclaration): PersistentList { + fun beforeTransformingChildren(parentDeclaration: FirDeclaration): PersistentList { val current = owners owners = owners.add(parentDeclaration) return current @@ -426,11 +458,20 @@ internal abstract class AbstractFirSpecificAnnotationResolveTransformer( * * @param state A state produced by the [beforeTransformingChildren] call before the transformation. */ - private fun afterTransformingChildren(state: PersistentList?) { + fun afterTransformingChildren(state: PersistentList?) { requireNotNull(state) owners = state } + inline fun transformChildren(parentDeclaration: FirDeclaration, action: () -> R): R { + val state = beforeTransformingChildren(parentDeclaration) + try { + return action() + } finally { + afterTransformingChildren(state) + } + } + private fun FirUserTypeRef.createDeepCopy(): FirUserTypeRef { val original = this return buildUserTypeRef { diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/FirAnnotationArgumentsMappingTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/FirAnnotationArgumentsMappingTransformer.kt index 0d77fee6559..2405ff9b178 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/FirAnnotationArgumentsMappingTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/FirAnnotationArgumentsMappingTransformer.kt @@ -1,34 +1,87 @@ /* - * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ package org.jetbrains.kotlin.fir.resolve.transformers.plugin import org.jetbrains.kotlin.fir.FirSession +import org.jetbrains.kotlin.fir.PrivateForInline import org.jetbrains.kotlin.fir.declarations.* +import org.jetbrains.kotlin.fir.expressions.FirAnnotationCall +import org.jetbrains.kotlin.fir.expressions.FirErrorAnnotationCall import org.jetbrains.kotlin.fir.expressions.FirStatement import org.jetbrains.kotlin.fir.resolve.ResolutionMode import org.jetbrains.kotlin.fir.resolve.ScopeSession -import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.* +import org.jetbrains.kotlin.fir.resolve.transformers.ReturnTypeCalculator +import org.jetbrains.kotlin.fir.resolve.transformers.ReturnTypeCalculatorForFullBodyResolve +import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.BodyResolveContext +import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirAbstractBodyResolveTransformerDispatcher +import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirDeclarationsResolveTransformer +import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirExpressionsResolveTransformer +import org.jetbrains.kotlin.fir.types.FirTypeRef +import org.jetbrains.kotlin.fir.visitors.transformSingle open class FirAnnotationArgumentsMappingTransformer( session: FirSession, scopeSession: ScopeSession, resolvePhase: FirResolvePhase, - outerBodyResolveContext: BodyResolveContext? = null + outerBodyResolveContext: BodyResolveContext? = null, + returnTypeCalculator: ReturnTypeCalculator = ReturnTypeCalculatorForFullBodyResolve, ) : FirAbstractBodyResolveTransformerDispatcher( session, resolvePhase, implicitTypeOnly = false, scopeSession, - outerBodyResolveContext = outerBodyResolveContext + outerBodyResolveContext = outerBodyResolveContext, + returnTypeCalculator = returnTypeCalculator, ) { final override val expressionsTransformer: FirExpressionsResolveTransformer = - FirExpressionsResolveTransformer(this) + FirExpressionTransformerForAnnotationArgumentsMapping(this) - final override val declarationsTransformer: FirDeclarationsResolveTransformer = + private val declarationsResolveTransformerForAnnotationArgumentsMapping = FirDeclarationsResolveTransformerForAnnotationArgumentsMapping(this) + + private val usualDeclarationTransformer = FirDeclarationsResolveTransformer(this) + + @PrivateForInline + var isInsideAnnotationArgument = false + + @OptIn(PrivateForInline::class) + inline fun insideAnnotationArgument(action: () -> R): R { + val oldValue = this.isInsideAnnotationArgument + isInsideAnnotationArgument = true + try { + return action() + } finally { + isInsideAnnotationArgument = oldValue + } + } + + @OptIn(PrivateForInline::class) + final override val declarationsTransformer: FirDeclarationsResolveTransformer + get() { + return if (isInsideAnnotationArgument) usualDeclarationTransformer + else declarationsResolveTransformerForAnnotationArgumentsMapping + } +} + +private class FirExpressionTransformerForAnnotationArgumentsMapping( + private val annotationArgumentsMappingTransformer: FirAnnotationArgumentsMappingTransformer, +) : FirExpressionsResolveTransformer(annotationArgumentsMappingTransformer) { + + override fun transformAnnotationCall(annotationCall: FirAnnotationCall, data: ResolutionMode): FirStatement { + annotationArgumentsMappingTransformer.insideAnnotationArgument { + return super.transformAnnotationCall(annotationCall, data) + } + } + + override fun transformErrorAnnotationCall(errorAnnotationCall: FirErrorAnnotationCall, data: ResolutionMode): FirStatement { + annotationArgumentsMappingTransformer.insideAnnotationArgument { + return super.transformErrorAnnotationCall(errorAnnotationCall, data) + } + } + } private class FirDeclarationsResolveTransformerForAnnotationArgumentsMapping( @@ -37,14 +90,18 @@ private class FirDeclarationsResolveTransformerForAnnotationArgumentsMapping( override fun transformRegularClass(regularClass: FirRegularClass, data: ResolutionMode): FirStatement { regularClass.transformAnnotations(this, data) doTransformTypeParameters(regularClass) + regularClass.transformSuperTypeRefs(this, data) - context.withContainingClass(regularClass) { + doTransformRegularClass(regularClass, data) + return regularClass + } + + override fun withRegularClass(regularClass: FirRegularClass, action: () -> FirRegularClass): FirRegularClass { + return context.withContainingClass(regularClass) { context.withRegularClass(regularClass, components) { - transformDeclarationContent(regularClass, data) as FirRegularClass + action() } } - - return regularClass } override fun transformAnonymousInitializer( @@ -158,6 +215,8 @@ private class FirDeclarationsResolveTransformerForAnnotationArgumentsMapping( override fun transformTypeAlias(typeAlias: FirTypeAlias, data: ResolutionMode): FirTypeAlias { doTransformTypeParameters(typeAlias) typeAlias.transformAnnotations(transformer, data) + transformer.firTowerDataContextCollector?.addDeclarationContext(typeAlias, context.towerDataContext) + typeAlias.expandedTypeRef.transformSingle(transformer, data) return typeAlias } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/FirAnnotationArgumentsResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/FirAnnotationArgumentsResolveTransformer.kt index 8b171f910d0..71c050811ef 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/FirAnnotationArgumentsResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/FirAnnotationArgumentsResolveTransformer.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -19,11 +19,15 @@ import org.jetbrains.kotlin.fir.references.builder.buildSimpleNamedReference import org.jetbrains.kotlin.fir.references.toResolvedBaseSymbol import org.jetbrains.kotlin.fir.resolve.ResolutionMode import org.jetbrains.kotlin.fir.resolve.ScopeSession -import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeAmbiguouslyResolvedAnnotationArgument +import org.jetbrains.kotlin.fir.resolve.transformers.ReturnTypeCalculator +import org.jetbrains.kotlin.fir.resolve.transformers.ReturnTypeCalculatorForFullBodyResolve import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.BodyResolveContext import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirAbstractBodyResolveTransformerDispatcher import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirDeclarationsResolveTransformer import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.FirExpressionsResolveTransformer +import org.jetbrains.kotlin.fir.types.FirTypeRef +import org.jetbrains.kotlin.fir.visitors.transformSingle +import org.jetbrains.kotlin.fir.resolve.diagnostics.ConeAmbiguouslyResolvedAnnotationArgument import org.jetbrains.kotlin.fir.symbols.impl.FirEnumEntrySymbol import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.StandardClassIds @@ -32,17 +36,21 @@ open class FirAnnotationArgumentsResolveTransformer( session: FirSession, scopeSession: ScopeSession, resolvePhase: FirResolvePhase, - outerBodyResolveContext: BodyResolveContext? = null + outerBodyResolveContext: BodyResolveContext? = null, + returnTypeCalculator: ReturnTypeCalculator = ReturnTypeCalculatorForFullBodyResolve, ) : FirAbstractBodyResolveTransformerDispatcher( session, resolvePhase, implicitTypeOnly = false, scopeSession, - outerBodyResolveContext = outerBodyResolveContext + outerBodyResolveContext = outerBodyResolveContext, + returnTypeCalculator = returnTypeCalculator, ) { - final override val expressionsTransformer: FirExpressionsResolveTransformer = FirExpressionsResolveTransformerForSpecificAnnotations(this) + final override val expressionsTransformer: FirExpressionsResolveTransformer = + FirExpressionsResolveTransformerForSpecificAnnotations(this) - final override val declarationsTransformer: FirDeclarationsResolveTransformer = FirDeclarationsResolveTransformerForArgumentAnnotations(this) + final override val declarationsTransformer: FirDeclarationsResolveTransformer = + FirDeclarationsResolveTransformerForArgumentAnnotations(this) } private class FirDeclarationsResolveTransformerForArgumentAnnotations( @@ -50,15 +58,22 @@ private class FirDeclarationsResolveTransformerForArgumentAnnotations( ) : FirDeclarationsResolveTransformer(transformer) { override fun transformRegularClass(regularClass: FirRegularClass, data: ResolutionMode): FirStatement { regularClass.transformAnnotations(this, data) - context.withContainingClass(regularClass) { + withRegularClass(regularClass) { + regularClass + .transformTypeParameters(transformer, data) + .transformSuperTypeRefs(transformer, data) + .transformDeclarations(transformer, data) + } + + return regularClass + } + + override fun withRegularClass(regularClass: FirRegularClass, action: () -> FirRegularClass): FirRegularClass { + return context.withContainingClass(regularClass) { context.withRegularClass(regularClass, components) { - regularClass - .transformTypeParameters(transformer, data) - .transformSuperTypeRefs(transformer, data) - .transformDeclarations(transformer, data) + action() } } - return regularClass } override fun transformAnonymousInitializer( @@ -145,6 +160,7 @@ private class FirDeclarationsResolveTransformerForArgumentAnnotations( override fun transformTypeAlias(typeAlias: FirTypeAlias, data: ResolutionMode): FirTypeAlias { typeAlias.transformAnnotations(transformer, data) + typeAlias.expandedTypeRef.transformSingle(transformer, data) return typeAlias } diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/FirCompanionGenerationProcessor.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/FirCompanionGenerationProcessor.kt index 6c23ac8f374..76a9ba68fb0 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/FirCompanionGenerationProcessor.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/FirCompanionGenerationProcessor.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -7,7 +7,10 @@ package org.jetbrains.kotlin.fir.resolve.transformers.plugin import org.jetbrains.kotlin.fir.FirElement import org.jetbrains.kotlin.fir.FirSession -import org.jetbrains.kotlin.fir.declarations.* +import org.jetbrains.kotlin.fir.declarations.FirClassLikeDeclaration +import org.jetbrains.kotlin.fir.declarations.FirFile +import org.jetbrains.kotlin.fir.declarations.FirRegularClass +import org.jetbrains.kotlin.fir.declarations.FirResolvePhase import org.jetbrains.kotlin.fir.declarations.utils.classId import org.jetbrains.kotlin.fir.declarations.utils.isLocal import org.jetbrains.kotlin.fir.expressions.FirStatement @@ -22,7 +25,6 @@ import org.jetbrains.kotlin.fir.symbols.impl.FirRegularClassSymbol import org.jetbrains.kotlin.fir.visitors.FirTransformer import org.jetbrains.kotlin.fir.visitors.transformSingle import org.jetbrains.kotlin.fir.withFileAnalysisExceptionWrapping -import org.jetbrains.kotlin.name.SpecialNames import org.jetbrains.kotlin.name.SpecialNames.DEFAULT_NAME_FOR_COMPANION_OBJECT class FirCompanionGenerationProcessor( @@ -49,11 +51,15 @@ class FirCompanionGenerationTransformer(val session: FirSession) : FirTransforme } override fun transformRegularClass(regularClass: FirRegularClass, data: Nothing?): FirStatement { + generateAndUpdateCompanion(regularClass) + return regularClass.transformDeclarations(this, data) + } + + fun generateAndUpdateCompanion(regularClass: FirRegularClass) { val companionSymbol = generateCompanion(regularClass) if (companionSymbol != null) { regularClass.replaceCompanionObjectSymbol(companionSymbol) } - return regularClass.transformDeclarations(this, data) } private fun generateCompanion(regularClass: FirRegularClass): FirRegularClassSymbol? { @@ -65,6 +71,7 @@ class FirCompanionGenerationTransformer(val session: FirSession) : FirTransforme result = it } } + result } else { val companionClassId = regularClass.classId.createNestedClassId(DEFAULT_NAME_FOR_COMPANION_OBJECT) diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/FirCompilerRequiredAnnotationsResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/FirCompilerRequiredAnnotationsResolveTransformer.kt index fa2f99c7389..61dc7af20c7 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/FirCompilerRequiredAnnotationsResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/plugin/FirCompilerRequiredAnnotationsResolveTransformer.kt @@ -1,5 +1,5 @@ /* - * Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. */ @@ -7,19 +7,24 @@ package org.jetbrains.kotlin.fir.resolve.transformers.plugin import org.jetbrains.kotlin.fir.FirElement import org.jetbrains.kotlin.fir.FirSession +import org.jetbrains.kotlin.fir.PrivateForInline import org.jetbrains.kotlin.fir.SessionConfiguration import org.jetbrains.kotlin.fir.declarations.* import org.jetbrains.kotlin.fir.declarations.FirResolvePhase.COMPILER_REQUIRED_ANNOTATIONS import org.jetbrains.kotlin.fir.expressions.FirStatement -import org.jetbrains.kotlin.fir.extensions.* +import org.jetbrains.kotlin.fir.extensions.extensionService +import org.jetbrains.kotlin.fir.extensions.generatedDeclarationsSymbolProvider +import org.jetbrains.kotlin.fir.extensions.registeredPluginAnnotations import org.jetbrains.kotlin.fir.resolve.ScopeSession import org.jetbrains.kotlin.fir.resolve.providers.FirSymbolProvider import org.jetbrains.kotlin.fir.resolve.providers.FirSymbolProviderInternals import org.jetbrains.kotlin.fir.resolve.providers.impl.FirCachingCompositeSymbolProvider import org.jetbrains.kotlin.fir.resolve.providers.symbolProvider -import org.jetbrains.kotlin.fir.resolve.transformers.* import org.jetbrains.kotlin.fir.resolve.transformers.body.resolve.LocalClassesNavigationInfo -import org.jetbrains.kotlin.fir.types.* +import org.jetbrains.kotlin.fir.resolve.transformers.DesignationState +import org.jetbrains.kotlin.fir.resolve.transformers.FirAbstractPhaseTransformer +import org.jetbrains.kotlin.fir.resolve.transformers.FirGlobalResolveProcessor +import org.jetbrains.kotlin.fir.resolve.transformers.FirImportResolveTransformer import org.jetbrains.kotlin.fir.visitors.transformSingle import org.jetbrains.kotlin.fir.withFileAnalysisExceptionWrapping import org.jetbrains.kotlin.name.FqName @@ -67,7 +72,7 @@ abstract class AbstractFirCompilerRequiredAnnotationsResolveTransformer( final override val session: FirSession, computationSession: CompilerRequiredAnnotationsComputationSession ) : FirAbstractPhaseTransformer(COMPILER_REQUIRED_ANNOTATIONS) { - internal abstract val annotationTransformer: AbstractFirSpecificAnnotationResolveTransformer + abstract val annotationTransformer: AbstractFirSpecificAnnotationResolveTransformer private val importTransformer = FirPartialImportResolveTransformer(session, computationSession) val extensionService = session.extensionService @@ -167,12 +172,13 @@ private class FirPartialImportResolveTransformer( } } -private class FirSpecificAnnotationResolveTransformer( +class FirSpecificAnnotationResolveTransformer( session: FirSession, scopeSession: ScopeSession, computationSession: CompilerRequiredAnnotationsComputationSession ) : AbstractFirSpecificAnnotationResolveTransformer(session, scopeSession, computationSession) { override fun shouldTransformDeclaration(declaration: FirDeclaration): Boolean { + @OptIn(PrivateForInline::class) return !computationSession.annotationsAreResolved(declaration) } } diff --git a/compiler/testData/diagnostics/tests/AnonymousInitializerVarAndConstructor.kt b/compiler/testData/diagnostics/tests/AnonymousInitializerVarAndConstructor.kt index 843f309ff7a..34b70b7c831 100644 --- a/compiler/testData/diagnostics/tests/AnonymousInitializerVarAndConstructor.kt +++ b/compiler/testData/diagnostics/tests/AnonymousInitializerVarAndConstructor.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // http://youtrack.jetbrains.net/issue/KT-419 diff --git a/compiler/testData/diagnostics/tests/AnonymousInitializers.kt b/compiler/testData/diagnostics/tests/AnonymousInitializers.kt index 7e46c4fd67e..a4d7e84ce95 100644 --- a/compiler/testData/diagnostics/tests/AnonymousInitializers.kt +++ b/compiler/testData/diagnostics/tests/AnonymousInitializers.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL interface NoC { init { diff --git a/compiler/testData/diagnostics/tests/BacktickNames.kt b/compiler/testData/diagnostics/tests/BacktickNames.kt index 21309baf7b2..064ed03ceab 100644 --- a/compiler/testData/diagnostics/tests/BacktickNames.kt +++ b/compiler/testData/diagnostics/tests/BacktickNames.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -UNUSED_ANONYMOUS_PARAMETER // TODO Uncomment all the examples when there will be no problems with light classes diff --git a/compiler/testData/diagnostics/tests/UnusedParameters.fir.kt b/compiler/testData/diagnostics/tests/UnusedParameters.fir.kt index ae593e35158..5fc389588e2 100644 --- a/compiler/testData/diagnostics/tests/UnusedParameters.fir.kt +++ b/compiler/testData/diagnostics/tests/UnusedParameters.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: +UNUSED_PARAMETER import kotlin.reflect.KProperty diff --git a/compiler/testData/diagnostics/tests/UnusedParameters.kt b/compiler/testData/diagnostics/tests/UnusedParameters.kt index 4640e67d750..881d669d07b 100644 --- a/compiler/testData/diagnostics/tests/UnusedParameters.kt +++ b/compiler/testData/diagnostics/tests/UnusedParameters.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: +UNUSED_PARAMETER import kotlin.reflect.KProperty diff --git a/compiler/testData/diagnostics/tests/UnusedVariables.fir.kt b/compiler/testData/diagnostics/tests/UnusedVariables.fir.kt index e5f6fdb375e..e85563ff10a 100644 --- a/compiler/testData/diagnostics/tests/UnusedVariables.fir.kt +++ b/compiler/testData/diagnostics/tests/UnusedVariables.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: +UNUSED_VALUE, +UNUSED_CHANGED_VALUE, +UNUSED_PARAMETER, +UNUSED_VARIABLE package unused_variables diff --git a/compiler/testData/diagnostics/tests/UnusedVariables.kt b/compiler/testData/diagnostics/tests/UnusedVariables.kt index 10913ae68c1..7e9de849969 100644 --- a/compiler/testData/diagnostics/tests/UnusedVariables.kt +++ b/compiler/testData/diagnostics/tests/UnusedVariables.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: +UNUSED_VALUE, +UNUSED_CHANGED_VALUE, +UNUSED_PARAMETER, +UNUSED_VARIABLE package unused_variables diff --git a/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_15.fir.kt b/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_15.fir.kt index 12f320d7eac..a8af099615e 100644 --- a/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_15.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_15.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: -ClassTypeParameterAnnotations @Target(AnnotationTarget.TYPE_PARAMETER) annotation class A1 diff --git a/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_15.kt b/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_15.kt index 46e66c07735..d18a863ca09 100644 --- a/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_15.kt +++ b/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_15.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: -ClassTypeParameterAnnotations @Target(AnnotationTarget.TYPE_PARAMETER) annotation class A1 diff --git a/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_16.fir.kt b/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_16.fir.kt index 5920cc2c08b..5a5c24f05f4 100644 --- a/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_16.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_16.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: +ClassTypeParameterAnnotations annotation class A1 annotation class A2(val some: Int = 12) diff --git a/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_16.kt b/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_16.kt index 5a6e675a575..9609940be74 100644 --- a/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_16.kt +++ b/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_16.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: +ClassTypeParameterAnnotations annotation class A1 annotation class A2(val some: Int = 12) diff --git a/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_typeUseFlag.fir.kt b/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_typeUseFlag.fir.kt index a6d1dbd7898..712294271fb 100644 --- a/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_typeUseFlag.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_typeUseFlag.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: +ProperCheckAnnotationsTargetInTypeUsePositions -ClassTypeParameterAnnotations annotation class A1 diff --git a/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_typeUseFlag.kt b/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_typeUseFlag.kt index 1f9f1aa665b..d4f93f004da 100644 --- a/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_typeUseFlag.kt +++ b/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_typeUseFlag.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: +ProperCheckAnnotationsTargetInTypeUsePositions -ClassTypeParameterAnnotations annotation class A1 diff --git a/compiler/testData/diagnostics/tests/annotations/kt1886annotationBody_after.kt b/compiler/testData/diagnostics/tests/annotations/kt1886annotationBody_after.kt index 27a7c423242..c979c7ed8f5 100644 --- a/compiler/testData/diagnostics/tests/annotations/kt1886annotationBody_after.kt +++ b/compiler/testData/diagnostics/tests/annotations/kt1886annotationBody_after.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // !LANGUAGE: +NestedClassesInAnnotations diff --git a/compiler/testData/diagnostics/tests/annotations/kt1886annotationBody_before.fir.kt b/compiler/testData/diagnostics/tests/annotations/kt1886annotationBody_before.fir.kt index 16ffdc79cff..4d6bebd4ced 100644 --- a/compiler/testData/diagnostics/tests/annotations/kt1886annotationBody_before.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/kt1886annotationBody_before.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: -NestedClassesInAnnotations annotation class Annotation2() { diff --git a/compiler/testData/diagnostics/tests/annotations/kt1886annotationBody_before.kt b/compiler/testData/diagnostics/tests/annotations/kt1886annotationBody_before.kt index a32b7240729..b8d0118a25c 100644 --- a/compiler/testData/diagnostics/tests/annotations/kt1886annotationBody_before.kt +++ b/compiler/testData/diagnostics/tests/annotations/kt1886annotationBody_before.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: -NestedClassesInAnnotations annotation class Annotation2() { diff --git a/compiler/testData/diagnostics/tests/annotations/nestedClassesInAnnotations.kt b/compiler/testData/diagnostics/tests/annotations/nestedClassesInAnnotations.kt index 20335210db6..14801a4af9a 100644 --- a/compiler/testData/diagnostics/tests/annotations/nestedClassesInAnnotations.kt +++ b/compiler/testData/diagnostics/tests/annotations/nestedClassesInAnnotations.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // !LANGUAGE: +NestedClassesInAnnotations diff --git a/compiler/testData/diagnostics/tests/annotations/onInitializer.fir.kt b/compiler/testData/diagnostics/tests/annotations/onInitializer.fir.kt index a951ac85cb2..ae9955da41e 100644 --- a/compiler/testData/diagnostics/tests/annotations/onInitializer.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/onInitializer.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class A { @ann init {} @aaa init {} diff --git a/compiler/testData/diagnostics/tests/annotations/onInitializer.kt b/compiler/testData/diagnostics/tests/annotations/onInitializer.kt index 20b5e769187..355fdd3cec3 100644 --- a/compiler/testData/diagnostics/tests/annotations/onInitializer.kt +++ b/compiler/testData/diagnostics/tests/annotations/onInitializer.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class A { @ann init {} @aaa init {} diff --git a/compiler/testData/diagnostics/tests/annotations/options/targets/init.fir.kt b/compiler/testData/diagnostics/tests/annotations/options/targets/init.fir.kt index 0a92f60c9a9..b69a5251d59 100644 --- a/compiler/testData/diagnostics/tests/annotations/options/targets/init.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/options/targets/init.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE annotation class base @base class My { diff --git a/compiler/testData/diagnostics/tests/annotations/options/targets/init.kt b/compiler/testData/diagnostics/tests/annotations/options/targets/init.kt index 99f24bbec10..a213d178a1d 100644 --- a/compiler/testData/diagnostics/tests/annotations/options/targets/init.kt +++ b/compiler/testData/diagnostics/tests/annotations/options/targets/init.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE annotation class base @base class My { diff --git a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/gt.kt b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/gt.kt index 2718049055a..be2e5ebe2ab 100644 --- a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/gt.kt +++ b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/gt.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // !LANGUAGE: -ProhibitSimplificationOfNonTrivialConstBooleanExpressions package test diff --git a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/lt.kt b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/lt.kt index 61e011aa204..6e09f6bb613 100644 --- a/compiler/testData/diagnostics/tests/annotations/parameters/expressions/lt.kt +++ b/compiler/testData/diagnostics/tests/annotations/parameters/expressions/lt.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // !LANGUAGE: -ProhibitSimplificationOfNonTrivialConstBooleanExpressions package test diff --git a/compiler/testData/diagnostics/tests/backingField/InitCustomSetter.fir.kt b/compiler/testData/diagnostics/tests/backingField/InitCustomSetter.fir.kt index 4b154c6343f..c39035d89e1 100644 --- a/compiler/testData/diagnostics/tests/backingField/InitCustomSetter.fir.kt +++ b/compiler/testData/diagnostics/tests/backingField/InitCustomSetter.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class My(val v: Int) { // Ok: setter is just private var x: Int diff --git a/compiler/testData/diagnostics/tests/backingField/InitCustomSetter.kt b/compiler/testData/diagnostics/tests/backingField/InitCustomSetter.kt index e69b91037b7..11c04fa4808 100644 --- a/compiler/testData/diagnostics/tests/backingField/InitCustomSetter.kt +++ b/compiler/testData/diagnostics/tests/backingField/InitCustomSetter.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class My(val v: Int) { // Ok: setter is just private var x: Int diff --git a/compiler/testData/diagnostics/tests/backingField/InitOpenSetter.fir.kt b/compiler/testData/diagnostics/tests/backingField/InitOpenSetter.fir.kt index 2f646c87b66..bbc5ecea2c8 100644 --- a/compiler/testData/diagnostics/tests/backingField/InitOpenSetter.fir.kt +++ b/compiler/testData/diagnostics/tests/backingField/InitOpenSetter.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE abstract class My(val v: Int) { // Ok: variable is just abstract abstract var x: Int diff --git a/compiler/testData/diagnostics/tests/backingField/InitOpenSetter.kt b/compiler/testData/diagnostics/tests/backingField/InitOpenSetter.kt index 628c6d27d2d..b708cdd35d7 100644 --- a/compiler/testData/diagnostics/tests/backingField/InitOpenSetter.kt +++ b/compiler/testData/diagnostics/tests/backingField/InitOpenSetter.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE abstract class My(val v: Int) { // Ok: variable is just abstract abstract var x: Int diff --git a/compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax3.fir.kt b/compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax3.fir.kt index 08962c867a3..42cc0877a3d 100644 --- a/compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax3.fir.kt +++ b/compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax3.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_VARIABLE package test diff --git a/compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax3.kt b/compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax3.kt index 524fbd30d70..7ffa2ef0e6a 100644 --- a/compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax3.kt +++ b/compiler/testData/diagnostics/tests/callableReference/bound/reservedExpressionSyntax3.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_VARIABLE package test diff --git a/compiler/testData/diagnostics/tests/callableReference/kt7430_wrongClassOnLHS.kt b/compiler/testData/diagnostics/tests/callableReference/kt7430_wrongClassOnLHS.kt index e00891d749f..d0c9efc77e5 100644 --- a/compiler/testData/diagnostics/tests/callableReference/kt7430_wrongClassOnLHS.kt +++ b/compiler/testData/diagnostics/tests/callableReference/kt7430_wrongClassOnLHS.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_EXPRESSION diff --git a/compiler/testData/diagnostics/tests/callableReference/property/genericClass.kt b/compiler/testData/diagnostics/tests/callableReference/property/genericClass.kt index 4e7b6416d66..94a01d13be1 100644 --- a/compiler/testData/diagnostics/tests/callableReference/property/genericClass.kt +++ b/compiler/testData/diagnostics/tests/callableReference/property/genericClass.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // !CHECK_TYPE diff --git a/compiler/testData/diagnostics/tests/classLiteral/inAnnotationArguments.kt b/compiler/testData/diagnostics/tests/classLiteral/inAnnotationArguments.kt index 9b7c48d2870..7bb6e4c4ecd 100644 --- a/compiler/testData/diagnostics/tests/classLiteral/inAnnotationArguments.kt +++ b/compiler/testData/diagnostics/tests/classLiteral/inAnnotationArguments.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // !LANGUAGE: +ProhibitTypeParametersInClassLiteralsInAnnotationArguments diff --git a/compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotation.fir.kt b/compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotation.fir.kt index 0bc708bf99d..7f72e048a44 100644 --- a/compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotation.fir.kt +++ b/compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotation.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE annotation class Foo(val a: IntArray, val b: Array, val c: FloatArray) @Foo([1], ["/"], [1f]) diff --git a/compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotation.kt b/compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotation.kt index 39c237f365d..d4736a8b08c 100644 --- a/compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotation.kt +++ b/compiler/testData/diagnostics/tests/collectionLiterals/argumentsOfAnnotation.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE annotation class Foo(val a: IntArray, val b: Array, val c: FloatArray) @Foo([1], ["/"], [1f]) diff --git a/compiler/testData/diagnostics/tests/constructorConsistency/backing.fir.kt b/compiler/testData/diagnostics/tests/constructorConsistency/backing.fir.kt index bb90d2a6151..57e7fa3c18a 100644 --- a/compiler/testData/diagnostics/tests/constructorConsistency/backing.fir.kt +++ b/compiler/testData/diagnostics/tests/constructorConsistency/backing.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class My { var x = 1 set(value) { diff --git a/compiler/testData/diagnostics/tests/constructorConsistency/backing.kt b/compiler/testData/diagnostics/tests/constructorConsistency/backing.kt index 7e4b30e2ce9..5104d0fe633 100644 --- a/compiler/testData/diagnostics/tests/constructorConsistency/backing.kt +++ b/compiler/testData/diagnostics/tests/constructorConsistency/backing.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class My { var x = 1 set(value) { diff --git a/compiler/testData/diagnostics/tests/constructorConsistency/basic.fir.kt b/compiler/testData/diagnostics/tests/constructorConsistency/basic.fir.kt index a3723ed6b86..48bfe299b62 100644 --- a/compiler/testData/diagnostics/tests/constructorConsistency/basic.fir.kt +++ b/compiler/testData/diagnostics/tests/constructorConsistency/basic.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class My { val x: String diff --git a/compiler/testData/diagnostics/tests/constructorConsistency/basic.kt b/compiler/testData/diagnostics/tests/constructorConsistency/basic.kt index b09c59a377d..3604dc9041c 100644 --- a/compiler/testData/diagnostics/tests/constructorConsistency/basic.kt +++ b/compiler/testData/diagnostics/tests/constructorConsistency/basic.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class My { val x: String diff --git a/compiler/testData/diagnostics/tests/constructorConsistency/derivedProperty.fir.kt b/compiler/testData/diagnostics/tests/constructorConsistency/derivedProperty.fir.kt index 2f152e17ec5..be7f6b0fc58 100644 --- a/compiler/testData/diagnostics/tests/constructorConsistency/derivedProperty.fir.kt +++ b/compiler/testData/diagnostics/tests/constructorConsistency/derivedProperty.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE interface Base { val x: Int } diff --git a/compiler/testData/diagnostics/tests/constructorConsistency/derivedProperty.kt b/compiler/testData/diagnostics/tests/constructorConsistency/derivedProperty.kt index c47c4ad448e..ad5f9d89b89 100644 --- a/compiler/testData/diagnostics/tests/constructorConsistency/derivedProperty.kt +++ b/compiler/testData/diagnostics/tests/constructorConsistency/derivedProperty.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE interface Base { val x: Int } diff --git a/compiler/testData/diagnostics/tests/constructorConsistency/getset.fir.kt b/compiler/testData/diagnostics/tests/constructorConsistency/getset.fir.kt index f41ba5a63b9..49468747f35 100644 --- a/compiler/testData/diagnostics/tests/constructorConsistency/getset.fir.kt +++ b/compiler/testData/diagnostics/tests/constructorConsistency/getset.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class My(var x: String) { var y: String diff --git a/compiler/testData/diagnostics/tests/constructorConsistency/getset.kt b/compiler/testData/diagnostics/tests/constructorConsistency/getset.kt index dc459d53d46..609c67029fb 100644 --- a/compiler/testData/diagnostics/tests/constructorConsistency/getset.kt +++ b/compiler/testData/diagnostics/tests/constructorConsistency/getset.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class My(var x: String) { var y: String diff --git a/compiler/testData/diagnostics/tests/constructorConsistency/init.fir.kt b/compiler/testData/diagnostics/tests/constructorConsistency/init.fir.kt index 84f27db5ae9..e64714ea474 100644 --- a/compiler/testData/diagnostics/tests/constructorConsistency/init.fir.kt +++ b/compiler/testData/diagnostics/tests/constructorConsistency/init.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class My { val x: String diff --git a/compiler/testData/diagnostics/tests/constructorConsistency/init.kt b/compiler/testData/diagnostics/tests/constructorConsistency/init.kt index e556ca0a686..11115d5449f 100644 --- a/compiler/testData/diagnostics/tests/constructorConsistency/init.kt +++ b/compiler/testData/diagnostics/tests/constructorConsistency/init.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class My { val x: String diff --git a/compiler/testData/diagnostics/tests/constructorConsistency/initializerWithSecondaryConstructor.kt b/compiler/testData/diagnostics/tests/constructorConsistency/initializerWithSecondaryConstructor.kt index 400ec552db7..f573b5143bd 100644 --- a/compiler/testData/diagnostics/tests/constructorConsistency/initializerWithSecondaryConstructor.kt +++ b/compiler/testData/diagnostics/tests/constructorConsistency/initializerWithSecondaryConstructor.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL private const val A = 0L diff --git a/compiler/testData/diagnostics/tests/constructorConsistency/initwithgetter.fir.kt b/compiler/testData/diagnostics/tests/constructorConsistency/initwithgetter.fir.kt index 51e60858a01..87577c486b1 100644 --- a/compiler/testData/diagnostics/tests/constructorConsistency/initwithgetter.fir.kt +++ b/compiler/testData/diagnostics/tests/constructorConsistency/initwithgetter.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class My { val x: Int get() = field + if (z != "") 1 else 0 diff --git a/compiler/testData/diagnostics/tests/constructorConsistency/initwithgetter.kt b/compiler/testData/diagnostics/tests/constructorConsistency/initwithgetter.kt index 5d82428266e..c8cf0307f2c 100644 --- a/compiler/testData/diagnostics/tests/constructorConsistency/initwithgetter.kt +++ b/compiler/testData/diagnostics/tests/constructorConsistency/initwithgetter.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class My { val x: Int get() = field + if (z != "") 1 else 0 diff --git a/compiler/testData/diagnostics/tests/constructorConsistency/inspection.fir.kt b/compiler/testData/diagnostics/tests/constructorConsistency/inspection.fir.kt index 24809d5e1e7..deb9cb25b2b 100644 --- a/compiler/testData/diagnostics/tests/constructorConsistency/inspection.fir.kt +++ b/compiler/testData/diagnostics/tests/constructorConsistency/inspection.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class First { val x: String diff --git a/compiler/testData/diagnostics/tests/constructorConsistency/inspection.kt b/compiler/testData/diagnostics/tests/constructorConsistency/inspection.kt index 9c0760bba25..91c74f34021 100644 --- a/compiler/testData/diagnostics/tests/constructorConsistency/inspection.kt +++ b/compiler/testData/diagnostics/tests/constructorConsistency/inspection.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class First { val x: String diff --git a/compiler/testData/diagnostics/tests/constructorConsistency/lateInit.kt b/compiler/testData/diagnostics/tests/constructorConsistency/lateInit.kt index b39128fd8e8..763dd18d82c 100644 --- a/compiler/testData/diagnostics/tests/constructorConsistency/lateInit.kt +++ b/compiler/testData/diagnostics/tests/constructorConsistency/lateInit.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL class WithLateInit { lateinit var x: String diff --git a/compiler/testData/diagnostics/tests/constructorConsistency/nobacking.kt b/compiler/testData/diagnostics/tests/constructorConsistency/nobacking.kt index d92a5909a7c..f52e83040f8 100644 --- a/compiler/testData/diagnostics/tests/constructorConsistency/nobacking.kt +++ b/compiler/testData/diagnostics/tests/constructorConsistency/nobacking.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL class My { diff --git a/compiler/testData/diagnostics/tests/constructorConsistency/open.fir.kt b/compiler/testData/diagnostics/tests/constructorConsistency/open.fir.kt index a208d1f5040..2917319c9ad 100644 --- a/compiler/testData/diagnostics/tests/constructorConsistency/open.fir.kt +++ b/compiler/testData/diagnostics/tests/constructorConsistency/open.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE open class Base { init { register(this) diff --git a/compiler/testData/diagnostics/tests/constructorConsistency/open.kt b/compiler/testData/diagnostics/tests/constructorConsistency/open.kt index f23c2d2b262..355dfca1cce 100644 --- a/compiler/testData/diagnostics/tests/constructorConsistency/open.kt +++ b/compiler/testData/diagnostics/tests/constructorConsistency/open.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE open class Base { init { register(this) diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.fir.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.fir.kt index 232558ad853..07863a93c87 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.fir.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE package uninitialized_reassigned_variables fun doSmth(s: String) {} diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.kt index 766549c6191..6fa04389dc2 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/UninitializedOrReassignedVariables.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE package uninitialized_reassigned_variables fun doSmth(s: String) {} diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/accessToCompanionInBaseEnumInitSection_function.fir.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/accessToCompanionInBaseEnumInitSection_function.fir.kt index ff322b61422..9d1993c4fa5 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/accessToCompanionInBaseEnumInitSection_function.fir.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/accessToCompanionInBaseEnumInitSection_function.fir.kt @@ -1,6 +1,4 @@ // DIAGNOSTICS: -UNUSED_VARIABLE -// IGNORE_REVERSED_RESOLVE -// Ignore reason: KT-57619 // WITH_STDLIB // ISSUE: KT-57456, KT-57608 @file:OptIn(ExperimentalContracts::class) diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/accessToCompanionInBaseEnumInitSection_function.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/accessToCompanionInBaseEnumInitSection_function.kt index a63253f804d..7f81d075a14 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/accessToCompanionInBaseEnumInitSection_function.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/accessToCompanionInBaseEnumInitSection_function.kt @@ -1,6 +1,4 @@ // DIAGNOSTICS: -UNUSED_VARIABLE -// IGNORE_REVERSED_RESOLVE -// Ignore reason: KT-57619 // WITH_STDLIB // ISSUE: KT-57456, KT-57608 @file:OptIn(ExperimentalContracts::class) diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/accessToCompanionInBaseEnumInitSection_property.fir.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/accessToCompanionInBaseEnumInitSection_property.fir.kt index 46ca238ec10..c7f7431ee17 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/accessToCompanionInBaseEnumInitSection_property.fir.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/accessToCompanionInBaseEnumInitSection_property.fir.kt @@ -1,6 +1,4 @@ // DIAGNOSTICS: -UNUSED_VARIABLE -// IGNORE_REVERSED_RESOLVE -// Ignore reason: KT-57619 // WITH_STDLIB // ISSUE: KT-57456, KT-57608 @file:OptIn(ExperimentalContracts::class) diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/accessToCompanionInBaseEnumInitSection_property.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/accessToCompanionInBaseEnumInitSection_property.kt index a9333036807..f3c72045de2 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/accessToCompanionInBaseEnumInitSection_property.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/accessToCompanionInBaseEnumInitSection_property.kt @@ -1,6 +1,4 @@ // DIAGNOSTICS: -UNUSED_VARIABLE -// IGNORE_REVERSED_RESOLVE -// Ignore reason: KT-57619 // WITH_STDLIB // ISSUE: KT-57456, KT-57608 @file:OptIn(ExperimentalContracts::class) diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/assignmentInLocalsInConstructor.fir.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/assignmentInLocalsInConstructor.fir.kt index cddb72e2490..cb930b76e58 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/assignmentInLocalsInConstructor.fir.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/assignmentInLocalsInConstructor.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // Tests for KT-13597 (val assignment inside local object in constructor) class Test { diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/assignmentInLocalsInConstructor.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/assignmentInLocalsInConstructor.kt index 8a09fd2ba00..572fa3a5893 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/assignmentInLocalsInConstructor.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/assignmentInLocalsInConstructor.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // Tests for KT-13597 (val assignment inside local object in constructor) class Test { diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/capturingUninitializedVariableInNonInPlaceLambda.fir.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/capturingUninitializedVariableInNonInPlaceLambda.fir.kt index aade73b7461..ddcf0912129 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/capturingUninitializedVariableInNonInPlaceLambda.fir.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/capturingUninitializedVariableInNonInPlaceLambda.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // DIAGNOSTICS: -UNUSED_PARAMETER // WITH_STDLIB diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/capturingUninitializedVariableInNonInPlaceLambda.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/capturingUninitializedVariableInNonInPlaceLambda.kt index 293004f9c65..dca37563d4f 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/capturingUninitializedVariableInNonInPlaceLambda.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/capturingUninitializedVariableInNonInPlaceLambda.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // DIAGNOSTICS: -UNUSED_PARAMETER // WITH_STDLIB diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/delegatedMemberProperyWriteInInit.fir.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/delegatedMemberProperyWriteInInit.fir.kt index abd6d90be2d..93254ac730c 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/delegatedMemberProperyWriteInInit.fir.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/delegatedMemberProperyWriteInInit.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // DIAGNOSTICS: -UNUSED_PARAMETER import kotlin.reflect.KProperty diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/delegatedMemberProperyWriteInInit.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/delegatedMemberProperyWriteInInit.kt index 8af48709c7f..528e77657ed 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/delegatedMemberProperyWriteInInit.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/delegatedMemberProperyWriteInInit.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // DIAGNOSTICS: -UNUSED_PARAMETER import kotlin.reflect.KProperty diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/delegatedPropertyEarlyAccess.fir.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/delegatedPropertyEarlyAccess.fir.kt index 73bfc1ed07d..c9b2fd3f520 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/delegatedPropertyEarlyAccess.fir.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/delegatedPropertyEarlyAccess.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // ISSUE: KT-10869, KT-56682 import kotlin.reflect.KProperty diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/delegatedPropertyEarlyAccess.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/delegatedPropertyEarlyAccess.kt index 19205467855..b8ff9cb0e32 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/delegatedPropertyEarlyAccess.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/delegatedPropertyEarlyAccess.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // ISSUE: KT-10869, KT-56682 import kotlin.reflect.KProperty diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/enumCompanionInterdependence.fir.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/enumCompanionInterdependence.fir.kt index 3435f51105c..ce119af11c8 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/enumCompanionInterdependence.fir.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/enumCompanionInterdependence.fir.kt @@ -1,5 +1,3 @@ -// IGNORE_REVERSED_RESOLVE -// Ignore reason: KT-57619 enum class B(val x: Int) { B1(1), B2(2); diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/enumCompanionInterdependence.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/enumCompanionInterdependence.kt index bffcfcc10ae..165a9a65c4c 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/enumCompanionInterdependence.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/enumCompanionInterdependence.kt @@ -1,5 +1,3 @@ -// IGNORE_REVERSED_RESOLVE -// Ignore reason: KT-57619 enum class B(val x: Int) { B1(1), B2(2); diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/fieldInitialization.fir.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/fieldInitialization.fir.kt index 71d718b89e1..2efb4954808 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/fieldInitialization.fir.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/fieldInitialization.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect // !OPT_IN: kotlin.internal.ContractsDsl diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/fieldInitialization.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/fieldInitialization.kt index 6d21d86c6d9..9038dcaa5ba 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/fieldInitialization.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/fieldInitialization.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect // !OPT_IN: kotlin.internal.ContractsDsl diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/initializationInLambda.fir.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/initializationInLambda.fir.kt index 7b91f0fa27b..574f6088f64 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/initializationInLambda.fir.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/initializationInLambda.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE fun ignoreIt(f: () -> Unit) {} diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/initializationInLambda.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/initializationInLambda.kt index 0b92a5c2b60..324128fc16e 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/initializationInLambda.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/initializationInLambda.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE fun ignoreIt(f: () -> Unit) {} diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/initializationInLocalClass.fir.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/initializationInLocalClass.fir.kt index effeef8c427..906cb88415d 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/initializationInLocalClass.fir.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/initializationInLocalClass.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE fun foo() { diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/initializationInLocalClass.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/initializationInLocalClass.kt index 55237899f4b..4f93a22cb82 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/initializationInLocalClass.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/initializationInLocalClass.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE fun foo() { diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/initializationInLocalViaExplicitThis_after.fir.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/initializationInLocalViaExplicitThis_after.fir.kt index 10a0e76598d..92bc609ce34 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/initializationInLocalViaExplicitThis_after.fir.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/initializationInLocalViaExplicitThis_after.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: +ReadDeserializedContracts +UseCallsInPlaceEffect // See KT-17479 diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/initializationInLocalViaExplicitThis_after.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/initializationInLocalViaExplicitThis_after.kt index 85b12263a45..fea2541eafd 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/initializationInLocalViaExplicitThis_after.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/initializationInLocalViaExplicitThis_after.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: +ReadDeserializedContracts +UseCallsInPlaceEffect // See KT-17479 diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/initializationInLocalViaExplicitThis_before.fir.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/initializationInLocalViaExplicitThis_before.fir.kt index 9dd23bc8cbf..11fbf5ef942 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/initializationInLocalViaExplicitThis_before.fir.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/initializationInLocalViaExplicitThis_before.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: -ReadDeserializedContracts -UseCallsInPlaceEffect // See KT-17479 diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/initializationInLocalViaExplicitThis_before.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/initializationInLocalViaExplicitThis_before.kt index b6ea87757ff..6c07c4ba357 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/initializationInLocalViaExplicitThis_before.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/initializationInLocalViaExplicitThis_before.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: -ReadDeserializedContracts -UseCallsInPlaceEffect // See KT-17479 diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt2330.fir.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt2330.fir.kt index 8b57efec51f..62566e25c37 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt2330.fir.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt2330.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE //KT-2330 Check visibility of getters and setters correspondingly package a diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt2330.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt2330.kt index e113f49d8c6..bee0f36395b 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt2330.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt2330.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE //KT-2330 Check visibility of getters and setters correspondingly package a diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt4405.fir.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt4405.fir.kt index b3766df5ee0..773c6d2846a 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt4405.fir.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt4405.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE //KT-4405 Control-flow analysis is not performed for some local declarations package d diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt4405.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt4405.kt index edc20d61f77..aa75386d3a1 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt4405.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt4405.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE //KT-4405 Control-flow analysis is not performed for some local declarations package d diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt510.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt510.kt index 4b3f51df168..3faf5dc59ba 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt510.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt510.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL //KT-510 `this.` allows initialization without backing field diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt6788.fir.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt6788.fir.kt index 141373db317..c946e9037da 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt6788.fir.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt6788.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class A(val next: A? = null) { val x: String init { diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt6788.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt6788.kt index d3b5262865b..1adb2ece935 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt6788.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt6788.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class A(val next: A? = null) { val x: String init { diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt897.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt897.kt index 6110f119bc4..0f56423a5a9 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt897.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/kt897.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL //KT-897 Don't allow assignment to a property before it is defined diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/propertiesInitWithOtherInstance.fir.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/propertiesInitWithOtherInstance.fir.kt index 440912acf0d..bc4d852b749 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/propertiesInitWithOtherInstance.fir.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/propertiesInitWithOtherInstance.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class A(val next: A? = null) { val x: String init { diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/propertiesInitWithOtherInstance.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/propertiesInitWithOtherInstance.kt index d2329d697cc..ae1af050d7b 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/propertiesInitWithOtherInstance.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/propertiesInitWithOtherInstance.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class A(val next: A? = null) { val x: String init { diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/propertiesInitWithOtherInstanceInner.fir.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/propertiesInitWithOtherInstanceInner.fir.kt index bb1155eeeea..3b2cdaae39e 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/propertiesInitWithOtherInstanceInner.fir.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/propertiesInitWithOtherInstanceInner.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class Outer { val outerProp: String inner class Inner(inner: Inner, outer: Outer) { diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/propertiesInitWithOtherInstanceInner.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/propertiesInitWithOtherInstanceInner.kt index a71d48ac70b..ee36d864d8e 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/propertiesInitWithOtherInstanceInner.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/propertiesInitWithOtherInstanceInner.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class Outer { val outerProp: String inner class Inner(inner: Inner, outer: Outer) { diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/propertiesInitWithOtherInstanceThisLabel.fir.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/propertiesInitWithOtherInstanceThisLabel.fir.kt index c74dff0fe81..8c2b51fa08b 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/propertiesInitWithOtherInstanceThisLabel.fir.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/propertiesInitWithOtherInstanceThisLabel.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class A(val next: A? = null) { val x: String init { diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/propertiesInitWithOtherInstanceThisLabel.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/propertiesInitWithOtherInstanceThisLabel.kt index ffd0ed81eea..c07023a0852 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/propertiesInitWithOtherInstanceThisLabel.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/propertiesInitWithOtherInstanceThisLabel.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class A(val next: A? = null) { val x: String init { diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/referenceToPropertyInitializer.fir.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/referenceToPropertyInitializer.fir.kt index e7da4b4cebb..07b6585530b 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/referenceToPropertyInitializer.fir.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/referenceToPropertyInitializer.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_VARIABLE package o diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/referenceToPropertyInitializer.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/referenceToPropertyInitializer.kt index 819ccec6601..4e8bca9bdf7 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/referenceToPropertyInitializer.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/referenceToPropertyInitializer.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_VARIABLE package o diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/repeatUnitializedErrorOnlyForLocalVars.fir.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/repeatUnitializedErrorOnlyForLocalVars.fir.kt index 56f92016cb2..be28e872c2e 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/repeatUnitializedErrorOnlyForLocalVars.fir.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/repeatUnitializedErrorOnlyForLocalVars.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE package aa val a : Int = b diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/repeatUnitializedErrorOnlyForLocalVars.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/repeatUnitializedErrorOnlyForLocalVars.kt index b16b4200522..974b04c2d6f 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/repeatUnitializedErrorOnlyForLocalVars.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/repeatUnitializedErrorOnlyForLocalVars.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE package aa val a : Int = b diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/scopeOfAnonymousInitializer.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/scopeOfAnonymousInitializer.kt index 78d1f53fa29..4b0a549c1dc 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/scopeOfAnonymousInitializer.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/scopeOfAnonymousInitializer.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL class AnonymousInitializers(var a: String) { init { diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/uninintializedProperyWithDirectAndDelayedInitialization.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/uninintializedProperyWithDirectAndDelayedInitialization.kt index e1061ccafb0..f5588762ddf 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/uninintializedProperyWithDirectAndDelayedInitialization.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/uninintializedProperyWithDirectAndDelayedInitialization.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // ISSUE: KT-56678 diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/uninitializedQualifiedEnumEntry.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/uninitializedQualifiedEnumEntry.kt index 7f90fab1277..440ba0bc4bb 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/uninitializedQualifiedEnumEntry.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/uninitializedQualifiedEnumEntry.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // LANGUAGE: +ProhibitQualifiedAccessToUninitializedEnumEntry // ISSUE: KT-41124 diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/unnecessaryLateinit/lateinitRecursiveInLambda.fir.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/unnecessaryLateinit/lateinitRecursiveInLambda.fir.kt index bf206d27bb7..672cb34beb4 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/unnecessaryLateinit/lateinitRecursiveInLambda.fir.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/unnecessaryLateinit/lateinitRecursiveInLambda.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class Test { lateinit var someRunnable: Runnable init { diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/unnecessaryLateinit/lateinitRecursiveInLambda.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/unnecessaryLateinit/lateinitRecursiveInLambda.kt index 626f834ea90..718684da9b5 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/unnecessaryLateinit/lateinitRecursiveInLambda.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/unnecessaryLateinit/lateinitRecursiveInLambda.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class Test { lateinit var someRunnable: Runnable init { diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/unnecessaryLateinit/lateinitWithInit.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/unnecessaryLateinit/lateinitWithInit.kt index 442aa45866a..e4a4d6e95c2 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/unnecessaryLateinit/lateinitWithInit.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/unnecessaryLateinit/lateinitWithInit.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL class Foo { lateinit var bar: String diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/unnecessaryLateinit/lateinitWithMultipleConstructorsAndDelegation.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/unnecessaryLateinit/lateinitWithMultipleConstructorsAndDelegation.kt index 3a0ddc647be..f9f31de7f0e 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/unnecessaryLateinit/lateinitWithMultipleConstructorsAndDelegation.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/unnecessaryLateinit/lateinitWithMultipleConstructorsAndDelegation.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER diff --git a/compiler/testData/diagnostics/tests/controlFlowAnalysis/unnecessaryLateinit/lateinitWithPrimaryConstructorAndConstructor.kt b/compiler/testData/diagnostics/tests/controlFlowAnalysis/unnecessaryLateinit/lateinitWithPrimaryConstructorAndConstructor.kt index adf7bf066fe..787c34ea219 100644 --- a/compiler/testData/diagnostics/tests/controlFlowAnalysis/unnecessaryLateinit/lateinitWithPrimaryConstructorAndConstructor.kt +++ b/compiler/testData/diagnostics/tests/controlFlowAnalysis/unnecessaryLateinit/lateinitWithPrimaryConstructorAndConstructor.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER diff --git a/compiler/testData/diagnostics/tests/declarationChecks/ambiguousObjectExpressionType.fir.kt b/compiler/testData/diagnostics/tests/declarationChecks/ambiguousObjectExpressionType.fir.kt index ccdb9bd54ec..b5dba09b804 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/ambiguousObjectExpressionType.fir.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/ambiguousObjectExpressionType.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE interface Lazy { operator fun getValue(a1: Any, a2: Any): T } diff --git a/compiler/testData/diagnostics/tests/declarationChecks/ambiguousObjectExpressionType.kt b/compiler/testData/diagnostics/tests/declarationChecks/ambiguousObjectExpressionType.kt index 12d7c36f058..e02c8f6d41f 100644 --- a/compiler/testData/diagnostics/tests/declarationChecks/ambiguousObjectExpressionType.kt +++ b/compiler/testData/diagnostics/tests/declarationChecks/ambiguousObjectExpressionType.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE interface Lazy { operator fun getValue(a1: Any, a2: Any): T } diff --git a/compiler/testData/diagnostics/tests/exposed/protected.fir.kt b/compiler/testData/diagnostics/tests/exposed/protected.fir.kt index 4d3c802d379..ceeb5c42e65 100644 --- a/compiler/testData/diagnostics/tests/exposed/protected.fir.kt +++ b/compiler/testData/diagnostics/tests/exposed/protected.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE open class A { // protected relative to A protected open class B { diff --git a/compiler/testData/diagnostics/tests/exposed/protected.kt b/compiler/testData/diagnostics/tests/exposed/protected.kt index 40100d5351c..8c8b81c6504 100644 --- a/compiler/testData/diagnostics/tests/exposed/protected.kt +++ b/compiler/testData/diagnostics/tests/exposed/protected.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE open class A { // protected relative to A protected open class B { diff --git a/compiler/testData/diagnostics/tests/extensions/variableInvoke.fir.kt b/compiler/testData/diagnostics/tests/extensions/variableInvoke.fir.kt index de8c810de5d..a940855855a 100644 --- a/compiler/testData/diagnostics/tests/extensions/variableInvoke.fir.kt +++ b/compiler/testData/diagnostics/tests/extensions/variableInvoke.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class A(foo: Int.() -> Unit) { init { 4.foo() diff --git a/compiler/testData/diagnostics/tests/extensions/variableInvoke.kt b/compiler/testData/diagnostics/tests/extensions/variableInvoke.kt index e284e75b780..837a7d3814e 100644 --- a/compiler/testData/diagnostics/tests/extensions/variableInvoke.kt +++ b/compiler/testData/diagnostics/tests/extensions/variableInvoke.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class A(foo: Int.() -> Unit) { init { 4.foo() diff --git a/compiler/testData/diagnostics/tests/functionAsExpression/WithOuterGeneric.kt b/compiler/testData/diagnostics/tests/functionAsExpression/WithOuterGeneric.kt index f987bf7a35a..ba697918aab 100644 --- a/compiler/testData/diagnostics/tests/functionAsExpression/WithOuterGeneric.kt +++ b/compiler/testData/diagnostics/tests/functionAsExpression/WithOuterGeneric.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE diff --git a/compiler/testData/diagnostics/tests/generics/innerClasses/kt3357.kt b/compiler/testData/diagnostics/tests/generics/innerClasses/kt3357.kt index a69734ef1e4..e7ec070e349 100644 --- a/compiler/testData/diagnostics/tests/generics/innerClasses/kt3357.kt +++ b/compiler/testData/diagnostics/tests/generics/innerClasses/kt3357.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE diff --git a/compiler/testData/diagnostics/tests/implicitNothing.fir.kt b/compiler/testData/diagnostics/tests/implicitNothing.fir.kt index 4c76d90ba9f..a6c2bd1fcb4 100644 --- a/compiler/testData/diagnostics/tests/implicitNothing.fir.kt +++ b/compiler/testData/diagnostics/tests/implicitNothing.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE fun foo() = throw Exception() fun bar() = null!! diff --git a/compiler/testData/diagnostics/tests/implicitNothing.kt b/compiler/testData/diagnostics/tests/implicitNothing.kt index 54a43e18988..adb0a7cc7f4 100644 --- a/compiler/testData/diagnostics/tests/implicitNothing.kt +++ b/compiler/testData/diagnostics/tests/implicitNothing.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE fun foo() = throw Exception() fun bar() = null!! diff --git a/compiler/testData/diagnostics/tests/inference/constraints/definitelyNotNullTypeInReturnPosition.fir.kt b/compiler/testData/diagnostics/tests/inference/constraints/definitelyNotNullTypeInReturnPosition.fir.kt index fcc3a81dca9..7c03187069e 100644 --- a/compiler/testData/diagnostics/tests/inference/constraints/definitelyNotNullTypeInReturnPosition.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/constraints/definitelyNotNullTypeInReturnPosition.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION -CAST_NEVER_SUCCEEDS -UNUSED_VARIABLE -UNCHECKED_CAST class Foo(x: T) diff --git a/compiler/testData/diagnostics/tests/inference/constraints/definitelyNotNullTypeInReturnPosition.kt b/compiler/testData/diagnostics/tests/inference/constraints/definitelyNotNullTypeInReturnPosition.kt index 867c1e62d81..ebeb5ba9d8b 100644 --- a/compiler/testData/diagnostics/tests/inference/constraints/definitelyNotNullTypeInReturnPosition.kt +++ b/compiler/testData/diagnostics/tests/inference/constraints/definitelyNotNullTypeInReturnPosition.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION -CAST_NEVER_SUCCEEDS -UNUSED_VARIABLE -UNCHECKED_CAST class Foo(x: T) diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt41386.fir.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt41386.fir.kt index 28e083c2627..dda9447708f 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt41386.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt41386.fir.kt @@ -1,5 +1,3 @@ -// IGNORE_REVERSED_RESOLVE - open class Test(val map1 : Map, val map2 : Map) { open val inverse: Test = object : Test(map2, map1) { override val inverse: Test diff --git a/compiler/testData/diagnostics/tests/inference/regressions/kt41386.kt b/compiler/testData/diagnostics/tests/inference/regressions/kt41386.kt index 0565f8aef72..df7220a83b7 100644 --- a/compiler/testData/diagnostics/tests/inference/regressions/kt41386.kt +++ b/compiler/testData/diagnostics/tests/inference/regressions/kt41386.kt @@ -1,5 +1,3 @@ -// IGNORE_REVERSED_RESOLVE - open class Test(val map1 : Map, val map2 : Map) { open val inverse: Test = object : Test(map2, map1) { override val inverse: Test diff --git a/compiler/testData/diagnostics/tests/inference/substitutions/delegationAndInference.kt b/compiler/testData/diagnostics/tests/inference/substitutions/delegationAndInference.kt index 40e17302536..b045e9809e0 100644 --- a/compiler/testData/diagnostics/tests/inference/substitutions/delegationAndInference.kt +++ b/compiler/testData/diagnostics/tests/inference/substitutions/delegationAndInference.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER diff --git a/compiler/testData/diagnostics/tests/inference/typeParameterInConstructor.kt b/compiler/testData/diagnostics/tests/inference/typeParameterInConstructor.kt index 46c3e755331..f1424b0d01a 100644 --- a/compiler/testData/diagnostics/tests/inference/typeParameterInConstructor.kt +++ b/compiler/testData/diagnostics/tests/inference/typeParameterInConstructor.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL class B(val obj: O) { diff --git a/compiler/testData/diagnostics/tests/infos/PropertiesWithBackingFields.kt b/compiler/testData/diagnostics/tests/infos/PropertiesWithBackingFields.kt index bc62f493a1e..44fe3532bf5 100644 --- a/compiler/testData/diagnostics/tests/infos/PropertiesWithBackingFields.kt +++ b/compiler/testData/diagnostics/tests/infos/PropertiesWithBackingFields.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL abstract class Test() { abstract val x : Int diff --git a/compiler/testData/diagnostics/tests/initializedAfterRethrow.fir.kt b/compiler/testData/diagnostics/tests/initializedAfterRethrow.fir.kt index 609b1267d8c..38c333276d4 100644 --- a/compiler/testData/diagnostics/tests/initializedAfterRethrow.fir.kt +++ b/compiler/testData/diagnostics/tests/initializedAfterRethrow.fir.kt @@ -1,5 +1,3 @@ -// IGNORE_REVERSED_RESOLVE - fun foo(): Int = 42 object ThrowInTryWithCatch { diff --git a/compiler/testData/diagnostics/tests/initializedAfterRethrow.kt b/compiler/testData/diagnostics/tests/initializedAfterRethrow.kt index 3dd67c50012..af394e1fa19 100644 --- a/compiler/testData/diagnostics/tests/initializedAfterRethrow.kt +++ b/compiler/testData/diagnostics/tests/initializedAfterRethrow.kt @@ -1,5 +1,3 @@ -// IGNORE_REVERSED_RESOLVE - fun foo(): Int = 42 object ThrowInTryWithCatch { diff --git a/compiler/testData/diagnostics/tests/inlineClasses/presenceOfInitializerBlockInsideInlineClass.kt b/compiler/testData/diagnostics/tests/inlineClasses/presenceOfInitializerBlockInsideInlineClass.kt index 02709704dd0..b02d8a15901 100644 --- a/compiler/testData/diagnostics/tests/inlineClasses/presenceOfInitializerBlockInsideInlineClass.kt +++ b/compiler/testData/diagnostics/tests/inlineClasses/presenceOfInitializerBlockInsideInlineClass.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // !LANGUAGE: +InlineClasses, -JvmInlineValueClasses // !DIAGNOSTICS: -UNUSED_VARIABLE diff --git a/compiler/testData/diagnostics/tests/j+k/primitiveOverridesWithInlineClass/inlineClassErasedToPrimitiveInt.kt b/compiler/testData/diagnostics/tests/j+k/primitiveOverridesWithInlineClass/inlineClassErasedToPrimitiveInt.kt index d9931a05b92..deff956d8f8 100644 --- a/compiler/testData/diagnostics/tests/j+k/primitiveOverridesWithInlineClass/inlineClassErasedToPrimitiveInt.kt +++ b/compiler/testData/diagnostics/tests/j+k/primitiveOverridesWithInlineClass/inlineClassErasedToPrimitiveInt.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // !LANGUAGE: +InlineClasses, -JvmInlineValueClasses // FILE: kt1.kt diff --git a/compiler/testData/diagnostics/tests/j+k/properties/interface.kt b/compiler/testData/diagnostics/tests/j+k/properties/interface.kt index 758a4b5dc08..86a21f55bb0 100644 --- a/compiler/testData/diagnostics/tests/j+k/properties/interface.kt +++ b/compiler/testData/diagnostics/tests/j+k/properties/interface.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // FILE: A.java diff --git a/compiler/testData/diagnostics/tests/kt46483.fir.kt b/compiler/testData/diagnostics/tests/kt46483.fir.kt index a68e7ec9c7d..57e6f327681 100644 --- a/compiler/testData/diagnostics/tests/kt46483.fir.kt +++ b/compiler/testData/diagnostics/tests/kt46483.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE @Repeatable @Target( AnnotationTarget.TYPE_PARAMETER) annotation class TypeParameterAnn(val name: String) diff --git a/compiler/testData/diagnostics/tests/kt46483.kt b/compiler/testData/diagnostics/tests/kt46483.kt index 1d3ef4ef8b5..1e8b5a07149 100644 --- a/compiler/testData/diagnostics/tests/kt46483.kt +++ b/compiler/testData/diagnostics/tests/kt46483.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE @Repeatable @Target( AnnotationTarget.TYPE_PARAMETER) annotation class TypeParameterAnn(val name: String) diff --git a/compiler/testData/diagnostics/tests/lateinit/modifierApplicability_lv12.fir.kt b/compiler/testData/diagnostics/tests/lateinit/modifierApplicability_lv12.fir.kt index 21d36c02c24..df4efef4a49 100644 --- a/compiler/testData/diagnostics/tests/lateinit/modifierApplicability_lv12.fir.kt +++ b/compiler/testData/diagnostics/tests/lateinit/modifierApplicability_lv12.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: +LateinitTopLevelProperties +LateinitLocalVariables import kotlin.reflect.KProperty diff --git a/compiler/testData/diagnostics/tests/lateinit/modifierApplicability_lv12.kt b/compiler/testData/diagnostics/tests/lateinit/modifierApplicability_lv12.kt index aeb4ced2080..790bb891756 100644 --- a/compiler/testData/diagnostics/tests/lateinit/modifierApplicability_lv12.kt +++ b/compiler/testData/diagnostics/tests/lateinit/modifierApplicability_lv12.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: +LateinitTopLevelProperties +LateinitLocalVariables import kotlin.reflect.KProperty diff --git a/compiler/testData/diagnostics/tests/modifiers/IllegalModifiers.fir.kt b/compiler/testData/diagnostics/tests/modifiers/IllegalModifiers.fir.kt index 7f4cc994dcd..d04f1568309 100644 --- a/compiler/testData/diagnostics/tests/modifiers/IllegalModifiers.fir.kt +++ b/compiler/testData/diagnostics/tests/modifiers/IllegalModifiers.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE @myAnnotation public package illegal_modifiers diff --git a/compiler/testData/diagnostics/tests/modifiers/IllegalModifiers.kt b/compiler/testData/diagnostics/tests/modifiers/IllegalModifiers.kt index 7dcf3cea177..6970c7d31cf 100644 --- a/compiler/testData/diagnostics/tests/modifiers/IllegalModifiers.kt +++ b/compiler/testData/diagnostics/tests/modifiers/IllegalModifiers.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE @myAnnotation public package illegal_modifiers diff --git a/compiler/testData/diagnostics/tests/modifiers/const/applicability.fir.kt b/compiler/testData/diagnostics/tests/modifiers/const/applicability.fir.kt index a6f89a26670..a60ec2adcb9 100644 --- a/compiler/testData/diagnostics/tests/modifiers/const/applicability.fir.kt +++ b/compiler/testData/diagnostics/tests/modifiers/const/applicability.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_VARIABLE -CAST_NEVER_SUCCEEDS -DIVISION_BY_ZERO import kotlin.reflect.KProperty diff --git a/compiler/testData/diagnostics/tests/modifiers/const/applicability.kt b/compiler/testData/diagnostics/tests/modifiers/const/applicability.kt index 06e9919d752..6b53b8d7874 100644 --- a/compiler/testData/diagnostics/tests/modifiers/const/applicability.kt +++ b/compiler/testData/diagnostics/tests/modifiers/const/applicability.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_VARIABLE -CAST_NEVER_SUCCEEDS -DIVISION_BY_ZERO import kotlin.reflect.KProperty diff --git a/compiler/testData/diagnostics/tests/modifiers/const/fromJava.fir.kt b/compiler/testData/diagnostics/tests/modifiers/const/fromJava.fir.kt index 79b6fd16aff..34e6e03db52 100644 --- a/compiler/testData/diagnostics/tests/modifiers/const/fromJava.fir.kt +++ b/compiler/testData/diagnostics/tests/modifiers/const/fromJava.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FILE: A.java public class A { diff --git a/compiler/testData/diagnostics/tests/modifiers/const/fromJava.kt b/compiler/testData/diagnostics/tests/modifiers/const/fromJava.kt index d9279cf04d3..412506e511d 100644 --- a/compiler/testData/diagnostics/tests/modifiers/const/fromJava.kt +++ b/compiler/testData/diagnostics/tests/modifiers/const/fromJava.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FILE: A.java public class A { diff --git a/compiler/testData/diagnostics/tests/modifiers/const/kt12248.kt b/compiler/testData/diagnostics/tests/modifiers/const/kt12248.kt index 51711f7fef2..a93496a207b 100644 --- a/compiler/testData/diagnostics/tests/modifiers/const/kt12248.kt +++ b/compiler/testData/diagnostics/tests/modifiers/const/kt12248.kt @@ -1,3 +1,5 @@ +// IGNORE_REVERSED_RESOLVE +// IGNORE_CONTRACT_VIOLATIONS // FIR_IDENTICAL // FILE: Bar.java diff --git a/compiler/testData/diagnostics/tests/multimodule/duplicateClass/collectionMethodStub.kt b/compiler/testData/diagnostics/tests/multimodule/duplicateClass/collectionMethodStub.kt index 122fc05ec16..35e26c5f124 100644 --- a/compiler/testData/diagnostics/tests/multimodule/duplicateClass/collectionMethodStub.kt +++ b/compiler/testData/diagnostics/tests/multimodule/duplicateClass/collectionMethodStub.kt @@ -1,6 +1,6 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // SKIP_TXT +// ALLOW_KOTLIN_PACKAGE // FILE: f1.kt package kotlin diff --git a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt244.fir.kt b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt244.fir.kt index ced552d2826..85372301de9 100644 --- a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt244.fir.kt +++ b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt244.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE package kt244 diff --git a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt244.kt b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt244.kt index f5d3a5a4c4d..d492e1a1224 100644 --- a/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt244.kt +++ b/compiler/testData/diagnostics/tests/nullabilityAndSmartCasts/kt244.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE package kt244 diff --git a/compiler/testData/diagnostics/tests/overload/LocalFunctions.fir.kt b/compiler/testData/diagnostics/tests/overload/LocalFunctions.fir.kt index 419e34d5a7f..1e9a89bbffd 100644 --- a/compiler/testData/diagnostics/tests/overload/LocalFunctions.fir.kt +++ b/compiler/testData/diagnostics/tests/overload/LocalFunctions.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE fun test() { fun test1() {} fun test1() {} diff --git a/compiler/testData/diagnostics/tests/overload/LocalFunctions.kt b/compiler/testData/diagnostics/tests/overload/LocalFunctions.kt index 9f5e3fc7553..1898fb1c6e0 100644 --- a/compiler/testData/diagnostics/tests/overload/LocalFunctions.kt +++ b/compiler/testData/diagnostics/tests/overload/LocalFunctions.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE fun test() { fun test1() {} fun test1() {} diff --git a/compiler/testData/diagnostics/tests/regressions/kt1639-JFrame.kt b/compiler/testData/diagnostics/tests/regressions/kt1639-JFrame.kt index 02e831a75b1..1496c0556c2 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt1639-JFrame.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt1639-JFrame.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // FULL_JDK // SKIP_TXT diff --git a/compiler/testData/diagnostics/tests/regressions/kt3731.kt b/compiler/testData/diagnostics/tests/regressions/kt3731.kt index dccc1a18939..c2f4cd15ceb 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt3731.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt3731.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // KT-3731 Resolve & inner class diff --git a/compiler/testData/diagnostics/tests/regressions/kt575.kt b/compiler/testData/diagnostics/tests/regressions/kt575.kt index cd0f0373d40..682758bf43e 100644 --- a/compiler/testData/diagnostics/tests/regressions/kt575.kt +++ b/compiler/testData/diagnostics/tests/regressions/kt575.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // KT-575 Cannot ++ a companion object member diff --git a/compiler/testData/diagnostics/tests/resolve/invoke/extensionValueAsNonExtension.kt b/compiler/testData/diagnostics/tests/resolve/invoke/extensionValueAsNonExtension.kt index 3325c18c6bb..d7dae292233 100644 --- a/compiler/testData/diagnostics/tests/resolve/invoke/extensionValueAsNonExtension.kt +++ b/compiler/testData/diagnostics/tests/resolve/invoke/extensionValueAsNonExtension.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE class A diff --git a/compiler/testData/diagnostics/tests/scopes/genericVsNested.kt b/compiler/testData/diagnostics/tests/scopes/genericVsNested.kt index b76efc968c0..4007db23f92 100644 --- a/compiler/testData/diagnostics/tests/scopes/genericVsNested.kt +++ b/compiler/testData/diagnostics/tests/scopes/genericVsNested.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL class A { class T diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/companionObject.fir.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/companionObject.fir.kt index 72128fa87b2..ea8817f6acc 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/companionObject.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/companionObject.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion interface A { diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/companionObject.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/companionObject.kt index af632b308cb..77148da35ae 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/companionObject.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/companionObject.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion interface A { diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/companionObjectAfterJava.fir.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/companionObjectAfterJava.fir.kt index 88a8ac00e57..bf33833168b 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/companionObjectAfterJava.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/companionObjectAfterJava.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion // FILE: 1.kt diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/companionObjectAfterJava.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/companionObjectAfterJava.kt index 938c8b5d1e5..c23589d5cc6 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/companionObjectAfterJava.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/companionObjectAfterJava.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion // FILE: 1.kt diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/companionObjectsOrder.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/companionObjectsOrder.kt index b53e288c787..2bb2114e912 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/companionObjectsOrder.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/companionObjectsOrder.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE open class A { diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/innerClasses.fir.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/innerClasses.fir.kt index bb39f281ff2..47e0138e40b 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/innerClasses.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/innerClasses.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion open class A { diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/innerClasses.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/innerClasses.kt index 6a2c7dafb62..ac5937feaf9 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/innerClasses.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/innerClasses.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion open class A { diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/kt3856.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/kt3856.kt index 6bbbe9e7a7b..4b18919d89b 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/kt3856.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/kt3856.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL fun foo(init: A.() -> Unit) { } diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/methodsPriority.fir.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/methodsPriority.fir.kt index 354c3837114..94f927ff1c2 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/methodsPriority.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/methodsPriority.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_VARIABLE // FILE: A.java public class A { diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/methodsPriority.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/methodsPriority.kt index fd5a9333ffe..e5638ff3996 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/methodsPriority.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/methodsPriority.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_VARIABLE // FILE: A.java public class A { diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/nestedCompanionClass.fir.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/nestedCompanionClass.fir.kt index 1064e00728e..751f357054c 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/nestedCompanionClass.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/nestedCompanionClass.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion open class A { diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/nestedCompanionClass.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/nestedCompanionClass.kt index 19f430b70bb..ce2b9501c08 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/nestedCompanionClass.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/nestedCompanionClass.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion open class A { diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/nestedCompanionClassVsNested.fir.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/nestedCompanionClassVsNested.fir.kt index 5be911607d0..e382ae02d06 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/nestedCompanionClassVsNested.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/nestedCompanionClassVsNested.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion open class A { diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/nestedCompanionClassVsNested.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/nestedCompanionClassVsNested.kt index 0bdf9d4097d..06f87294f86 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/nestedCompanionClassVsNested.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/nestedCompanionClassVsNested.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion open class A { diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/nestedCompanionClassVsNestedJava.fir.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/nestedCompanionClassVsNestedJava.fir.kt index 7aec925a67e..9e87dcdd09f 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/nestedCompanionClassVsNestedJava.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/nestedCompanionClassVsNestedJava.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion // FILE: 1.kt diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/nestedCompanionClassVsNestedJava.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/nestedCompanionClassVsNestedJava.kt index 6bf62d58196..5505b72e294 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/nestedCompanionClassVsNestedJava.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/nestedCompanionClassVsNestedJava.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion // FILE: 1.kt diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/nestedFromJava.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/nestedFromJava.kt index f36f194f5fa..5f8d4720f80 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/nestedFromJava.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/nestedFromJava.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // FILE: A.java public interface A { diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/nestedFromJavaAfterKotlin.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/nestedFromJavaAfterKotlin.kt index fb9cefe729f..341a0373e4b 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/nestedFromJavaAfterKotlin.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/nestedFromJavaAfterKotlin.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // FILE: A.java public interface A { diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/nestedVsToplevelClass.fir.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/nestedVsToplevelClass.fir.kt index c9d0ceff7bc..0b16bda987e 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/nestedVsToplevelClass.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/nestedVsToplevelClass.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion class X { diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/nestedVsToplevelClass.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/nestedVsToplevelClass.kt index 76a681cbdad..ff9a4fff2c5 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/nestedVsToplevelClass.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/nestedVsToplevelClass.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion class X { diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/severalCompanions.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/severalCompanions.kt index 512907310b8..8a0d4c0825e 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/severalCompanions.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/severalCompanions.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE open class A { diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/accessToStaticMembersOfParentClassJKJ_after.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/accessToStaticMembersOfParentClassJKJ_after.kt index 3eace147d9f..1294736d778 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/accessToStaticMembersOfParentClassJKJ_after.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/accessToStaticMembersOfParentClassJKJ_after.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion // FILE: J.java diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/accessToStaticMembersOfParentClassJKJ_before.fir.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/accessToStaticMembersOfParentClassJKJ_before.fir.kt index ad441312b74..8064c385460 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/accessToStaticMembersOfParentClassJKJ_before.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/accessToStaticMembersOfParentClassJKJ_before.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion // FILE: J.java public class J { diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/accessToStaticMembersOfParentClassJKJ_before.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/accessToStaticMembersOfParentClassJKJ_before.kt index 2b6a908bb02..24cd81e05a7 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/accessToStaticMembersOfParentClassJKJ_before.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/accessToStaticMembersOfParentClassJKJ_before.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion // FILE: J.java public class J { diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/accessToStaticMembersOfParentClass_after.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/accessToStaticMembersOfParentClass_after.kt index 101f3374357..bb3107c73b3 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/accessToStaticMembersOfParentClass_after.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/accessToStaticMembersOfParentClass_after.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion // FILE: J.java diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/accessToStaticMembersOfParentClass_before.fir.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/accessToStaticMembersOfParentClass_before.fir.kt index a2f863dceb8..28daf2d8470 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/accessToStaticMembersOfParentClass_before.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/accessToStaticMembersOfParentClass_before.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion // FILE: J.java public class J { diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/accessToStaticMembersOfParentClass_before.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/accessToStaticMembersOfParentClass_before.kt index 46a216ca111..b0ae1b726b9 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/accessToStaticMembersOfParentClass_before.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/accessToStaticMembersOfParentClass_before.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion // FILE: J.java public class J { diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass_after.fir.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass_after.fir.kt index 436406abc17..3d9630ec372 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass_after.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass_after.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion // !DIAGNOSTICS: -UNUSED_VARIABLE diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass_after.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass_after.kt index bfd636a5c33..e35db78959c 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass_after.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass_after.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion // !DIAGNOSTICS: -UNUSED_VARIABLE diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass_before.fir.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass_before.fir.kt index b2a4131d6dd..3e7feacf559 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass_before.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass_before.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion // !DIAGNOSTICS: -UNUSED_VARIABLE diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass_before.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass_before.kt index 16b8753acf2..16443216653 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass_before.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromContainingClass_before.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion // !DIAGNOSTICS: -UNUSED_VARIABLE diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromJavaAfterKotlin_after.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromJavaAfterKotlin_after.kt index 12ba546c15f..6abd67de807 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromJavaAfterKotlin_after.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromJavaAfterKotlin_after.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion // FILE: J.java diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromJavaAfterKotlin_before.fir.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromJavaAfterKotlin_before.fir.kt index eac2533c4dc..349331eb919 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromJavaAfterKotlin_before.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromJavaAfterKotlin_before.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion // FILE: J.java public class J { diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromJavaAfterKotlin_before.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromJavaAfterKotlin_before.kt index e7a6ecb6996..1f1ef98f175 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromJavaAfterKotlin_before.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromJavaAfterKotlin_before.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion // FILE: J.java public class J { diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromJava_after.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromJava_after.kt index 6073de4d135..68f182813d3 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromJava_after.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromJava_after.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // !LANGUAGE: +ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion // FILE: J.java diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromJava_before.fir.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromJava_before.fir.kt index 3fe6dc885fb..2e585f6aa21 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromJava_before.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromJava_before.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion // FILE: J.java public class J { diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromJava_before.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromJava_before.kt index 91fb25b4ed7..8332053753c 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromJava_before.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/companionObject/inheritFromJava_before.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: -ProhibitVisibilityOfNestedClassifiersFromSupertypesOfCompanion // FILE: J.java public class J { diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/localVsStatic.fir.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/localVsStatic.fir.kt index 71224514f66..eca87ded82f 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/localVsStatic.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/localVsStatic.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_VARIABLE // FILE: A.java public class A { diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/localVsStatic.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/localVsStatic.kt index 45d0ab3bb45..b4be8f60f25 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/localVsStatic.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/localVsStatic.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_VARIABLE // FILE: A.java public class A { diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/overloadStatic.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/overloadStatic.kt index 7de6e9f3ba0..be92fd4c2de 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/overloadStatic.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/overloadStatic.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE // FILE: A.java diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticFunVsImport.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticFunVsImport.kt index 4eb337e7886..eaccfdd5eea 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticFunVsImport.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticFunVsImport.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE // FILE: A.java diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticPropertyVsImport.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticPropertyVsImport.kt index d2ff0119699..672ee0edfa2 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticPropertyVsImport.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticPropertyVsImport.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE // FILE: A.java diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticVsCompanion.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticVsCompanion.kt index 4ccd169f5ee..999367d0d18 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticVsCompanion.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticVsCompanion.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_VARIABLE // FILE: A.java diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticVsMember.fir.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticVsMember.fir.kt index aa7459a822f..434f1c18063 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticVsMember.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticVsMember.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_VARIABLE // FILE: A.java public class A { diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticVsMember.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticVsMember.kt index 18205e3ddb9..e6920274b35 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticVsMember.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticVsMember.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_VARIABLE // FILE: A.java public class A { diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticVsOuter.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticVsOuter.kt index 8d79fd9d34d..4b1e5f1454c 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticVsOuter.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticVsOuter.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // FILE: A.java public class A { diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticsFromjava.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticsFromjava.kt index 0da49408fc3..0a09f5de815 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticsFromjava.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticsFromjava.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // FILE: A.java public class A { diff --git a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticsFromjavaAfterKotlin.kt b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticsFromjavaAfterKotlin.kt index bb67468dd81..196b52c9e89 100644 --- a/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticsFromjavaAfterKotlin.kt +++ b/compiler/testData/diagnostics/tests/scopes/inheritance/statics/staticsFromjavaAfterKotlin.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // FILE: A.java public class A { diff --git a/compiler/testData/diagnostics/tests/scopes/invisibleInternalSetterAccessFromDeriviedClass.fir.kt b/compiler/testData/diagnostics/tests/scopes/invisibleInternalSetterAccessFromDeriviedClass.fir.kt index 61fe021dd2a..c4d839f711d 100644 --- a/compiler/testData/diagnostics/tests/scopes/invisibleInternalSetterAccessFromDeriviedClass.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/invisibleInternalSetterAccessFromDeriviedClass.fir.kt @@ -1,5 +1,4 @@ // !LANGUAGE:-ProhibitAccessToInvisibleSetterFromDerivedClass -// IGNORE_REVERSED_RESOLVE // MODULE: m1 // FILE: base.kt diff --git a/compiler/testData/diagnostics/tests/scopes/invisibleInternalSetterAccessFromDeriviedClass.kt b/compiler/testData/diagnostics/tests/scopes/invisibleInternalSetterAccessFromDeriviedClass.kt index 50176c96cc6..73d66dab4a7 100644 --- a/compiler/testData/diagnostics/tests/scopes/invisibleInternalSetterAccessFromDeriviedClass.kt +++ b/compiler/testData/diagnostics/tests/scopes/invisibleInternalSetterAccessFromDeriviedClass.kt @@ -1,5 +1,4 @@ // !LANGUAGE:-ProhibitAccessToInvisibleSetterFromDerivedClass -// IGNORE_REVERSED_RESOLVE // MODULE: m1 // FILE: base.kt diff --git a/compiler/testData/diagnostics/tests/scopes/invisibleInternalSetterAccessFromDeriviedClassOn.fir.kt b/compiler/testData/diagnostics/tests/scopes/invisibleInternalSetterAccessFromDeriviedClassOn.fir.kt index e0356a364c2..b443ced43d7 100644 --- a/compiler/testData/diagnostics/tests/scopes/invisibleInternalSetterAccessFromDeriviedClassOn.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/invisibleInternalSetterAccessFromDeriviedClassOn.fir.kt @@ -1,5 +1,4 @@ // !LANGUAGE:+ProhibitAccessToInvisibleSetterFromDerivedClass -// IGNORE_REVERSED_RESOLVE // MODULE: m1 // FILE: base.kt diff --git a/compiler/testData/diagnostics/tests/scopes/invisibleInternalSetterAccessFromDeriviedClassOn.kt b/compiler/testData/diagnostics/tests/scopes/invisibleInternalSetterAccessFromDeriviedClassOn.kt index 44830419f4d..00f00522e9e 100644 --- a/compiler/testData/diagnostics/tests/scopes/invisibleInternalSetterAccessFromDeriviedClassOn.kt +++ b/compiler/testData/diagnostics/tests/scopes/invisibleInternalSetterAccessFromDeriviedClassOn.kt @@ -1,5 +1,4 @@ // !LANGUAGE:+ProhibitAccessToInvisibleSetterFromDerivedClass -// IGNORE_REVERSED_RESOLVE // MODULE: m1 // FILE: base.kt diff --git a/compiler/testData/diagnostics/tests/scopes/kt1244.fir.kt b/compiler/testData/diagnostics/tests/scopes/kt1244.fir.kt index 2ea10199f5a..ea017d6e151 100644 --- a/compiler/testData/diagnostics/tests/scopes/kt1244.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/kt1244.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE //KT-1244 Frontend allows access to private members of other classes package kt1244 diff --git a/compiler/testData/diagnostics/tests/scopes/kt1244.kt b/compiler/testData/diagnostics/tests/scopes/kt1244.kt index 3f30fdcef09..cf03bb828c4 100644 --- a/compiler/testData/diagnostics/tests/scopes/kt1244.kt +++ b/compiler/testData/diagnostics/tests/scopes/kt1244.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE //KT-1244 Frontend allows access to private members of other classes package kt1244 diff --git a/compiler/testData/diagnostics/tests/scopes/kt37.fir.kt b/compiler/testData/diagnostics/tests/scopes/kt37.fir.kt index 8f7a51cdd30..74f14155ed3 100644 --- a/compiler/testData/diagnostics/tests/scopes/kt37.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/kt37.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE //KT-37 Typechecker doesn't complain about accessing non-public property package kt37 diff --git a/compiler/testData/diagnostics/tests/scopes/kt37.kt b/compiler/testData/diagnostics/tests/scopes/kt37.kt index 9db31545937..4154c41f8cb 100644 --- a/compiler/testData/diagnostics/tests/scopes/kt37.kt +++ b/compiler/testData/diagnostics/tests/scopes/kt37.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE //KT-37 Typechecker doesn't complain about accessing non-public property package kt37 diff --git a/compiler/testData/diagnostics/tests/scopes/protectedVisibility/complexCompanion.fir.kt b/compiler/testData/diagnostics/tests/scopes/protectedVisibility/complexCompanion.fir.kt index 2fc7e666abd..989b88c592c 100644 --- a/compiler/testData/diagnostics/tests/scopes/protectedVisibility/complexCompanion.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/protectedVisibility/complexCompanion.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE open class A { protected fun foo() {} diff --git a/compiler/testData/diagnostics/tests/scopes/protectedVisibility/complexCompanion.kt b/compiler/testData/diagnostics/tests/scopes/protectedVisibility/complexCompanion.kt index 1f7e4849e6c..8adefea99ab 100644 --- a/compiler/testData/diagnostics/tests/scopes/protectedVisibility/complexCompanion.kt +++ b/compiler/testData/diagnostics/tests/scopes/protectedVisibility/complexCompanion.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE open class A { protected fun foo() {} diff --git a/compiler/testData/diagnostics/tests/scopes/protectedVisibility/nonSuperCallConstructor.fir.kt b/compiler/testData/diagnostics/tests/scopes/protectedVisibility/nonSuperCallConstructor.fir.kt index cce9489564f..1a1fc5669b5 100644 --- a/compiler/testData/diagnostics/tests/scopes/protectedVisibility/nonSuperCallConstructor.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/protectedVisibility/nonSuperCallConstructor.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_PARAMETER open class A protected constructor(x: Int) { diff --git a/compiler/testData/diagnostics/tests/scopes/protectedVisibility/nonSuperCallConstructor.kt b/compiler/testData/diagnostics/tests/scopes/protectedVisibility/nonSuperCallConstructor.kt index 1dec3b6b658..65fb3936ae6 100644 --- a/compiler/testData/diagnostics/tests/scopes/protectedVisibility/nonSuperCallConstructor.kt +++ b/compiler/testData/diagnostics/tests/scopes/protectedVisibility/nonSuperCallConstructor.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_PARAMETER open class A protected constructor(x: Int) { diff --git a/compiler/testData/diagnostics/tests/scopes/protectedVisibility/nonSuperCallConstructorJavaDifferentPackage.fir.kt b/compiler/testData/diagnostics/tests/scopes/protectedVisibility/nonSuperCallConstructorJavaDifferentPackage.fir.kt index baaa2601943..679c584e96c 100644 --- a/compiler/testData/diagnostics/tests/scopes/protectedVisibility/nonSuperCallConstructorJavaDifferentPackage.fir.kt +++ b/compiler/testData/diagnostics/tests/scopes/protectedVisibility/nonSuperCallConstructorJavaDifferentPackage.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_PARAMETER // FILE: abc/A.java diff --git a/compiler/testData/diagnostics/tests/scopes/protectedVisibility/nonSuperCallConstructorJavaDifferentPackage.kt b/compiler/testData/diagnostics/tests/scopes/protectedVisibility/nonSuperCallConstructorJavaDifferentPackage.kt index a9d0fa6fd7a..8aaef71defa 100644 --- a/compiler/testData/diagnostics/tests/scopes/protectedVisibility/nonSuperCallConstructorJavaDifferentPackage.kt +++ b/compiler/testData/diagnostics/tests/scopes/protectedVisibility/nonSuperCallConstructorJavaDifferentPackage.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_PARAMETER // FILE: abc/A.java diff --git a/compiler/testData/diagnostics/tests/scopes/protectedVisibility/nonSuperCallConstructorJavaSamePackage.kt b/compiler/testData/diagnostics/tests/scopes/protectedVisibility/nonSuperCallConstructorJavaSamePackage.kt index ec5a4e58add..43efcd8be2f 100644 --- a/compiler/testData/diagnostics/tests/scopes/protectedVisibility/nonSuperCallConstructorJavaSamePackage.kt +++ b/compiler/testData/diagnostics/tests/scopes/protectedVisibility/nonSuperCallConstructorJavaSamePackage.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER diff --git a/compiler/testData/diagnostics/tests/sealed/kt44316.kt b/compiler/testData/diagnostics/tests/sealed/kt44316.kt index 99a3280b968..cd55b84deb6 100644 --- a/compiler/testData/diagnostics/tests/sealed/kt44316.kt +++ b/compiler/testData/diagnostics/tests/sealed/kt44316.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // KT-44316 diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/classInitializersWithoutPrimary.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/classInitializersWithoutPrimary.kt index 55de88adb18..63d6075cb81 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/classInitializersWithoutPrimary.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/classInitializersWithoutPrimary.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL class A { constructor() diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/constructorInObject.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/constructorInObject.kt index ed6351144d2..831a0f30b03 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/constructorInObject.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/constructorInObject.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL object A { constructor() diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/propertyInitializationWithPrimary.fir.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/propertyInitializationWithPrimary.fir.kt index c686905ac81..77dbaa83059 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/propertyInitializationWithPrimary.fir.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/propertyInitializationWithPrimary.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_PARAMETER class A(val w: Char) { val x: Int diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/propertyInitializationWithPrimary.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/propertyInitializationWithPrimary.kt index f97493f1c08..3c9f5a6cfcc 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/propertyInitializationWithPrimary.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/propertyInitializationWithPrimary.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_PARAMETER class A(val w: Char) { val x: Int diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/propertyInitializationWithoutPrimary.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/propertyInitializationWithoutPrimary.kt index 83beae5e77a..c2cdd885dad 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/propertyInitializationWithoutPrimary.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/propertyInitializationWithoutPrimary.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER class A { diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/return.fir.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/return.fir.kt index c70febc45ca..641a4f2f213 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/return.fir.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/return.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class A { init { return diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/return.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/return.kt index b39f3968039..e176b17792d 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/return.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/return.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class A { init { return diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/unreachableCode.fir.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/unreachableCode.fir.kt index 918f8298c35..0fb0ff9b8cf 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/unreachableCode.fir.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/unreachableCode.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class A0 { val x: Int constructor() { diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/unreachableCode.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/unreachableCode.kt index 7d4846cfa54..017c1629ce5 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/unreachableCode.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/unreachableCode.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class A0 { val x: Int constructor() { diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/useOfPropertiesWithPrimary.fir.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/useOfPropertiesWithPrimary.fir.kt index fae241ea968..eb19a21c7f2 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/useOfPropertiesWithPrimary.fir.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/useOfPropertiesWithPrimary.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_PARAMETER class A(val w: Int) { val x: Int diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/useOfPropertiesWithPrimary.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/useOfPropertiesWithPrimary.kt index 163ea906412..18b3c8d4382 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/useOfPropertiesWithPrimary.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/useOfPropertiesWithPrimary.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_PARAMETER class A(val w: Int) { val x: Int diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/useOfPropertiesWithoutPrimary.fir.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/useOfPropertiesWithoutPrimary.fir.kt index fa758add29a..82a49f19a8f 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/useOfPropertiesWithoutPrimary.fir.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/useOfPropertiesWithoutPrimary.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_PARAMETER class A { val x: Int diff --git a/compiler/testData/diagnostics/tests/secondaryConstructors/useOfPropertiesWithoutPrimary.kt b/compiler/testData/diagnostics/tests/secondaryConstructors/useOfPropertiesWithoutPrimary.kt index 8314cbea6e4..e5a77fbb3a8 100644 --- a/compiler/testData/diagnostics/tests/secondaryConstructors/useOfPropertiesWithoutPrimary.kt +++ b/compiler/testData/diagnostics/tests/secondaryConstructors/useOfPropertiesWithoutPrimary.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_PARAMETER class A { val x: Int diff --git a/compiler/testData/diagnostics/tests/smartCasts/openInSealed.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/openInSealed.fir.kt index 5c861e65c59..70a19484fba 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/openInSealed.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/openInSealed.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE sealed class My(open val x: Int?) { init { if (x != null) { diff --git a/compiler/testData/diagnostics/tests/smartCasts/openInSealed.kt b/compiler/testData/diagnostics/tests/smartCasts/openInSealed.kt index 08206332002..6579e10bc71 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/openInSealed.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/openInSealed.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE sealed class My(open val x: Int?) { init { if (x != null) { diff --git a/compiler/testData/diagnostics/tests/smartCasts/unstableToStable.kt b/compiler/testData/diagnostics/tests/smartCasts/unstableToStable.kt index dd707cca659..5216bc63586 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/unstableToStable.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/unstableToStable.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL class Foo(var x: Int?) { init { diff --git a/compiler/testData/diagnostics/tests/smartCasts/unstableToStableTypes.kt b/compiler/testData/diagnostics/tests/smartCasts/unstableToStableTypes.kt index 92becd66a4b..1a872d2f169 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/unstableToStableTypes.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/unstableToStableTypes.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL class Bar { fun bar() {} diff --git a/compiler/testData/diagnostics/tests/smartCasts/varChangedInInitializer.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/varChangedInInitializer.fir.kt index 8719fd7eb4e..6ca3b6fbe3e 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varChangedInInitializer.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varChangedInInitializer.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class My { init { var y: Int? diff --git a/compiler/testData/diagnostics/tests/smartCasts/varChangedInInitializer.kt b/compiler/testData/diagnostics/tests/smartCasts/varChangedInInitializer.kt index 8fba905bd52..957538072bb 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varChangedInInitializer.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varChangedInInitializer.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class My { init { var y: Int? diff --git a/compiler/testData/diagnostics/tests/smartCasts/varInInitNoPrimary.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/varInInitNoPrimary.fir.kt index e77139c24b3..3b0d1ea61cb 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varInInitNoPrimary.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varInInitNoPrimary.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class Your { init { var y: String? = "xyz" diff --git a/compiler/testData/diagnostics/tests/smartCasts/varInInitNoPrimary.kt b/compiler/testData/diagnostics/tests/smartCasts/varInInitNoPrimary.kt index c1078e0fd42..4f7e1c2cad4 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varInInitNoPrimary.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varInInitNoPrimary.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class Your { init { var y: String? = "xyz" diff --git a/compiler/testData/diagnostics/tests/smartCasts/varInInitializer.fir.kt b/compiler/testData/diagnostics/tests/smartCasts/varInInitializer.fir.kt index ff5328b96e4..9db530e6266 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varInInitializer.fir.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varInInitializer.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class My { val x: Int init { diff --git a/compiler/testData/diagnostics/tests/smartCasts/varInInitializer.kt b/compiler/testData/diagnostics/tests/smartCasts/varInInitializer.kt index bb34ebb47cf..24713f425bc 100644 --- a/compiler/testData/diagnostics/tests/smartCasts/varInInitializer.kt +++ b/compiler/testData/diagnostics/tests/smartCasts/varInInitializer.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class My { val x: Int init { diff --git a/compiler/testData/diagnostics/tests/subtyping/memberAnonymousObjects.fir.kt b/compiler/testData/diagnostics/tests/subtyping/memberAnonymousObjects.fir.kt index 053e42a98a2..8ecc2315fab 100644 --- a/compiler/testData/diagnostics/tests/subtyping/memberAnonymousObjects.fir.kt +++ b/compiler/testData/diagnostics/tests/subtyping/memberAnonymousObjects.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class Test { private var x = object {}; init { diff --git a/compiler/testData/diagnostics/tests/subtyping/memberAnonymousObjects.kt b/compiler/testData/diagnostics/tests/subtyping/memberAnonymousObjects.kt index e088474c99b..df1e27c5d93 100644 --- a/compiler/testData/diagnostics/tests/subtyping/memberAnonymousObjects.kt +++ b/compiler/testData/diagnostics/tests/subtyping/memberAnonymousObjects.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE class Test { private var x = object {}; init { diff --git a/compiler/testData/diagnostics/tests/testsWithJava17/jvmRecord/irrelevantFields.fir.kt b/compiler/testData/diagnostics/tests/testsWithJava17/jvmRecord/irrelevantFields.fir.kt index 0b16d255ab1..41c04e6be89 100644 --- a/compiler/testData/diagnostics/tests/testsWithJava17/jvmRecord/irrelevantFields.fir.kt +++ b/compiler/testData/diagnostics/tests/testsWithJava17/jvmRecord/irrelevantFields.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_DISABLE_LAZY_RESOLVE_CHECKS // !API_VERSION: 1.5 // !LANGUAGE: +JvmRecordSupport diff --git a/compiler/testData/diagnostics/tests/testsWithJava17/jvmRecord/irrelevantFields.kt b/compiler/testData/diagnostics/tests/testsWithJava17/jvmRecord/irrelevantFields.kt index b8661930f4d..4bb6f0f1310 100644 --- a/compiler/testData/diagnostics/tests/testsWithJava17/jvmRecord/irrelevantFields.kt +++ b/compiler/testData/diagnostics/tests/testsWithJava17/jvmRecord/irrelevantFields.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_DISABLE_LAZY_RESOLVE_CHECKS // !API_VERSION: 1.5 // !LANGUAGE: +JvmRecordSupport diff --git a/compiler/testData/diagnostics/tests/valueClasses/annotations.kt b/compiler/testData/diagnostics/tests/valueClasses/annotations.kt index af6bdfd4852..eeb5759e158 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/annotations.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/annotations.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: +ValueClasses // WITH_STDLIB // SKIP_TXT diff --git a/compiler/testData/diagnostics/tests/valueClasses/presenceOfInitializerBlockInsideValueClass.kt b/compiler/testData/diagnostics/tests/valueClasses/presenceOfInitializerBlockInsideValueClass.kt index 3afc3e54c84..a3e1ec29e8d 100644 --- a/compiler/testData/diagnostics/tests/valueClasses/presenceOfInitializerBlockInsideValueClass.kt +++ b/compiler/testData/diagnostics/tests/valueClasses/presenceOfInitializerBlockInsideValueClass.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // !SKIP_JAVAC // FIR_IDENTICAL diff --git a/compiler/testData/diagnostics/tests/varargs/kt1838-param.kt b/compiler/testData/diagnostics/tests/varargs/kt1838-param.kt index faf83f77a78..bf6aed051fc 100644 --- a/compiler/testData/diagnostics/tests/varargs/kt1838-param.kt +++ b/compiler/testData/diagnostics/tests/varargs/kt1838-param.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL class A(vararg t : Int) { init { diff --git a/compiler/testData/diagnostics/tests/varargs/kt1838-val.kt b/compiler/testData/diagnostics/tests/varargs/kt1838-val.kt index 3c8ddd97e1b..98f793456f4 100644 --- a/compiler/testData/diagnostics/tests/varargs/kt1838-val.kt +++ b/compiler/testData/diagnostics/tests/varargs/kt1838-val.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL class A(vararg val t : Int) { init { diff --git a/compiler/testData/diagnostics/tests/variance/privateToThis/FunctionCall.fir.kt b/compiler/testData/diagnostics/tests/variance/privateToThis/FunctionCall.fir.kt index e144342570d..b04690f6481 100644 --- a/compiler/testData/diagnostics/tests/variance/privateToThis/FunctionCall.fir.kt +++ b/compiler/testData/diagnostics/tests/variance/privateToThis/FunctionCall.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE fun getT(): T = null!! class Test { diff --git a/compiler/testData/diagnostics/tests/variance/privateToThis/FunctionCall.kt b/compiler/testData/diagnostics/tests/variance/privateToThis/FunctionCall.kt index ff413edf3aa..877764454d2 100644 --- a/compiler/testData/diagnostics/tests/variance/privateToThis/FunctionCall.kt +++ b/compiler/testData/diagnostics/tests/variance/privateToThis/FunctionCall.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE fun getT(): T = null!! class Test { diff --git a/compiler/testData/diagnostics/tests/variance/privateToThis/GetVal.fir.kt b/compiler/testData/diagnostics/tests/variance/privateToThis/GetVal.fir.kt index 966fb6a2ee9..61622ca5eba 100644 --- a/compiler/testData/diagnostics/tests/variance/privateToThis/GetVal.fir.kt +++ b/compiler/testData/diagnostics/tests/variance/privateToThis/GetVal.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE fun getT(): T = null!! class Test { diff --git a/compiler/testData/diagnostics/tests/variance/privateToThis/GetVal.kt b/compiler/testData/diagnostics/tests/variance/privateToThis/GetVal.kt index cf8ae91cda6..51aa6dd34ee 100644 --- a/compiler/testData/diagnostics/tests/variance/privateToThis/GetVal.kt +++ b/compiler/testData/diagnostics/tests/variance/privateToThis/GetVal.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE fun getT(): T = null!! class Test { diff --git a/compiler/testData/diagnostics/tests/variance/privateToThis/SetVar.fir.kt b/compiler/testData/diagnostics/tests/variance/privateToThis/SetVar.fir.kt index a8a731f8a46..f2176354448 100644 --- a/compiler/testData/diagnostics/tests/variance/privateToThis/SetVar.fir.kt +++ b/compiler/testData/diagnostics/tests/variance/privateToThis/SetVar.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE fun getT(): T = null!! class Test { diff --git a/compiler/testData/diagnostics/tests/variance/privateToThis/SetVar.kt b/compiler/testData/diagnostics/tests/variance/privateToThis/SetVar.kt index b9cf5071f44..35a199d2403 100644 --- a/compiler/testData/diagnostics/tests/variance/privateToThis/SetVar.kt +++ b/compiler/testData/diagnostics/tests/variance/privateToThis/SetVar.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE fun getT(): T = null!! class Test { diff --git a/compiler/testData/diagnostics/tests/variance/privateToThis/ValReassigned.kt b/compiler/testData/diagnostics/tests/variance/privateToThis/ValReassigned.kt index bf5f28cfa7a..e2e6c3e92a8 100644 --- a/compiler/testData/diagnostics/tests/variance/privateToThis/ValReassigned.kt +++ b/compiler/testData/diagnostics/tests/variance/privateToThis/ValReassigned.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL fun getT(): T = null!! diff --git a/compiler/testData/diagnostics/tests/when/PropertyNotInitialized.fir.kt b/compiler/testData/diagnostics/tests/when/PropertyNotInitialized.fir.kt index 14bde5483b8..5f48f19aa9a 100644 --- a/compiler/testData/diagnostics/tests/when/PropertyNotInitialized.fir.kt +++ b/compiler/testData/diagnostics/tests/when/PropertyNotInitialized.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE /* * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) * diff --git a/compiler/testData/diagnostics/tests/when/PropertyNotInitialized.kt b/compiler/testData/diagnostics/tests/when/PropertyNotInitialized.kt index 1423456d9be..5561c8066ed 100644 --- a/compiler/testData/diagnostics/tests/when/PropertyNotInitialized.kt +++ b/compiler/testData/diagnostics/tests/when/PropertyNotInitialized.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE /* * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) * diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/simple.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/simple.kt index 1d1bb33a310..5b9ca598247 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/simple.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/simple.kt @@ -1,3 +1,4 @@ +// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL @Retention(AnnotationRetention.SOURCE) @Repeatable @@ -5,6 +6,8 @@ annotation class Ann(val i: Int) annotation class AnnIA(val ia: IntArray) annotation class AnnSA(val sa: Array) +var i = 1 + @Ann(MyClass().i) @Ann(i) @Ann(i2) @@ -15,7 +18,6 @@ class Test { @Ann(i) val i2 = 1 } -var i = 1 val i2 = foo() fun foo(): Int = 1 diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/useOfNonConstVal.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/useOfNonConstVal.fir.kt index d2b8f20956e..ae4cd577d53 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/useOfNonConstVal.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/useOfNonConstVal.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE val nonConst = 1 const val constConst = nonConst * nonConst + 2 diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/useOfNonConstVal.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/useOfNonConstVal.kt index 9b3252f3bc0..d09b0f4cb55 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/useOfNonConstVal.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationParameterMustBeConstant/useOfNonConstVal.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE val nonConst = 1 const val constConst = nonConst * nonConst + 2 diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationTargetResolvedAmbiguously.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationTargetResolvedAmbiguously.fir.kt index 4a2e6078bc1..42b6cd5a77f 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationTargetResolvedAmbiguously.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationTargetResolvedAmbiguously.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE import kotlin.annotation.AnnotationTarget.FIELD object Some { diff --git a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationTargetResolvedAmbiguously.kt b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationTargetResolvedAmbiguously.kt index 952fe9b828f..00c9caa488e 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationTargetResolvedAmbiguously.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/annotations/annotationTargetResolvedAmbiguously.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE import kotlin.annotation.AnnotationTarget.FIELD object Some { diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/exactlyOnce/valDefiniteInitialization.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/exactlyOnce/valDefiniteInitialization.fir.kt index b4a7eb3a6af..79b8359396e 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/exactlyOnce/valDefiniteInitialization.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/exactlyOnce/valDefiniteInitialization.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect // !OPT_IN: kotlin.contracts.ExperimentalContracts // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/exactlyOnce/valDefiniteInitialization.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/exactlyOnce/valDefiniteInitialization.kt index 585bfeae44a..b91538805e4 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/exactlyOnce/valDefiniteInitialization.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/controlflow/initialization/exactlyOnce/valDefiniteInitialization.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: +AllowContractsForCustomFunctions +UseCallsInPlaceEffect // !OPT_IN: kotlin.contracts.ExperimentalContracts // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/errors/contractCallSites.1.4.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/errors/contractCallSites.1.4.fir.kt index 7a17bec7dc9..8b4e49087a7 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/errors/contractCallSites.1.4.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/errors/contractCallSites.1.4.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect +AllowContractsForNonOverridableMembers +AllowReifiedGenericsInContracts // !OPT_IN: kotlin.contracts.ExperimentalContracts // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER -NOTHING_TO_INLINE -ABSTRACT_FUNCTION_IN_NON_ABSTRACT_CLASS -ABSTRACT_FUNCTION_WITH_BODY -UNUSED_PARAMETER -UNUSED_VARIABLE -EXPERIMENTAL_FEATURE_WARNING diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/errors/contractCallSites.1.4.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/errors/contractCallSites.1.4.kt index 45248fdbde3..1ed58c63986 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/errors/contractCallSites.1.4.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/errors/contractCallSites.1.4.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: +AllowContractsForCustomFunctions +UseReturnsEffect +AllowContractsForNonOverridableMembers +AllowReifiedGenericsInContracts // !OPT_IN: kotlin.contracts.ExperimentalContracts // !DIAGNOSTICS: -INVISIBLE_REFERENCE -INVISIBLE_MEMBER -NOTHING_TO_INLINE -ABSTRACT_FUNCTION_IN_NON_ABSTRACT_CLASS -ABSTRACT_FUNCTION_WITH_BODY -UNUSED_PARAMETER -UNUSED_VARIABLE -EXPERIMENTAL_FEATURE_WARNING diff --git a/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/rewriteAtSliceFunctor.kt b/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/rewriteAtSliceFunctor.kt index 119cb1928e7..e699a339bf7 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/rewriteAtSliceFunctor.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/contracts/dsl/rewriteAtSliceFunctor.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // See KT-28847 diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/illegalSuspendCalls.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/illegalSuspendCalls.kt index 5f5451466ca..4f907a2731c 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/illegalSuspendCalls.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/illegalSuspendCalls.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL import Host.bar diff --git a/compiler/testData/diagnostics/testsWithStdLib/exitProcess.kt b/compiler/testData/diagnostics/testsWithStdLib/exitProcess.kt index 35e273c032b..e103caf148d 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/exitProcess.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/exitProcess.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL import java.io.File import kotlin.system.exitProcess diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/subclassOptInInheritance.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/subclassOptInInheritance.kt index 5c191ff5f08..2405c5c0ec8 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/subclassOptInInheritance.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/subclassOptInInheritance.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL @RequiresOptIn annotation class Marker diff --git a/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalTargets.kt b/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalTargets.kt index 0838864f424..de73a03df6a 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalTargets.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/experimental/useExperimentalTargets.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // !OPT_IN: kotlin.RequiresOptIn // !DIAGNOSTICS: -UNUSED_PARAMETER diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/rerunStagesAfterFixationInPartialMode.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/rerunStagesAfterFixationInPartialMode.kt index e5f8bbdaced..64d4b84132b 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/rerunStagesAfterFixationInPartialMode.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/completion/postponedArgumentsAnalysis/rerunStagesAfterFixationInPartialMode.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/kt32345.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/kt32345.fir.kt index 7855582e886..2de407aaef6 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/kt32345.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/kt32345.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_VARIABLE import kotlin.reflect.KProperty diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/kt32345.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/kt32345.kt index cbd2e0f0482..16c6f507053 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/kt32345.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/kt32345.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_VARIABLE import kotlin.reflect.KProperty diff --git a/compiler/testData/diagnostics/testsWithStdLib/kt9078.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/kt9078.fir.kt index 3894f4f527c..27ba075a9ad 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/kt9078.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/kt9078.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // KT-9078 (NPE in control flow analysis); EA-71535 abstract class KFunctionKt9005WorkAround(private val _functionInstance: Function) { private val _reflectedFunction: kotlin.reflect.KFunction = _functionInstance.reflect() ?: throw IllegalStateException("") diff --git a/compiler/testData/diagnostics/testsWithStdLib/kt9078.kt b/compiler/testData/diagnostics/testsWithStdLib/kt9078.kt index 1f5949363f5..968b1e39f01 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/kt9078.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/kt9078.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // KT-9078 (NPE in control flow analysis); EA-71535 abstract class KFunctionKt9005WorkAround(private val _functionInstance: Function) { private val _reflectedFunction: kotlin.reflect.KFunction = _functionInstance.reflect() ?: throw IllegalStateException("") diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/pos/1.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/pos/1.3.fir.kt index 776fb4ad4e6..57061e8f587 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/pos/1.3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/abstract-classes/p-2/pos/1.3.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.1.fir.kt index 2e8e436fcca..801763b10f9 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.1.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.2.fir.kt index eebd43da773..f413295e4b8 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.2.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.3.fir.kt index 607c2bacc0d..e07181ba0ee 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/1.3.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/2.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/2.1.fir.kt index 16f32831f75..7b8a86ddaef 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/2.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/2.1.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_PARAMETER -UNRESOLVED_REFERENCE -UNREACHABLE_CODE // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/2.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/2.2.fir.kt index 270b220d7cd..989bdad624d 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/2.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/2.2.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_PARAMETER -UNRESOLVED_REFERENCE -UNREACHABLE_CODE // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/2.3.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/2.3.fir.kt index 0e2faf2ef85..a0de45e0881 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/2.3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/2.3.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_PARAMETER -UNRESOLVED_REFERENCE -UNREACHABLE_CODE // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/3.1.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/3.1.fir.kt index f86489dfba9..8ea60cc0f24 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/3.1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration/constructor-declaration/p-5/pos/3.1.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_PARAMETER -UNREACHABLE_CODE // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-system/introduction-1/p-6/neg/2.2.fir.kt b/compiler/tests-spec/testData/diagnostics/linked/type-system/introduction-1/p-6/neg/2.2.fir.kt index e8552ae6a70..fa33372e65d 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/type-system/introduction-1/p-6/neg/2.2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/type-system/introduction-1/p-6/neg/2.2.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_PARAMETER -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/5.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/5.fir.kt index b1bfdd955ab..3bc9d1af0ed 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/5.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/5.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // TESTCASE NUMBER: 1, 2 @Target(AnnotationTarget.TYPE) annotation class Ann(val x: Int) diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/1.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/1.fir.kt index de28d2662c6..545bb0baedb 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/1.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !OPT_IN: kotlin.contracts.ExperimentalContracts // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/3.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/3.fir.kt index 04655ecc1cf..0aa0c8103c5 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/neg/3.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !OPT_IN: kotlin.contracts.ExperimentalContracts // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/1.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/1.kt index 4ee886d95c7..6ab74a7029d 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/1.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/1.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // FIR_IDENTICAL // !OPT_IN: kotlin.contracts.ExperimentalContracts // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/3.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/3.fir.kt index 9505237d260..20d2d374433 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/analysis/controlFlow/initialization/pos/3.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !OPT_IN: kotlin.contracts.ExperimentalContracts // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/6.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/6.fir.kt index 780485cf909..a2dee8ecb31 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/6.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/6.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !LANGUAGE: +AllowContractsForNonOverridableMembers +AllowReifiedGenericsInContracts // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER -UNREACHABLE_CODE -UNUSED_EXPRESSION // !OPT_IN: kotlin.contracts.ExperimentalContracts diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/1.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/1.fir.kt index 71bab91cee1..0667e6b4c1e 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/1.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE // SKIP_TXT // WITH_EXTENDED_CHECKERS diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/21.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/21.fir.kt index 3336d81175b..d8f71881074 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/21.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/21.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/30.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/30.fir.kt index c96d20f1eeb..51b9430afb5 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/30.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/30.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/1.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/1.fir.kt index af82054abfb..51dd52f27ff 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/1.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT // TODO: https://youtrack.jetbrains.com/issue/KT-49862 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/2.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/2.fir.kt index 32c641c13ee..bdd3b1696a9 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/2.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/3.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/3.fir.kt index 26c7c55ad55..d71c5d92dcb 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/3.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE // SKIP_TXT // WITH_EXTENDED_CHECKERS diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/4.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/4.fir.kt index 69beea19344..8ff3a5f4b30 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/4.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/4.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_EXPRESSION // SKIP_TXT diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/6.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/6.fir.kt index 9e2857c0eb9..b4b81b847b3 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/6.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/6.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNREACHABLE_CODE -CAN_BE_VAL // SKIP_TXT // WITH_EXTENDED_CHECKERS diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/61.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/61.fir.kt index fab659da118..d617a63d04e 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/61.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/61.fir.kt @@ -1,4 +1,3 @@ -// IGNORE_REVERSED_RESOLVE // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER // SKIP_TXT