diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/KJKComplexHierarchyWithNested.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/KJKComplexHierarchyWithNested.kt index c061c4a9804..b56220f6c3b 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/KJKComplexHierarchyWithNested.kt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/j+k/KJKComplexHierarchyWithNested.kt @@ -1,4 +1,3 @@ -// FIR_IDE_IGNORE // FILE: K1.kt class KSub : J1() diff --git a/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/KJKComplexHierarchyNestedLoop.kt b/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/KJKComplexHierarchyNestedLoop.kt index b02bc47ab66..418495b5127 100644 --- a/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/KJKComplexHierarchyNestedLoop.kt +++ b/compiler/fir/analysis-tests/testData/resolveWithStdlib/problems/KJKComplexHierarchyNestedLoop.kt @@ -1,4 +1,3 @@ -// FIR_IDE_IGNORE // FILE: K1.kt class K2: J1() { class Q : Nested() diff --git a/compiler/test-infrastructure-utils/tests/org/jetbrains/kotlin/test/Assertions.kt b/compiler/test-infrastructure-utils/tests/org/jetbrains/kotlin/test/Assertions.kt index 349f47219e6..8f3f4261ff5 100644 --- a/compiler/test-infrastructure-utils/tests/org/jetbrains/kotlin/test/Assertions.kt +++ b/compiler/test-infrastructure-utils/tests/org/jetbrains/kotlin/test/Assertions.kt @@ -6,12 +6,17 @@ package org.jetbrains.kotlin.test import java.io.File +import java.nio.file.Path abstract class Assertions { fun assertEqualsToFile(expectedFile: File, actual: String, sanitizer: (String) -> String = { it }) { assertEqualsToFile(expectedFile, actual, sanitizer) { "Actual data differs from file content" } } + fun assertEqualsToFile(expectedFile: Path, actual: String, sanitizer: (String) -> String = { it }) { + assertEqualsToFile(expectedFile.toFile(), actual, sanitizer) + } + abstract fun assertEqualsToFile( expectedFile: File, actual: String, diff --git a/generators/frontend-api-generator/build.gradle.kts b/generators/frontend-api-generator/build.gradle.kts index 3bcde4ba124..2222f240027 100644 --- a/generators/frontend-api-generator/build.gradle.kts +++ b/generators/frontend-api-generator/build.gradle.kts @@ -17,6 +17,7 @@ dependencies { testCompile(projectTests(":compiler:tests-common")) testCompile(projectTests(":compiler:tests-spec")) testCompile(projectTests(":idea:idea-frontend-fir:idea-fir-low-level-api")) + testCompile(projectTests(":idea:idea-frontend-fir")) testCompile(intellijCoreDep()) { includeJars("intellij-core", "guava", rootProject = rootProject) } testApiJUnit5() } diff --git a/generators/frontend-api-generator/tests/org/jetbrains/kotlin/generators/tests/frontend/api/GenerateTests.kt b/generators/frontend-api-generator/tests/org/jetbrains/kotlin/generators/tests/frontend/api/GenerateTests.kt index 6844db34fb0..eecccedb14c 100644 --- a/generators/frontend-api-generator/tests/org/jetbrains/kotlin/generators/tests/frontend/api/GenerateTests.kt +++ b/generators/frontend-api-generator/tests/org/jetbrains/kotlin/generators/tests/frontend/api/GenerateTests.kt @@ -6,6 +6,16 @@ package org.jetbrains.kotlin.generators.tests.frontend.api import org.jetbrains.kotlin.generators.util.TestGeneratorUtil +import org.jetbrains.kotlin.idea.fir.frontend.api.components.AbstractExpectedExpressionTypeTest +import org.jetbrains.kotlin.idea.fir.frontend.api.components.AbstractHLExpressionTypeTest +import org.jetbrains.kotlin.idea.fir.frontend.api.components.AbstractOverriddenDeclarationProviderTest +import org.jetbrains.kotlin.idea.fir.frontend.api.components.AbstractRendererTest +import org.jetbrains.kotlin.idea.fir.frontend.api.fir.AbstractResolveCallTest +import org.jetbrains.kotlin.idea.fir.frontend.api.scopes.AbstractFileScopeTest +import org.jetbrains.kotlin.idea.fir.frontend.api.scopes.AbstractMemberScopeByFqNameTest +import org.jetbrains.kotlin.idea.fir.frontend.api.symbols.AbstractSymbolByFqNameTest +import org.jetbrains.kotlin.idea.fir.frontend.api.symbols.AbstractSymbolByPsiTest +import org.jetbrains.kotlin.idea.fir.frontend.api.symbols.AbstractSymbolByReferenceTest import org.jetbrains.kotlin.idea.fir.low.level.api.AbstractFirLazyBodiesCalculatorTest import org.jetbrains.kotlin.idea.fir.low.level.api.AbstractFirLazyDeclarationResolveTest import org.jetbrains.kotlin.idea.fir.low.level.api.AbstractFirOnAirResolveTest @@ -26,6 +36,50 @@ fun main(args: Array) { generateTestGroupSuiteWithJUnit5(args) { + + testGroup("idea/idea-frontend-fir/tests", "idea/idea-frontend-fir/testData") { + testClass { + model("analysisSession/resolveCall") + } + + testClass { + model("memberScopeByFqName") + } + + testClass { + model("fileScopeTest", extension = "kt") + } + + testClass { + model("symbols/symbolByPsi") + } + + testClass { + model("symbols/symbolByFqName") + } + + // todo +// testClass { +// model("symbols/symbolByReference") +// } + + testClass { + model("components/expectedExpressionType") + } + + testClass { + model("components/overridenDeclarations") + } + + testClass { + model("components/expressionType") + } + + testClass { + model("components/declarationRenderer") + } + } + testGroup("idea/idea-frontend-fir/idea-fir-low-level-api/tests", "compiler/fir/raw-fir/psi2fir/testData") { testClass { model("rawBuilder", testMethod = "doTest") diff --git a/generators/idea-generator/tests/org/jetbrains/kotlin/generators/tests/idea/GenerateTests.kt b/generators/idea-generator/tests/org/jetbrains/kotlin/generators/tests/idea/GenerateTests.kt index dc777b435db..e84e4613475 100644 --- a/generators/idea-generator/tests/org/jetbrains/kotlin/generators/tests/idea/GenerateTests.kt +++ b/generators/idea-generator/tests/org/jetbrains/kotlin/generators/tests/idea/GenerateTests.kt @@ -70,7 +70,6 @@ import org.jetbrains.kotlin.idea.editor.AbstractMultiLineStringIndentTest import org.jetbrains.kotlin.idea.editor.backspaceHandler.AbstractBackspaceHandlerTest import org.jetbrains.kotlin.idea.editor.quickDoc.AbstractQuickDocProviderTest import org.jetbrains.kotlin.idea.filters.AbstractKotlinExceptionFilterTest -import org.jetbrains.kotlin.idea.fir.AbstractKtDeclarationAndFirDeclarationEqualityChecker import org.jetbrains.kotlin.idea.fir.asJava.classes.AbstractFirClassLoadingTest import org.jetbrains.kotlin.idea.fir.asJava.classes.AbstractFirLightClassTest import org.jetbrains.kotlin.idea.fir.asJava.classes.AbstractFirLightFacadeClassTest @@ -86,29 +85,13 @@ import org.jetbrains.kotlin.idea.fir.highlighter.AbstractFirHighlightingTest import org.jetbrains.kotlin.idea.fir.inspections.AbstractHLInspectionTest import org.jetbrains.kotlin.idea.fir.inspections.AbstractHLLocalInspectionTest import org.jetbrains.kotlin.idea.fir.intentions.AbstractHLIntentionTest -import org.jetbrains.kotlin.idea.fir.low.level.api.* -import org.jetbrains.kotlin.idea.fir.low.level.api.diagnostic.compiler.based.AbstractDiagnosisCompilerTestDataSpecTest -import org.jetbrains.kotlin.idea.fir.low.level.api.diagnostic.compiler.based.AbstractDiagnosisCompilerTestDataTest -import org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.AbstractFileStructureTest -import org.jetbrains.kotlin.idea.fir.low.level.api.resolve.AbstractInnerDeclarationsResolvePhaseTest import org.jetbrains.kotlin.idea.fir.low.level.api.sessions.AbstractSessionsInvalidationTest import org.jetbrains.kotlin.idea.fir.low.level.api.trackers.AbstractProjectWideOutOfBlockKotlinModificationTrackerTest import org.jetbrains.kotlin.idea.fir.quickfix.AbstractHighLevelQuickFixMultiFileTest import org.jetbrains.kotlin.idea.fir.quickfix.AbstractHighLevelQuickFixTest import org.jetbrains.kotlin.idea.fir.resolve.AbstractFirReferenceResolveTest import org.jetbrains.kotlin.idea.folding.AbstractKotlinFoldingTest -import org.jetbrains.kotlin.idea.frontend.api.components.* -import org.jetbrains.kotlin.idea.fir.frontend.api.fir.AbstractResolveCallTest -import org.jetbrains.kotlin.idea.fir.frontend.api.scopes.AbstractFileScopeTest -import org.jetbrains.kotlin.idea.fir.frontend.api.scopes.AbstractMemberScopeByFqNameTest -import org.jetbrains.kotlin.idea.fir.frontend.api.symbols.AbstractMemoryLeakInSymbolsTest -import org.jetbrains.kotlin.idea.fir.frontend.api.symbols.AbstractSymbolByFqNameTest -import org.jetbrains.kotlin.idea.fir.frontend.api.symbols.AbstractSymbolByPsiTest -import org.jetbrains.kotlin.idea.fir.frontend.api.symbols.AbstractSymbolByReferenceTest import org.jetbrains.kotlin.idea.fir.inspections.AbstractFe10BindingIntentionTest -import org.jetbrains.kotlin.idea.fir.low.level.api.diagnostic.AbstractDiagnosticTraversalCounterTest -import org.jetbrains.kotlin.idea.fir.low.level.api.diagnostic.AbstractFirContextCollectionTest -//import org.jetbrains.kotlin.idea.fir.low.level.api.file.structure.AbstractFileStructureAndOutOfBlockModificationTrackerConsistencyTest import org.jetbrains.kotlin.idea.hierarchy.AbstractHierarchyTest import org.jetbrains.kotlin.idea.hierarchy.AbstractHierarchyWithLibTest import org.jetbrains.kotlin.idea.highlighter.* @@ -995,59 +978,7 @@ fun main(args: Array) { } } - testGroup("idea/idea-frontend-fir/tests", "idea/idea-frontend-fir/testData") { - testClass { - model("ktDeclarationAndFirDeclarationEqualityChecker") - } - testClass { - model("analysisSession/resolveCall") - } - - testClass { - model("memberScopeByFqName") - } - - testClass { - model("fileScopeTest", extension = "kt") - } - - testClass { - model("symbols/symbolByPsi") - } - - testClass { - model("symbols/symbolByFqName") - } - - testClass { - model("symbols/symbolByReference") - } - - testClass { - model("symbolMemoryLeak") - } - - testClass { - model("components/returnExpressionTarget") - } - - testClass { - model("components/expectedExpressionType") - } - - testClass { - model("components/overridenDeclarations") - } - - testClass { - model("components/expressionType") - } - - testClass { - model("components/declarationRenderer") - } - } testGroup("idea/idea-frontend-fir/fir-low-level-api-ide-impl/tests", "idea/idea-frontend-fir/idea-fir-low-level-api/testdata") { diff --git a/idea/idea-fir/tests/org/jetbrains/kotlin/idea/fir/testUtils.kt b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/fir/testUtils.kt new file mode 100644 index 00000000000..bf8d777e52c --- /dev/null +++ b/idea/idea-fir/tests/org/jetbrains/kotlin/idea/fir/testUtils.kt @@ -0,0 +1,57 @@ +/* + * 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.idea.fir + +import com.intellij.openapi.application.ApplicationManager +import com.intellij.openapi.components.service +import com.intellij.openapi.project.Project +import com.intellij.openapi.util.io.FileUtil +import com.intellij.testFramework.LightPlatformTestCase +import org.jetbrains.kotlin.idea.caches.project.LibraryModificationTracker +import org.jetbrains.kotlin.idea.fir.low.level.api.api.KotlinOutOfBlockModificationTrackerFactory +import org.jetbrains.kotlin.idea.frontend.api.InvalidWayOfUsingAnalysisSession +import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSessionProvider +import org.jetbrains.kotlin.idea.frontend.api.analyse +import org.jetbrains.kotlin.idea.util.application.runWriteAction +import org.jetbrains.kotlin.psi.KtElement +import java.io.File + +@OptIn(InvalidWayOfUsingAnalysisSession::class) +fun Project.invalidateCaches(context: KtElement?) { + LibraryModificationTracker.getInstance(this).incModificationCount() + service().incrementModificationsCount() + service().clearCaches() + if (context != null) { + ApplicationManager.getApplication().executeOnPooledThread { + runReadAction { analyse(context) { } } + }.get() + } +} + +fun addExternalTestFiles(testDataFilePath: String) { + File(testDataFilePath).getExternalFiles().forEach(::addFile) +} + +private fun addFile(file: File) { + addFile(FileUtil.loadFile(file, /* convertLineSeparators = */true), file.name) +} + +private fun File.getExternalFiles(): List { + val directory = parentFile + val externalFileName = "${nameWithoutExtension}.external" + return directory.listFiles { _, name -> + name == "$externalFileName.kt" || name == "$externalFileName.java" + }!!.filterNotNull() +} + + +private fun addFile(text: String, fileName: String) { + runWriteAction { + val virtualDir = LightPlatformTestCase.getSourceRoot()!! + val virtualFile = virtualDir.createChildData(null, fileName) + virtualFile.getOutputStream(null)!!.writer().use { it.write(text) } + } +} \ No newline at end of file diff --git a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSessionProvider.kt b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSessionProvider.kt index 97748a8cb2e..e45eeb81c52 100644 --- a/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSessionProvider.kt +++ b/idea/idea-frontend-api/src/org/jetbrains/kotlin/idea/frontend/api/KtAnalysisSessionProvider.kt @@ -12,6 +12,7 @@ import com.intellij.openapi.progress.ProgressIndicator import com.intellij.openapi.progress.Task import com.intellij.openapi.project.Project import com.intellij.openapi.util.Computable +import org.jetbrains.annotations.TestOnly import org.jetbrains.kotlin.idea.frontend.api.tokens.AlwaysAccessibleValidityTokenFactory import org.jetbrains.kotlin.idea.frontend.api.tokens.ReadActionConfinementValidityTokenFactory import org.jetbrains.kotlin.idea.frontend.api.tokens.ValidityTokenFactory @@ -65,6 +66,9 @@ abstract class KtAnalysisSessionProvider : Disposable { } } + @TestOnly + abstract fun clearCaches() + override fun dispose() {} companion object { diff --git a/idea/idea-frontend-fir/build.gradle.kts b/idea/idea-frontend-fir/build.gradle.kts index 1d0a8cdbf58..56d48237a84 100644 --- a/idea/idea-frontend-fir/build.gradle.kts +++ b/idea/idea-frontend-fir/build.gradle.kts @@ -18,19 +18,35 @@ dependencies { compile(project(":compiler:light-classes")) compile(intellijCoreDep()) - testCompile(project(":idea:idea-fir")) - testCompile(intellijDep()) - testCompile(intellijCoreDep()) - testCompile(toolsJar()) - testCompile(project(":kotlin-reflect")) - testCompile(projectTests(":idea")) + testCompile(projectTests(":idea:idea-frontend-fir:idea-fir-low-level-api")) testCompile(projectTests(":compiler:tests-common")) - testCompile(projectTests(":idea:idea-test-framework")) + testCompile(projectTests(":compiler:test-infrastructure-utils")) + testCompile(projectTests(":compiler:test-infrastructure")) + testCompile(projectTests(":compiler:tests-common-new")) + testCompile(projectTests(":compiler:fir:analysis-tests:legacy-fir-tests")) testCompile(project(":kotlin-test:kotlin-test-junit")) - testCompile(commonDep("junit:junit")) - testCompile(projectTests(":idea:idea-frontend-independent")) + testCompile(toolsJar()) + testApiJUnit5() -// compile(intellijPluginDep("java")) + testRuntimeOnly(intellijDep()) { + includeJars( + "jps-model", + "extensions", + "util", + "platform-api", + "platform-impl", + "idea", + "guava", + "trove4j", + "asm-all", + "log4j", + "jdom", + "streamex", + "bootstrap", + "jna", + rootProject = rootProject + ) + } } sourceSets { @@ -38,19 +54,15 @@ sourceSets { "test" { projectDefault() } } -projectTest { +projectTest(jUnit5Enabled = true) { dependsOn(":dist") workingDir = rootDir - val useFirIdeaPlugin = kotlinBuildProperties.useFirIdeaPlugin - doFirst { - if (!useFirIdeaPlugin) { - error("Test task in the module should be executed with -Pidea.fir.plugin=true") - } - } + useJUnitPlatform() } testsJar() + val generatorClasspath by configurations.creating dependencies { diff --git a/idea/idea-frontend-fir/fir-low-level-api-ide-impl/src/org/jetbrains/kotlin/idea/fir/low/level/api/ide/FirModuleResolveStateConfiguratorIdeImpl.kt b/idea/idea-frontend-fir/fir-low-level-api-ide-impl/src/org/jetbrains/kotlin/idea/fir/low/level/api/ide/FirModuleResolveStateConfiguratorIdeImpl.kt index 2d7df0fc10d..a9adbe3ef2e 100644 --- a/idea/idea-frontend-fir/fir-low-level-api-ide-impl/src/org/jetbrains/kotlin/idea/fir/low/level/api/ide/FirModuleResolveStateConfiguratorIdeImpl.kt +++ b/idea/idea-frontend-fir/fir-low-level-api-ide-impl/src/org/jetbrains/kotlin/idea/fir/low/level/api/ide/FirModuleResolveStateConfiguratorIdeImpl.kt @@ -14,6 +14,7 @@ import org.jetbrains.kotlin.analyzer.ModuleSourceInfoBase import org.jetbrains.kotlin.analyzer.SdkInfoBase import org.jetbrains.kotlin.config.LanguageVersionSettings import org.jetbrains.kotlin.fir.DependencyListForCliModule +import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.declarations.SealedClassInheritorsProvider import org.jetbrains.kotlin.fir.dependenciesWithoutSelf import org.jetbrains.kotlin.fir.deserialization.ModuleDataProvider @@ -99,4 +100,7 @@ class FirModuleResolveStateConfiguratorIdeImpl(private val project: Project) : F override fun getModuleInfoFor(element: KtElement): ModuleInfo { return element.getModuleInfo() } + + override fun configureSourceSession(session: FirSession) { + } } \ No newline at end of file diff --git a/idea/idea-frontend-fir/fir-low-level-api-ide-impl/src/org/jetbrains/kotlin/idea/fir/low/level/api/ide/trackers/KotlinFirOutOfBlockModificationTrackerFactory.kt b/idea/idea-frontend-fir/fir-low-level-api-ide-impl/src/org/jetbrains/kotlin/idea/fir/low/level/api/ide/trackers/KotlinFirOutOfBlockModificationTrackerFactory.kt index c2682d28aad..8c183f7eefe 100644 --- a/idea/idea-frontend-fir/fir-low-level-api-ide-impl/src/org/jetbrains/kotlin/idea/fir/low/level/api/ide/trackers/KotlinFirOutOfBlockModificationTrackerFactory.kt +++ b/idea/idea-frontend-fir/fir-low-level-api-ide-impl/src/org/jetbrains/kotlin/idea/fir/low/level/api/ide/trackers/KotlinFirOutOfBlockModificationTrackerFactory.kt @@ -29,7 +29,7 @@ class KotlinFirOutOfBlockModificationTrackerFactory(private val project: Project } @TestOnly - fun incrementModificationsCount() { + override fun incrementModificationsCount() { project.service().increaseModificationCountForAllModules() } } diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/build.gradle.kts b/idea/idea-frontend-fir/idea-fir-low-level-api/build.gradle.kts index 7064bf59316..e801cf8ca95 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/build.gradle.kts +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/build.gradle.kts @@ -31,6 +31,7 @@ dependencies { testCompile(projectTests(":compiler:fir:analysis-tests:legacy-fir-tests")) testCompile(project(":kotlin-test:kotlin-test-junit")) testApiJUnit5() + testCompile(project(":kotlin-reflect")) } sourceSets { diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/FirModuleResolveStateConfigurator.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/FirModuleResolveStateConfigurator.kt index 5bbd1fa9861..b6e9e96d07d 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/FirModuleResolveStateConfigurator.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/FirModuleResolveStateConfigurator.kt @@ -7,14 +7,18 @@ package org.jetbrains.kotlin.idea.fir.low.level.api.api import com.intellij.openapi.components.ServiceManager import com.intellij.openapi.project.Project +import com.intellij.psi.PsiElementFinder import com.intellij.psi.search.GlobalSearchScope import org.jetbrains.kotlin.analyzer.ModuleInfo import org.jetbrains.kotlin.analyzer.ModuleSourceInfoBase import org.jetbrains.kotlin.config.LanguageVersionSettings +import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.declarations.SealedClassInheritorsProvider import org.jetbrains.kotlin.fir.deserialization.ModuleDataProvider +import org.jetbrains.kotlin.fir.java.FirJavaElementFinder import org.jetbrains.kotlin.idea.fir.low.level.api.DeclarationProvider import org.jetbrains.kotlin.idea.fir.low.level.api.KtPackageProvider +import org.jetbrains.kotlin.idea.fir.low.level.api.sessions.FirIdeSourcesSession import org.jetbrains.kotlin.load.kotlin.PackagePartProvider import org.jetbrains.kotlin.psi.KtElement @@ -28,6 +32,8 @@ abstract class FirModuleResolveStateConfigurator { abstract fun createScopeForModuleLibraries(moduleInfo: ModuleSourceInfoBase): GlobalSearchScope abstract fun createSealedInheritorsProvider(): SealedClassInheritorsProvider abstract fun getModuleInfoFor(element: KtElement): ModuleInfo + + abstract fun configureSourceSession(session: FirSession) } val Project.stateConfigurator: FirModuleResolveStateConfigurator diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/KotlinOutOfBlockModificationTrackerFactory.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/KotlinOutOfBlockModificationTrackerFactory.kt index 9c8d0f7b046..0168c522938 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/KotlinOutOfBlockModificationTrackerFactory.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/api/KotlinOutOfBlockModificationTrackerFactory.kt @@ -9,6 +9,7 @@ import com.intellij.openapi.components.ServiceManager import com.intellij.openapi.module.Module import com.intellij.openapi.project.Project import com.intellij.openapi.util.ModificationTracker +import org.jetbrains.annotations.TestOnly import org.jetbrains.kotlin.analyzer.ModuleInfo import org.jetbrains.kotlin.analyzer.ModuleSourceInfoBase @@ -17,6 +18,9 @@ abstract class KotlinOutOfBlockModificationTrackerFactory { abstract fun createProjectWideOutOfBlockModificationTracker(): ModificationTracker abstract fun createModuleWithoutDependenciesOutOfBlockModificationTracker(moduleInfo: ModuleSourceInfoBase): ModificationTracker abstract fun createLibraryOutOfBlockModificationTracker(): ModificationTracker + + @TestOnly + abstract fun incrementModificationsCount() } fun Project.createProjectWideOutOfBlockModificationTracker() = diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/diagnostics/AbstractFirIdeDiagnosticsCollector.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/diagnostics/AbstractFirIdeDiagnosticsCollector.kt index 0b9e150f6b1..70287b3ab5d 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/diagnostics/AbstractFirIdeDiagnosticsCollector.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/diagnostics/AbstractFirIdeDiagnosticsCollector.kt @@ -40,7 +40,7 @@ private object CheckersFactory { useExtendedCheckers: Boolean ): List { val moduleInfo = session.moduleData.moduleSourceInfo - val platform = moduleInfo.platform.componentPlatforms.single() + val platform = moduleInfo.platform.componentPlatforms.first() val declarationCheckers = createDeclarationCheckers(useExtendedCheckers, platform) val expressionCheckers = createExpressionCheckers(useExtendedCheckers) val typeCheckers = createTypeCheckers(useExtendedCheckers) diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/sessions/FirIdeSessionFactory.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/sessions/FirIdeSessionFactory.kt index 5eb16923d51..e2047168d2f 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/sessions/FirIdeSessionFactory.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/src/org/jetbrains/kotlin/idea/fir/low/level/api/sessions/FirIdeSessionFactory.kt @@ -6,6 +6,7 @@ package org.jetbrains.kotlin.idea.fir.low.level.api.sessions import com.intellij.openapi.project.Project +import com.intellij.psi.PsiElementFinder import org.jetbrains.kotlin.analyzer.LibraryModuleInfo import org.jetbrains.kotlin.analyzer.ModuleInfo import org.jetbrains.kotlin.analyzer.ModuleSourceInfoBase @@ -17,6 +18,7 @@ import org.jetbrains.kotlin.fir.backend.jvm.FirJvmTypeMapper import org.jetbrains.kotlin.fir.caches.FirCachesFactory import org.jetbrains.kotlin.fir.checkers.registerExtendedCommonCheckers import org.jetbrains.kotlin.fir.declarations.SealedClassInheritorsProvider +import org.jetbrains.kotlin.fir.java.FirJavaElementFinder import org.jetbrains.kotlin.fir.java.JavaSymbolProvider import org.jetbrains.kotlin.fir.java.deserialization.KotlinDeserializedJvmSymbolsProvider import org.jetbrains.kotlin.fir.resolve.providers.FirProvider @@ -78,7 +80,6 @@ internal object FirIdeSessionFactory { val session = FirIdeSourcesSession(dependentModules, project, searchScope, firBuilder, builtinTypes) sessionsCache[moduleInfo] = session - return session.apply session@{ val moduleData = FirModuleInfoBasedModuleData(moduleInfo).apply { bindSession(this@session) } registerModuleData(moduleData) @@ -155,8 +156,8 @@ internal object FirIdeSessionFactory { registerExtendedCommonCheckers() } }.configure() - configureSession?.invoke(this) + project.stateConfigurator.configureSourceSession(this) } } diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/compiler/based/FrontendApiTestWithTestdata.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/compiler/based/FrontendApiTestWithTestdata.kt index 2b470a939a1..165adc79db3 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/compiler/based/FrontendApiTestWithTestdata.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/compiler/based/FrontendApiTestWithTestdata.kt @@ -9,18 +9,23 @@ import com.intellij.mock.MockProject import com.intellij.psi.PsiElementFinder import com.intellij.psi.search.GlobalSearchScope import com.intellij.psi.search.ProjectScope +import org.jetbrains.annotations.NotNull import org.jetbrains.kotlin.analyzer.ModuleInfo import org.jetbrains.kotlin.analyzer.ModuleSourceInfoBase import org.jetbrains.kotlin.asJava.finder.JavaElementFinder +import org.jetbrains.kotlin.cli.jvm.compiler.JvmPackagePartProvider import org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM import org.jetbrains.kotlin.cli.jvm.config.jvmClasspathRoots import org.jetbrains.kotlin.cli.jvm.config.jvmModularRoots +import org.jetbrains.kotlin.config.CompilerConfiguration import org.jetbrains.kotlin.config.JVMConfigurationKeys import org.jetbrains.kotlin.config.LanguageVersionSettings import org.jetbrains.kotlin.fir.DependencyListForCliModule +import org.jetbrains.kotlin.fir.FirSession import org.jetbrains.kotlin.fir.analysis.FirAnalyzerFacade import org.jetbrains.kotlin.fir.declarations.SealedClassInheritorsProvider import org.jetbrains.kotlin.fir.deserialization.ModuleDataProvider +import org.jetbrains.kotlin.fir.java.FirJavaElementFinder import org.jetbrains.kotlin.fir.session.FirModuleInfoBasedModuleData import org.jetbrains.kotlin.idea.fir.low.level.api.* import org.jetbrains.kotlin.idea.fir.low.level.api.api.* @@ -74,23 +79,6 @@ abstract class FrontendApiTestWithTestdata : AbstractKotlinCompilerTest() { open fun TestConfigurationBuilder.configureTest() {} - private class TestModuleInfo( - val testModule: TestModule, - ) : ModuleInfo, ModuleSourceInfoBase { - override val name: Name get() = Name.identifier(testModule.name) - - override fun dependencies(): List { - return emptyList() - } - - override val platform: TargetPlatform - get() = testModule.targetPlatform - - override val analyzerServices: PlatformDependentAnalyzerServices - get() = testModule.targetPlatform.getAnalyzerServices() - } - - inner class LowLevelFirFrontendFacade( testServices: TestServices ) : FrontendFacade(testServices, FrontendKinds.FIR) { @@ -101,105 +89,29 @@ abstract class FrontendApiTestWithTestdata : AbstractKotlinCompilerTest() { get() = listOf(FirDiagnosticsDirectives) override fun analyze(module: TestModule): FirOutputArtifact { - val moduleInfoProvider = testServices.firModuleInfoProvider - val compilerConfigurationProvider = testServices.compilerConfigurationProvider - - val project = compilerConfigurationProvider.getProject(module) - + val project = testServices.compilerConfigurationProvider.getProject(module) + val ktFiles = testServices.sourceFileProvider.getKtFilesForSourceFiles(module.files, project) PsiElementFinder.EP.getPoint(project).unregisterExtension(JavaElementFinder::class.java) - val ktFiles = testServices.sourceFileProvider.getKtFilesForSourceFiles(module.files, project) - - val languageVersionSettings = module.languageVersionSettings - val packagePartProviderFactory = compilerConfigurationProvider.getPackagePartProviderFactory(module) - - val configuration = compilerConfigurationProvider.getCompilerConfiguration(module) - - val librariesScope = ProjectScope.getLibrariesScope(project) - val sourcesScope = TopDownAnalyzerFacadeForJVM.newModuleSearchScope(project, ktFiles.values) val moduleInfo = TestModuleInfo(module) - moduleInfoProvider.registerModuleData(module, FirModuleInfoBasedModuleData(moduleInfo)) - - - val configurator = object : FirModuleResolveStateConfigurator() { - private val sealedClassInheritorsProvider = SealedClassInheritorsProviderTestImpl() - - override fun createPackagePartsProvider(scope: GlobalSearchScope): PackagePartProvider { - return packagePartProviderFactory.invoke(scope) - } - - override fun createModuleDataProvider(moduleInfo: ModuleSourceInfoBase): ModuleDataProvider { - require(moduleInfo is TestModuleInfo) - return DependencyListForCliModule.build( - moduleInfo.name, - moduleInfo.platform, - moduleInfo.analyzerServices - ) { - dependencies(configuration.jvmModularRoots.map { it.toPath() }) - dependencies(configuration.jvmClasspathRoots.map { it.toPath() }) - - friendDependencies(configuration[JVMConfigurationKeys.FRIEND_PATHS] ?: emptyList()) - - sourceDependencies(moduleInfoProvider.getRegularDependentSourceModules(module)) - sourceFriendsDependencies(moduleInfoProvider.getDependentFriendSourceModules(module)) - sourceDependsOnDependencies(moduleInfoProvider.getDependentDependsOnSourceModules(module)) - }.moduleDataProvider - } - - override fun getLanguageVersionSettings(moduleInfo: ModuleSourceInfoBase): LanguageVersionSettings { - return languageVersionSettings - } - - override fun getModuleSourceScope(moduleInfo: ModuleSourceInfoBase): GlobalSearchScope { - return sourcesScope - } - - override fun createScopeForModuleLibraries(moduleInfo: ModuleSourceInfoBase): GlobalSearchScope { - return librariesScope - } - - override fun createSealedInheritorsProvider(): SealedClassInheritorsProvider { - return sealedClassInheritorsProvider - } - - override fun getModuleInfoFor(element: KtElement): ModuleInfo { - return moduleInfo - } - } + testServices.firModuleInfoProvider.registerModuleData(module, FirModuleInfoBasedModuleData(moduleInfo)) + val configurator = FirModuleResolveStateConfiguratorForSingleModuleTestImpl(testServices, module, ktFiles, moduleInfo) with(project as MockProject) { - registerService( - FirModuleResolveStateConfigurator::class.java, - configurator - ) - registerService(FirIdeResolveStateService::class.java) - registerService( - KotlinOutOfBlockModificationTrackerFactory::class.java, - KotlinOutOfBlockModificationTrackerFactoryTestImpl::class.java - ) - registerService(KtDeclarationProviderFactory::class.java, object : KtDeclarationProviderFactory() { - override fun createDeclarationProvider(searchScope: GlobalSearchScope): DeclarationProvider { - return DeclarationProviderTestImpl(searchScope, ktFiles.values) - } - }) - registerService(KtPackageProviderFactory::class.java, object : KtPackageProviderFactory() { - override fun createPackageProvider(searchScope: GlobalSearchScope): KtPackageProvider { - return KtPackageProviderTestImpl(searchScope, ktFiles.values) - } - }) + registerTestServices(configurator, ktFiles) } - val resolveState = createResolveStateForNoCaching(moduleInfo, project) { configureSession() } return getArtifact(module, testServices, ktFiles, resolveState) ?: FirOutputArtifactImpl( resolveState.rootModuleSession, emptyMap(), - FirAnalyzerFacade(resolveState.rootModuleSession, languageVersionSettings) + FirAnalyzerFacade(resolveState.rootModuleSession, configurator.getLanguageVersionSettings(moduleInfo)) ) } } + protected open fun FirIdeSession.configureSession() {} protected abstract fun getArtifact( @@ -234,4 +146,114 @@ abstract class FrontendApiTestWithTestdata : AbstractKotlinCompilerTest() { return false } -} \ No newline at end of file +} + +class TestModuleInfo( + val testModule: TestModule, +) : ModuleInfo, ModuleSourceInfoBase { + override val name: Name get() = Name.identifier(testModule.name) + + override fun dependencies(): List { + return emptyList() + } + + override val platform: TargetPlatform + get() = testModule.targetPlatform + + override val analyzerServices: PlatformDependentAnalyzerServices + get() = testModule.targetPlatform.getAnalyzerServices() +} + + +class FirModuleResolveStateConfiguratorForSingleModuleTestImpl( + private val testServices: TestServices, + private val testModule: TestModule, + private val ktFiles: Map, + private val moduleInfo: ModuleInfo, +) : FirModuleResolveStateConfigurator() { + val moduleInfoProvider = testServices.firModuleInfoProvider + val compilerConfigurationProvider = testServices.compilerConfigurationProvider + + val project = compilerConfigurationProvider.getProject(testModule) + + val languageVersionSettings = testModule.languageVersionSettings + val packagePartProviderFactory = compilerConfigurationProvider.getPackagePartProviderFactory(testModule) + + val configuration = compilerConfigurationProvider.getCompilerConfiguration(testModule) + + val librariesScope = ProjectScope.getLibrariesScope(project) + val sourcesScope = TopDownAnalyzerFacadeForJVM.newModuleSearchScope(project, ktFiles.values) + + private val sealedClassInheritorsProvider = SealedClassInheritorsProviderTestImpl() + + override fun createPackagePartsProvider(scope: GlobalSearchScope): PackagePartProvider { + return packagePartProviderFactory.invoke(scope) + } + + override fun createModuleDataProvider(moduleInfo: ModuleSourceInfoBase): ModuleDataProvider { + return DependencyListForCliModule.build( + moduleInfo.name, + moduleInfo.platform, + moduleInfo.analyzerServices + ) { + dependencies(configuration.jvmModularRoots.map { it.toPath() }) + dependencies(configuration.jvmClasspathRoots.map { it.toPath() }) + + friendDependencies(configuration[JVMConfigurationKeys.FRIEND_PATHS] ?: emptyList()) + + sourceDependencies(moduleInfoProvider.getRegularDependentSourceModules(testModule)) + sourceFriendsDependencies(moduleInfoProvider.getDependentFriendSourceModules(testModule)) + sourceDependsOnDependencies(moduleInfoProvider.getDependentDependsOnSourceModules(testModule)) + }.moduleDataProvider + } + + override fun getLanguageVersionSettings(moduleInfo: ModuleSourceInfoBase): LanguageVersionSettings { + return languageVersionSettings + } + + override fun getModuleSourceScope(moduleInfo: ModuleSourceInfoBase): GlobalSearchScope { + return sourcesScope + } + + override fun createScopeForModuleLibraries(moduleInfo: ModuleSourceInfoBase): GlobalSearchScope { + return librariesScope + } + + override fun createSealedInheritorsProvider(): SealedClassInheritorsProvider { + return sealedClassInheritorsProvider + } + + override fun getModuleInfoFor(element: KtElement): ModuleInfo { + return moduleInfo + } + + override fun configureSourceSession(session: FirSession) { + @Suppress("IncorrectParentDisposable") + PsiElementFinder.EP.getPoint(project).registerExtension(FirJavaElementFinder(session, project), project) + } +} + +fun MockProject.registerTestServices( + configurator: FirModuleResolveStateConfiguratorForSingleModuleTestImpl, + ktFiles: Map +) { + registerService( + FirModuleResolveStateConfigurator::class.java, + configurator + ) + registerService(FirIdeResolveStateService::class.java) + registerService( + KotlinOutOfBlockModificationTrackerFactory::class.java, + KotlinOutOfBlockModificationTrackerFactoryTestImpl::class.java + ) + registerService(KtDeclarationProviderFactory::class.java, object : KtDeclarationProviderFactory() { + override fun createDeclarationProvider(searchScope: GlobalSearchScope): DeclarationProvider { + return DeclarationProviderTestImpl(searchScope, ktFiles.values) + } + }) + registerService(KtPackageProviderFactory::class.java, object : KtPackageProviderFactory() { + override fun createPackageProvider(searchScope: GlobalSearchScope): KtPackageProvider { + return KtPackageProviderTestImpl(searchScope, ktFiles.values) + } + }) +} diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/test/base/DeclarationProviderTestImpl.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/test/base/DeclarationProviderTestImpl.kt index cabd0df3cdb..a47fe4f5e5f 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/test/base/DeclarationProviderTestImpl.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/test/base/DeclarationProviderTestImpl.kt @@ -12,6 +12,7 @@ import org.jetbrains.kotlin.name.ClassId import org.jetbrains.kotlin.name.FqName import org.jetbrains.kotlin.name.Name import org.jetbrains.kotlin.psi.* +import org.jetbrains.kotlin.psi.psiUtil.collectDescendantsOfType import org.jetbrains.kotlin.psi.psiUtil.findDescendantOfType import org.jetbrains.kotlin.psi.psiUtil.forEachDescendantOfType @@ -26,21 +27,37 @@ internal class DeclarationProviderTestImpl( filesInScope.asSequence() .filter { it.packageFqName == packageFqName } - - override fun getClassByClassId(classId: ClassId): KtClassOrObject? = - filesByPackage(classId.packageFqName).firstNotNullOfOrNull { file -> - file.findDescendantOfType { ktClass -> + override fun getClassesByClassId(classId: ClassId): Collection = + filesByPackage(classId.packageFqName).flatMap { file -> + file.collectDescendantsOfType { ktClass -> ktClass.getClassId() == classId } - } + }.toList() - - override fun getTypeAliasByClassId(classId: ClassId): KtTypeAlias? = - filesByPackage(classId.packageFqName).firstNotNullOfOrNull { file -> - file.findDescendantOfType { typeAlias -> + override fun getTypeAliasesByClassId(classId: ClassId): Collection = + filesByPackage(classId.packageFqName).flatMap { file -> + file.collectDescendantsOfType { typeAlias -> typeAlias.getClassId() == classId } - } + }.toList() + + override fun getTypeAliasNamesInPackage(packageFqName: FqName): Set = + filesByPackage(packageFqName) + .flatMap { it.declarations } + .filterIsInstance() + .mapNotNullTo(mutableSetOf()) { it.nameAsName } + + override fun getPropertyNamesInPackage(packageFqName: FqName): Set = + filesByPackage(packageFqName) + .flatMap { it.declarations } + .filterIsInstance() + .mapNotNullTo(mutableSetOf()) { it.nameAsName } + + override fun getFunctionsNamesInPackage(packageFqName: FqName): Set = + filesByPackage(packageFqName) + .flatMap { it.declarations } + .filterIsInstance() + .mapNotNullTo(mutableSetOf()) { it.nameAsName } override fun getTopLevelProperties(callableId: CallableId): Collection = filesByPackage(callableId.packageName) diff --git a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/test/base/KotlinOutOfBlockModificationTrackerFactoryTestImpl.kt b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/test/base/KotlinOutOfBlockModificationTrackerFactoryTestImpl.kt index 2d705dfc861..c010955e22d 100644 --- a/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/test/base/KotlinOutOfBlockModificationTrackerFactoryTestImpl.kt +++ b/idea/idea-frontend-fir/idea-fir-low-level-api/tests/org/jetbrains/kotlin/idea/fir/low/level/api/test/base/KotlinOutOfBlockModificationTrackerFactoryTestImpl.kt @@ -7,13 +7,14 @@ package org.jetbrains.kotlin.idea.fir.low.level.api.test.base import com.intellij.openapi.util.ModificationTracker import com.intellij.openapi.util.SimpleModificationTracker +import org.jetbrains.annotations.TestOnly import org.jetbrains.kotlin.analyzer.ModuleSourceInfoBase import org.jetbrains.kotlin.idea.fir.low.level.api.api.KotlinOutOfBlockModificationTrackerFactory internal class KotlinOutOfBlockModificationTrackerFactoryTestImpl : KotlinOutOfBlockModificationTrackerFactory() { private val projectWide = SimpleModificationTracker() private val library = SimpleModificationTracker() - private val forModule = mutableMapOf() + private val forModule = mutableMapOf() override fun createProjectWideOutOfBlockModificationTracker(): ModificationTracker { return projectWide @@ -27,4 +28,11 @@ internal class KotlinOutOfBlockModificationTrackerFactoryTestImpl : KotlinOutOfB override fun createLibraryOutOfBlockModificationTracker(): ModificationTracker { return library } + + @TestOnly + override fun incrementModificationsCount() { + projectWide.incModificationCount() + library.incModificationCount() + forModule.values.forEach { it.incModificationCount() } + } } \ No newline at end of file diff --git a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtFirAnalysisSessionProvider.kt b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtFirAnalysisSessionProvider.kt index d00a297a878..9c9b5bb0cad 100644 --- a/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtFirAnalysisSessionProvider.kt +++ b/idea/idea-frontend-fir/src/org/jetbrains/kotlin/idea/frontend/api/fir/KtFirAnalysisSessionProvider.kt @@ -41,7 +41,7 @@ class KtFirAnalysisSessionProvider(private val project: Project) : KtAnalysisSes } @TestOnly - fun clearCaches() { + override fun clearCaches() { cache.clear() } } diff --git a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/functionCallInTheSameFile.kt b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/functionCallInTheSameFile.kt index 21a62d2408d..35d474ea53d 100644 --- a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/functionCallInTheSameFile.kt +++ b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/functionCallInTheSameFile.kt @@ -1,7 +1,7 @@ fun function(a: Int) {} fun call() { - function(1) + function(1) } // CALL: KtFunctionCall: targetFunction = /function(a: kotlin.Int): kotlin.Unit \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/functionCallInTheSameFile.txt b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/functionCallInTheSameFile.txt new file mode 100644 index 00000000000..5a8184ee063 --- /dev/null +++ b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/functionCallInTheSameFile.txt @@ -0,0 +1 @@ +KtFunctionCall: targetFunction = /function(a: kotlin.Int): kotlin.Unit diff --git a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/functionWithReceiverCall.kt b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/functionWithReceiverCall.kt index e0b8e127888..28e3a59857f 100644 --- a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/functionWithReceiverCall.kt +++ b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/functionWithReceiverCall.kt @@ -1,7 +1,7 @@ fun String.function(a: Int) {} fun call() { - "str".function(1) + "str".function(1) } // CALL: KtFunctionCall: targetFunction = /function(: kotlin.String, a: kotlin.Int): kotlin.Unit \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/functionWithReceiverCall.txt b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/functionWithReceiverCall.txt new file mode 100644 index 00000000000..8616105141a --- /dev/null +++ b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/functionWithReceiverCall.txt @@ -0,0 +1 @@ +KtFunctionCall: targetFunction = /function(: kotlin.String, a: kotlin.Int): kotlin.Unit diff --git a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/functionWithReceiverSafeCall.kt b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/functionWithReceiverSafeCall.kt index aeb09a2452c..cca7baa1d7c 100644 --- a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/functionWithReceiverSafeCall.kt +++ b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/functionWithReceiverSafeCall.kt @@ -1,7 +1,7 @@ fun String.function(a: Int) {} fun call() { - "str"?.function(1) + "str"?.function(1) } // CALL: KtFunctionCall: targetFunction = /function(: kotlin.String, a: kotlin.Int): kotlin.Unit \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/functionWithReceiverSafeCall.txt b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/functionWithReceiverSafeCall.txt new file mode 100644 index 00000000000..8616105141a --- /dev/null +++ b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/functionWithReceiverSafeCall.txt @@ -0,0 +1 @@ +KtFunctionCall: targetFunction = /function(: kotlin.String, a: kotlin.Int): kotlin.Unit diff --git a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/implicitConstuctorCall.kt b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/implicitConstuctorCall.kt index 433f0975a2f..4e2d81e116b 100644 --- a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/implicitConstuctorCall.kt +++ b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/implicitConstuctorCall.kt @@ -1,7 +1,7 @@ class A fun call() { - val a = A() + val a = A() } // CALL: KtFunctionCall: targetFunction = (): A \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/implicitConstuctorCall.txt b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/implicitConstuctorCall.txt new file mode 100644 index 00000000000..cdeeb9aeb54 --- /dev/null +++ b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/implicitConstuctorCall.txt @@ -0,0 +1 @@ +KtFunctionCall: targetFunction = (): A diff --git a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/implicitJavaConstuctorCall.external.java b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/implicitJavaConstuctorCall.external.java deleted file mode 100644 index 1b4568a8f26..00000000000 --- a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/implicitJavaConstuctorCall.external.java +++ /dev/null @@ -1,3 +0,0 @@ -class A { - -} \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/implicitJavaConstuctorCall.kt b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/implicitJavaConstuctorCall.kt index 4fa16f5b0ee..5b2c7311da1 100644 --- a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/implicitJavaConstuctorCall.kt +++ b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/implicitJavaConstuctorCall.kt @@ -1,6 +1,9 @@ - +// FILE: call.kt fun call() { - val a = A() + val a = A() } +// FILE: A.java +class A {} + // CALL: KtFunctionCall: targetFunction = (): A \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/implicitJavaConstuctorCall.txt b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/implicitJavaConstuctorCall.txt new file mode 100644 index 00000000000..cdeeb9aeb54 --- /dev/null +++ b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/implicitJavaConstuctorCall.txt @@ -0,0 +1 @@ +KtFunctionCall: targetFunction = (): A diff --git a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/javaFunctionCall.external.java b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/javaFunctionCall.external.java deleted file mode 100644 index 2471106ae97..00000000000 --- a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/javaFunctionCall.external.java +++ /dev/null @@ -1,3 +0,0 @@ -class JavaClass { - void javaMethod() {} -} \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/javaFunctionCall.kt b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/javaFunctionCall.kt index 01accb4c275..81a6893d6fb 100644 --- a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/javaFunctionCall.kt +++ b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/javaFunctionCall.kt @@ -1,6 +1,12 @@ +// FILE: call.kt fun call() { val javaClass = JavaClass() - javaClass.javaMethod() + javaClass.javaMethod() +} + +// FILE: JavaClass.java +class JavaClass { + void javaMethod() {} } // CALL: KtFunctionCall: targetFunction = /JavaClass.javaMethod(): kotlin.Unit \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/javaFunctionCall.txt b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/javaFunctionCall.txt new file mode 100644 index 00000000000..d52c80ad01b --- /dev/null +++ b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/javaFunctionCall.txt @@ -0,0 +1 @@ +KtFunctionCall: targetFunction = /JavaClass.javaMethod(): kotlin.Unit diff --git a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/resolveCallInSuperConstructorParam.kt b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/resolveCallInSuperConstructorParam.kt index 3b39fdd0adc..f448337bd2e 100644 --- a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/resolveCallInSuperConstructorParam.kt +++ b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/resolveCallInSuperConstructorParam.kt @@ -2,6 +2,6 @@ infix fun A.to(other: B) = this open class A(x: T) -class B : A(1 to 2) +class B : A(1 to 2) // CALL: KtFunctionCall: targetFunction = /to(: A, other: B): A \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/resolveCallInSuperConstructorParam.txt b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/resolveCallInSuperConstructorParam.txt new file mode 100644 index 00000000000..694bbdebc53 --- /dev/null +++ b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/resolveCallInSuperConstructorParam.txt @@ -0,0 +1 @@ +KtFunctionCall: targetFunction = /to(: A, other: B): A diff --git a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/simpleCallWithNonMatchingArgs.kt b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/simpleCallWithNonMatchingArgs.kt index 740b1a706ed..981e6bc3edc 100644 --- a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/simpleCallWithNonMatchingArgs.kt +++ b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/simpleCallWithNonMatchingArgs.kt @@ -1,5 +1,5 @@ fun x() { - foo(1) + foo(1) } fun foo(){} diff --git a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/simpleCallWithNonMatchingArgs.txt b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/simpleCallWithNonMatchingArgs.txt new file mode 100644 index 00000000000..a551f5f9adb --- /dev/null +++ b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/simpleCallWithNonMatchingArgs.txt @@ -0,0 +1 @@ +KtFunctionCall: targetFunction = ERR diff --git a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/variableAsFunction.kt b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/variableAsFunction.kt index 250286fa3a8..f8a9e24a93b 100644 --- a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/variableAsFunction.kt +++ b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/variableAsFunction.kt @@ -1,5 +1,5 @@ fun call(x: (Int) -> String) { - x(1) + x(1) } // CALL: KtFunctionalTypeVariableCall: target = x: kotlin.Function1, targetFunction = kotlin/Function1.invoke(p1: kotlin.Int): kotlin.String \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/variableAsFunction.txt b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/variableAsFunction.txt new file mode 100644 index 00000000000..75cf505d876 --- /dev/null +++ b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/variableAsFunction.txt @@ -0,0 +1 @@ +KtFunctionalTypeVariableCall: target = x: kotlin.Function1, targetFunction = kotlin/Function1.invoke(p1: kotlin.Int): kotlin.String diff --git a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/variableAsFunctionLikeCall.kt b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/variableAsFunctionLikeCall.kt index 6357fea3b67..4201189577d 100644 --- a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/variableAsFunctionLikeCall.kt +++ b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/variableAsFunctionLikeCall.kt @@ -1,7 +1,7 @@ operator fun Int.invoke(): String {} fun call(x: kotlin.int) { - x() + x() } // CALL: KtFunctionCall: targetFunction = /invoke(: kotlin.Int): kotlin.String \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/analysisSession/resolveCall/variableAsFunctionLikeCall.txt b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/variableAsFunctionLikeCall.txt new file mode 100644 index 00000000000..ee82c2f07a7 --- /dev/null +++ b/idea/idea-frontend-fir/testData/analysisSession/resolveCall/variableAsFunctionLikeCall.txt @@ -0,0 +1 @@ +KtFunctionCall: targetFunction = /invoke(: kotlin.Int): kotlin.String diff --git a/idea/idea-frontend-fir/testData/components/declarationRenderer/F.rendered b/idea/idea-frontend-fir/testData/components/declarationRenderer/F.rendered new file mode 100644 index 00000000000..6e85fb139fa --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/declarationRenderer/F.rendered @@ -0,0 +1,2 @@ +open class A +class B : A diff --git a/idea/idea-frontend-fir/testData/components/declarationRenderer/NestedOfAliasedType.rendered b/idea/idea-frontend-fir/testData/components/declarationRenderer/NestedOfAliasedType.rendered new file mode 100644 index 00000000000..9655f77c71f --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/declarationRenderer/NestedOfAliasedType.rendered @@ -0,0 +1,7 @@ +abstract class A { + abstract class Nested +} +typealias TA = A +class B : TA { + class NestedInB : A.Nested +} diff --git a/idea/idea-frontend-fir/testData/components/declarationRenderer/NestedSuperType.rendered b/idea/idea-frontend-fir/testData/components/declarationRenderer/NestedSuperType.rendered new file mode 100644 index 00000000000..ece7a0815a7 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/declarationRenderer/NestedSuperType.rendered @@ -0,0 +1,8 @@ +abstract class My { + abstract class NestedOne : My { + abstract class NestedTwo : My.NestedOne + } +} +class Your : My { + class NestedThree : My.NestedOne +} diff --git a/idea/idea-frontend-fir/testData/components/declarationRenderer/annotation.rendered b/idea/idea-frontend-fir/testData/components/declarationRenderer/annotation.rendered new file mode 100644 index 00000000000..e8c7bc76a38 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/declarationRenderer/annotation.rendered @@ -0,0 +1,16 @@ +@Target(allowedTargets = NOT_CONST_EXPRESSION) annotation class base +@base annotation class derived +@base class correct { + constructor(@base x: Int) + @base val x: Int + @base constructor() +} +@base enum class My { + FIRST, + SECOND, +} +@base fun foo(@base y: @base Int): Int { + @base fun bar(@base z: @base Int): Int + @base val local: Int +} +@base val z: Int diff --git a/idea/idea-frontend-fir/testData/components/declarationRenderer/complexTypes.rendered b/idea/idea-frontend-fir/testData/components/declarationRenderer/complexTypes.rendered new file mode 100644 index 00000000000..48dcf68a7ed --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/declarationRenderer/complexTypes.rendered @@ -0,0 +1,6 @@ +class C { + inner class D +} +interface Test { + val x: C.D, *> +} diff --git a/idea/idea-frontend-fir/testData/components/declarationRenderer/constructorInObject.rendered b/idea/idea-frontend-fir/testData/components/declarationRenderer/constructorInObject.rendered new file mode 100644 index 00000000000..e352dc4b389 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/declarationRenderer/constructorInObject.rendered @@ -0,0 +1,12 @@ +object A { + constructor() +} +enum class B { + X, +} +class C { + companion object { + constructor() + } +} +val anonObject: Any diff --git a/idea/idea-frontend-fir/testData/components/declarationRenderer/constructorOfAnonymousObject.rendered b/idea/idea-frontend-fir/testData/components/declarationRenderer/constructorOfAnonymousObject.rendered new file mode 100644 index 00000000000..c27f11e3d49 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/declarationRenderer/constructorOfAnonymousObject.rendered @@ -0,0 +1,10 @@ +interface IFace { + fun getStatus(arg: T): Boolean +} +class Some +private fun resolve(): IFace { + object : IFace { + constructor() + override fun getStatus(arg: Some): Boolean + } +} diff --git a/idea/idea-frontend-fir/testData/components/declarationRenderer/delegates.rendered b/idea/idea-frontend-fir/testData/components/declarationRenderer/delegates.rendered new file mode 100644 index 00000000000..5a336399b93 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/declarationRenderer/delegates.rendered @@ -0,0 +1,12 @@ +interface MyRwProperty { + operator fun setValue(thisRef: T, property: Any, value: V) + operator fun getValue(thisRef: T, property: Any): V +} +val x: Int + get() +val delegate: MyRwProperty +val value: Int + get() +var variable: Int + get() + set(value: Int) diff --git a/idea/idea-frontend-fir/testData/components/declarationRenderer/derivedClass.rendered b/idea/idea-frontend-fir/testData/components/declarationRenderer/derivedClass.rendered new file mode 100644 index 00000000000..885cec1f906 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/declarationRenderer/derivedClass.rendered @@ -0,0 +1,8 @@ +open class Base { + constructor(x: T) + val x: T +} +class Derived : Base { + constructor(x: T) +} +fun create(x: T): Derived diff --git a/idea/idea-frontend-fir/testData/components/declarationRenderer/emptyAnonymousObject.rendered b/idea/idea-frontend-fir/testData/components/declarationRenderer/emptyAnonymousObject.rendered new file mode 100644 index 00000000000..4666484bff2 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/declarationRenderer/emptyAnonymousObject.rendered @@ -0,0 +1,3 @@ +fun test() { + val x: Any +} diff --git a/idea/idea-frontend-fir/testData/components/declarationRenderer/enums.rendered b/idea/idea-frontend-fir/testData/components/declarationRenderer/enums.rendered new file mode 100644 index 00000000000..65e7f5857ad --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/declarationRenderer/enums.rendered @@ -0,0 +1,30 @@ +enum class Order { + FIRST, + SECOND, + THIRD, +} +enum class Planet { + MERCURY, + VENERA, + EARTH, + constructor(m: Double, r: Double) + val m: Double + internal val r: Double + val g: Double + abstract fun sayHello() + companion object { + const val G: Double + } +} +enum class PseudoInsn { + FIX_STACK_BEFORE_JUMP, + FAKE_ALWAYS_TRUE_IFEQ, + FAKE_ALWAYS_FALSE_IFEQ, + SAVE_STACK_BEFORE_TRY, + RESTORE_STACK_IN_TRY_CATCH, + STORE_NOT_NULL, + AS_NOT_NULL, + constructor(signature: String = ...) + val signature: String + fun emit() +} diff --git a/idea/idea-frontend-fir/testData/components/declarationRenderer/enums2.rendered b/idea/idea-frontend-fir/testData/components/declarationRenderer/enums2.rendered new file mode 100644 index 00000000000..240a05f6b57 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/declarationRenderer/enums2.rendered @@ -0,0 +1,10 @@ +interface Some +object O1 : Some +object O2 : Some +enum class SomeEnum { + FIRST, + SECOND, + constructor(x: Some) + val x: Some + abstract fun check(y: Some): Boolean +} diff --git a/idea/idea-frontend-fir/testData/components/declarationRenderer/expectActual.rendered b/idea/idea-frontend-fir/testData/components/declarationRenderer/expectActual.rendered new file mode 100644 index 00000000000..aba5be8f6b9 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/declarationRenderer/expectActual.rendered @@ -0,0 +1,6 @@ +expect class MyClass +expect fun foo(): String +expect val x: Int +actual class MyClass +actual fun foo(): String +actual val x: Int diff --git a/idea/idea-frontend-fir/testData/components/declarationRenderer/functionTypes.rendered b/idea/idea-frontend-fir/testData/components/declarationRenderer/functionTypes.rendered new file mode 100644 index 00000000000..08eecdb5b50 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/declarationRenderer/functionTypes.rendered @@ -0,0 +1,3 @@ +fun simpleRun(f: (T) -> Unit) +fun List.simpleMap(f: (T) -> R): R +fun simpleWith(t: T, f: T.() -> Unit) diff --git a/idea/idea-frontend-fir/testData/components/declarationRenderer/genericFunctions.rendered b/idea/idea-frontend-fir/testData/components/declarationRenderer/genericFunctions.rendered new file mode 100644 index 00000000000..f84326fff37 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/declarationRenderer/genericFunctions.rendered @@ -0,0 +1,5 @@ +interface Any +inline fun Any.safeAs(): T? +abstract class Summator { + abstract fun plus(first: T, second: T): T +} diff --git a/idea/idea-frontend-fir/testData/components/declarationRenderer/genericProperty.rendered b/idea/idea-frontend-fir/testData/components/declarationRenderer/genericProperty.rendered new file mode 100644 index 00000000000..3b6ba1e40d7 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/declarationRenderer/genericProperty.rendered @@ -0,0 +1,3 @@ +fun genericFoo(): T +val T.generic: T + get() diff --git a/idea/idea-frontend-fir/testData/components/declarationRenderer/intersectionType.rendered b/idea/idea-frontend-fir/testData/components/declarationRenderer/intersectionType.rendered new file mode 100644 index 00000000000..856e7e055f0 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/declarationRenderer/intersectionType.rendered @@ -0,0 +1 @@ +private fun foo(x: Any): Any? diff --git a/idea/idea-frontend-fir/testData/components/declarationRenderer/nestedClass.rendered b/idea/idea-frontend-fir/testData/components/declarationRenderer/nestedClass.rendered new file mode 100644 index 00000000000..6f553414d99 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/declarationRenderer/nestedClass.rendered @@ -0,0 +1,10 @@ +abstract class Base { + constructor(s: String) + val s: String +} +class Outer { + class Derived : Base { + constructor(s: String) + } + object Obj : Base +} diff --git a/idea/idea-frontend-fir/testData/components/declarationRenderer/noPrimaryConstructor.rendered b/idea/idea-frontend-fir/testData/components/declarationRenderer/noPrimaryConstructor.rendered new file mode 100644 index 00000000000..f9420c5657b --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/declarationRenderer/noPrimaryConstructor.rendered @@ -0,0 +1,5 @@ +class NoPrimary { + val x: String + constructor(x: String) + constructor() +} diff --git a/idea/idea-frontend-fir/testData/components/declarationRenderer/simpleClass.rendered b/idea/idea-frontend-fir/testData/components/declarationRenderer/simpleClass.rendered new file mode 100644 index 00000000000..74d31da055e --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/declarationRenderer/simpleClass.rendered @@ -0,0 +1,13 @@ +interface SomeInterface { + fun foo(x: Int, y: String): String + val bar: Boolean +} +class SomeClass : SomeInterface { + private val baz: Int + override fun foo(x: Int, y: String): String + override var bar: Boolean + get() + set(value: Boolean) + lateinit var fau: Double +} +inline class InlineClass diff --git a/idea/idea-frontend-fir/testData/components/declarationRenderer/simpleFun.rendered b/idea/idea-frontend-fir/testData/components/declarationRenderer/simpleFun.rendered new file mode 100644 index 00000000000..4d00c1b7dd8 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/declarationRenderer/simpleFun.rendered @@ -0,0 +1,2 @@ +fun foo() +suspend fun bar() diff --git a/idea/idea-frontend-fir/testData/components/declarationRenderer/simpleTypeAlias.rendered b/idea/idea-frontend-fir/testData/components/declarationRenderer/simpleTypeAlias.rendered new file mode 100644 index 00000000000..15e4bceadb2 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/declarationRenderer/simpleTypeAlias.rendered @@ -0,0 +1,3 @@ +interface B +typealias C = B +class D : C diff --git a/idea/idea-frontend-fir/testData/components/declarationRenderer/typeAliasWithGeneric.rendered b/idea/idea-frontend-fir/testData/components/declarationRenderer/typeAliasWithGeneric.rendered new file mode 100644 index 00000000000..9e3abb500e7 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/declarationRenderer/typeAliasWithGeneric.rendered @@ -0,0 +1,4 @@ +open class A +interface B +typealias C = B +class D : C diff --git a/idea/idea-frontend-fir/testData/components/declarationRenderer/typeParameterVsNested.rendered b/idea/idea-frontend-fir/testData/components/declarationRenderer/typeParameterVsNested.rendered new file mode 100644 index 00000000000..16eb79a5e07 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/declarationRenderer/typeParameterVsNested.rendered @@ -0,0 +1,9 @@ +interface Some +abstract class My { + open inner class T + abstract val x: My.T + abstract fun foo(arg: My.T) + abstract val y: My.T + abstract val z: My.T + abstract class Some : My.T +} diff --git a/idea/idea-frontend-fir/testData/components/declarationRenderer/typeParameters.rendered b/idea/idea-frontend-fir/testData/components/declarationRenderer/typeParameters.rendered new file mode 100644 index 00000000000..41b8bc6eab3 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/declarationRenderer/typeParameters.rendered @@ -0,0 +1,11 @@ +interface List { + operator fun get(index: Int): T + infix fun concat(other: List): List +} +typealias StringList = List +typealias AnyList = List<*> +abstract class AbstractList : List +class SomeList : AbstractList { + override operator fun get(index: Int): Int + override infix fun concat(other: List): List +} diff --git a/idea/idea-frontend-fir/testData/components/declarationRenderer/vararg.rendered b/idea/idea-frontend-fir/testData/components/declarationRenderer/vararg.rendered new file mode 100644 index 00000000000..47c9203032b --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/declarationRenderer/vararg.rendered @@ -0,0 +1,3 @@ +@Target(allowedTargets = NOT_CONST_EXPRESSION) annotation class base +fun foo1(vararg ints: Int) +fun foo2(@base vararg ints: @base Int) diff --git a/idea/idea-frontend-fir/testData/components/declarationRenderer/where.rendered b/idea/idea-frontend-fir/testData/components/declarationRenderer/where.rendered new file mode 100644 index 00000000000..f455894ee76 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/declarationRenderer/where.rendered @@ -0,0 +1,3 @@ +interface A +interface B +class C where T : B diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionExpressionBody.kt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionExpressionBody.kt index f16d598ffac..61454dcc944 100644 --- a/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionExpressionBody.kt +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionExpressionBody.kt @@ -1,3 +1 @@ fun foo(): String = av - -// EXPECTED_TYPE: kotlin/String \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionExpressionBody.txt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionExpressionBody.txt new file mode 100644 index 00000000000..ea35df5d0f9 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionExpressionBody.txt @@ -0,0 +1,2 @@ +expression: av +expected type: kotlin/String diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionExpressionBodyQualified.kt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionExpressionBodyQualified.kt index daada518e90..9fdffb4570e 100644 --- a/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionExpressionBodyQualified.kt +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionExpressionBodyQualified.kt @@ -1,3 +1,2 @@ fun foo(): String = x.av -// EXPECTED_TYPE: kotlin/String \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionExpressionBodyQualified.txt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionExpressionBodyQualified.txt new file mode 100644 index 00000000000..ea35df5d0f9 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionExpressionBodyQualified.txt @@ -0,0 +1,2 @@ +expression: av +expected type: kotlin/String diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionExpressionBodyWithTypeFromRHS.kt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionExpressionBodyWithTypeFromRHS.kt index b31dc99753a..b15d59e9176 100644 --- a/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionExpressionBodyWithTypeFromRHS.kt +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionExpressionBodyWithTypeFromRHS.kt @@ -2,4 +2,3 @@ val av = "foo" fun foo() = av -// EXPECTED_TYPE: kotlin/String \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionExpressionBodyWithTypeFromRHS.txt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionExpressionBodyWithTypeFromRHS.txt new file mode 100644 index 00000000000..ea35df5d0f9 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionExpressionBodyWithTypeFromRHS.txt @@ -0,0 +1,2 @@ +expression: av +expected type: kotlin/String diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionExpressionBodyWithoutExplicitType.kt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionExpressionBodyWithoutExplicitType.kt index 24b167a7781..b42918222d4 100644 --- a/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionExpressionBodyWithoutExplicitType.kt +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionExpressionBodyWithoutExplicitType.kt @@ -1,3 +1,2 @@ fun foo() = av -// EXPECTED_TYPE: null \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionExpressionBodyWithoutExplicitType.txt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionExpressionBodyWithoutExplicitType.txt new file mode 100644 index 00000000000..53684a9cf4e --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionExpressionBodyWithoutExplicitType.txt @@ -0,0 +1,2 @@ +expression: av +expected type: null diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionLambdaParam.kt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionLambdaParam.kt index 75012a111d0..c0a03107c1b 100644 --- a/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionLambdaParam.kt +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionLambdaParam.kt @@ -4,4 +4,3 @@ fun x() { fun toCall(x: Int, y: String, lambda: (Int) -> String): Char = 'a' -// EXPECTED_TYPE: kotlin/Function1 \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionLambdaParam.txt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionLambdaParam.txt new file mode 100644 index 00000000000..339c8a7b5d4 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionLambdaParam.txt @@ -0,0 +1,2 @@ +expression: av +expected type: kotlin/Function1 diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionNamedlParam.kt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionNamedlParam.kt index 4f4cb4940b9..3137a81affb 100644 --- a/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionNamedlParam.kt +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionNamedlParam.kt @@ -6,4 +6,3 @@ fun x() { fun toCall(x: Int, y: String, z: Boolean): Char = 'a' -// EXPECTED_TYPE: kotlin/Boolean \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionNamedlParam.txt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionNamedlParam.txt new file mode 100644 index 00000000000..53684a9cf4e --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionNamedlParam.txt @@ -0,0 +1,2 @@ +expression: av +expected type: null diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionParamWithTypeParam.kt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionParamWithTypeParam.kt index 534126ea8cb..6b5547b4783 100644 --- a/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionParamWithTypeParam.kt +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionParamWithTypeParam.kt @@ -6,4 +6,3 @@ fun x() { fun toCall(x: T, y: T): Char = 'a' -// EXPECTED_TYPE: kotlin/Int \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionParamWithTypeParam.txt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionParamWithTypeParam.txt new file mode 100644 index 00000000000..4ded861f829 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionParamWithTypeParam.txt @@ -0,0 +1,2 @@ +expression: ab +expected type: T diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionPositionalParam.kt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionPositionalParam.kt index b2ec3c58e29..cb27a9e4020 100644 --- a/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionPositionalParam.kt +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionPositionalParam.kt @@ -4,4 +4,3 @@ fun x() { fun toCall(x: Int, y: String, z: Boolean): Char = 'a' -// EXPECTED_TYPE: kotlin/String \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionPositionalParam.txt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionPositionalParam.txt new file mode 100644 index 00000000000..ea35df5d0f9 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionPositionalParam.txt @@ -0,0 +1,2 @@ +expression: av +expected type: kotlin/String diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionPositionalParamQualified.kt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionPositionalParamQualified.kt index 0eb15c6db94..d41c581d72f 100644 --- a/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionPositionalParamQualified.kt +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionPositionalParamQualified.kt @@ -4,4 +4,3 @@ fun x() { fun toCall(x: Int, y: String, z: Boolean): Char = 'a' -// EXPECTED_TYPE: kotlin/String \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionPositionalParamQualified.txt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionPositionalParamQualified.txt new file mode 100644 index 00000000000..ea35df5d0f9 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/functionPositionalParamQualified.txt @@ -0,0 +1,2 @@ +expression: av +expected type: kotlin/String diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/ifCondition.kt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/ifCondition.kt index d375d652d08..b47144a2a4d 100644 --- a/idea/idea-frontend-fir/testData/components/expectedExpressionType/ifCondition.kt +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/ifCondition.kt @@ -2,4 +2,3 @@ fun x() { if(xy){ } -// EXPECTED_TYPE: kotlin/Boolean \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/ifCondition.txt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/ifCondition.txt new file mode 100644 index 00000000000..a678b7e0471 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/ifCondition.txt @@ -0,0 +1,2 @@ +expression: xy +expected type: kotlin/Boolean diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/ifConditionQualified.kt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/ifConditionQualified.kt index a7153790034..db6f9a17e2c 100644 --- a/idea/idea-frontend-fir/testData/components/expectedExpressionType/ifConditionQualified.kt +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/ifConditionQualified.kt @@ -2,4 +2,3 @@ fun x() { if(x.fdfd){ } -// EXPECTED_TYPE: kotlin/Boolean \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/ifConditionQualified.txt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/ifConditionQualified.txt new file mode 100644 index 00000000000..10d27926d5f --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/ifConditionQualified.txt @@ -0,0 +1,2 @@ +expression: fdfd +expected type: kotlin/Boolean diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/infixFunctionAsRegularCallParam.kt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/infixFunctionAsRegularCallParam.kt index 8082921ead7..46a9f742733 100644 --- a/idea/idea-frontend-fir/testData/components/expectedExpressionType/infixFunctionAsRegularCallParam.kt +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/infixFunctionAsRegularCallParam.kt @@ -4,4 +4,3 @@ fun x() { infix fun Int.toCall(y: String): Char = 'a' -// EXPECTED_TYPE: kotlin/String \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/infixFunctionAsRegularCallParam.txt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/infixFunctionAsRegularCallParam.txt new file mode 100644 index 00000000000..ea35df5d0f9 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/infixFunctionAsRegularCallParam.txt @@ -0,0 +1,2 @@ +expression: av +expected type: kotlin/String diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/infixFunctionParam.kt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/infixFunctionParam.kt index aafb326c2f2..ad3bd1a199a 100644 --- a/idea/idea-frontend-fir/testData/components/expectedExpressionType/infixFunctionParam.kt +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/infixFunctionParam.kt @@ -4,4 +4,3 @@ fun x() { infix fun Int.toCall(y: String): Char = 'a' -// EXPECTED_TYPE: kotlin/String \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/infixFunctionParam.txt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/infixFunctionParam.txt new file mode 100644 index 00000000000..ea35df5d0f9 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/infixFunctionParam.txt @@ -0,0 +1,2 @@ +expression: av +expected type: kotlin/String diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/infixFunctionParamQualified.kt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/infixFunctionParamQualified.kt index 643f208a6ca..6a08aa28bd4 100644 --- a/idea/idea-frontend-fir/testData/components/expectedExpressionType/infixFunctionParamQualified.kt +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/infixFunctionParamQualified.kt @@ -4,4 +4,3 @@ fun x() { infix fun Int.toCall(y: String): Char = 'a' -// EXPECTED_TYPE: kotlin/String \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/infixFunctionParamQualified.txt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/infixFunctionParamQualified.txt new file mode 100644 index 00000000000..ea35df5d0f9 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/infixFunctionParamQualified.txt @@ -0,0 +1,2 @@ +expression: av +expected type: kotlin/String diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/propertyDeclaration.kt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/propertyDeclaration.kt index 4b4fdb0e583..c4bf12f9810 100644 --- a/idea/idea-frontend-fir/testData/components/expectedExpressionType/propertyDeclaration.kt +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/propertyDeclaration.kt @@ -2,4 +2,3 @@ class C { var y: String = av } -// EXPECTED_TYPE: kotlin/String \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/propertyDeclaration.txt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/propertyDeclaration.txt new file mode 100644 index 00000000000..ea35df5d0f9 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/propertyDeclaration.txt @@ -0,0 +1,2 @@ +expression: av +expected type: kotlin/String diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/propertyDeclarationQualified.kt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/propertyDeclarationQualified.kt index dce43297677..94f14330339 100644 --- a/idea/idea-frontend-fir/testData/components/expectedExpressionType/propertyDeclarationQualified.kt +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/propertyDeclarationQualified.kt @@ -2,4 +2,3 @@ class C { var y: String = x.av } -// EXPECTED_TYPE: kotlin/String \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/propertyDeclarationQualified.txt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/propertyDeclarationQualified.txt new file mode 100644 index 00000000000..ea35df5d0f9 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/propertyDeclarationQualified.txt @@ -0,0 +1,2 @@ +expression: av +expected type: kotlin/String diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/propertyDeclarationWithTypeFromRHS.kt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/propertyDeclarationWithTypeFromRHS.kt index cd49ca2e2da..a121f51000d 100644 --- a/idea/idea-frontend-fir/testData/components/expectedExpressionType/propertyDeclarationWithTypeFromRHS.kt +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/propertyDeclarationWithTypeFromRHS.kt @@ -3,4 +3,3 @@ class C { var y = av } -// EXPECTED_TYPE: kotlin/String \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/propertyDeclarationWithTypeFromRHS.txt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/propertyDeclarationWithTypeFromRHS.txt new file mode 100644 index 00000000000..ea35df5d0f9 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/propertyDeclarationWithTypeFromRHS.txt @@ -0,0 +1,2 @@ +expression: av +expected type: kotlin/String diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/propertyDeclarationWithoutExplicitType.kt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/propertyDeclarationWithoutExplicitType.kt index a269fb01461..5bde74945d4 100644 --- a/idea/idea-frontend-fir/testData/components/expectedExpressionType/propertyDeclarationWithoutExplicitType.kt +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/propertyDeclarationWithoutExplicitType.kt @@ -2,4 +2,3 @@ class C { var y = x.av } -// EXPECTED_TYPE: null \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/propertyDeclarationWithoutExplicitType.txt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/propertyDeclarationWithoutExplicitType.txt new file mode 100644 index 00000000000..53684a9cf4e --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/propertyDeclarationWithoutExplicitType.txt @@ -0,0 +1,2 @@ +expression: av +expected type: null diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/returnFromFunction.kt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/returnFromFunction.kt index f439f323a4f..ab59c8b500b 100644 --- a/idea/idea-frontend-fir/testData/components/expectedExpressionType/returnFromFunction.kt +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/returnFromFunction.kt @@ -2,4 +2,3 @@ fun foo(): Int { return a } -// EXPECTED_TYPE: kotlin/Int \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/returnFromFunction.txt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/returnFromFunction.txt new file mode 100644 index 00000000000..107d52caf55 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/returnFromFunction.txt @@ -0,0 +1,2 @@ +expression: a +expected type: kotlin/Int diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/returnFromFunctionQualifiedReceiver.kt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/returnFromFunctionQualifiedReceiver.kt index b5bfe48d639..01e8f6a15c7 100644 --- a/idea/idea-frontend-fir/testData/components/expectedExpressionType/returnFromFunctionQualifiedReceiver.kt +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/returnFromFunctionQualifiedReceiver.kt @@ -2,4 +2,3 @@ fun foo(): Int { return xfd.a } -// EXPECTED_TYPE: null \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/returnFromFunctionQualifiedReceiver.txt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/returnFromFunctionQualifiedReceiver.txt new file mode 100644 index 00000000000..aead700b492 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/returnFromFunctionQualifiedReceiver.txt @@ -0,0 +1,2 @@ +expression: xfd +expected type: null diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/returnFromFunctionQualifiedSelector.kt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/returnFromFunctionQualifiedSelector.kt index 80b711af393..346f14109de 100644 --- a/idea/idea-frontend-fir/testData/components/expectedExpressionType/returnFromFunctionQualifiedSelector.kt +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/returnFromFunctionQualifiedSelector.kt @@ -2,4 +2,3 @@ fun foo(): Int { return x.a } -// EXPECTED_TYPE: kotlin/Int \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/returnFromFunctionQualifiedSelector.txt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/returnFromFunctionQualifiedSelector.txt new file mode 100644 index 00000000000..107d52caf55 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/returnFromFunctionQualifiedSelector.txt @@ -0,0 +1,2 @@ +expression: a +expected type: kotlin/Int diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/returnFromLambda.kt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/returnFromLambda.kt index c20387bf9a5..973a0eed8b8 100644 --- a/idea/idea-frontend-fir/testData/components/expectedExpressionType/returnFromLambda.kt +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/returnFromLambda.kt @@ -7,4 +7,3 @@ fun x(): Int { fun receiveLambda(x: () -> Int){} -// EXPECTED_TYPE: kotlin/Int \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/returnFromLambda.txt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/returnFromLambda.txt new file mode 100644 index 00000000000..98bb8cb4c8f --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/returnFromLambda.txt @@ -0,0 +1,2 @@ +expression: fd +expected type: kotlin/Int diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/variableAssignment.kt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/variableAssignment.kt index 444ef1a3eae..753a3a896f7 100644 --- a/idea/idea-frontend-fir/testData/components/expectedExpressionType/variableAssignment.kt +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/variableAssignment.kt @@ -3,4 +3,3 @@ fun foo() { y = av } -// EXPECTED_TYPE: kotlin/Int \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/variableAssignment.txt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/variableAssignment.txt new file mode 100644 index 00000000000..4937dc665e7 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/variableAssignment.txt @@ -0,0 +1,2 @@ +expression: av +expected type: kotlin/Int diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/variableAssignmentQualified.kt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/variableAssignmentQualified.kt index 7cb81a8f0f1..d6f1e9453e6 100644 --- a/idea/idea-frontend-fir/testData/components/expectedExpressionType/variableAssignmentQualified.kt +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/variableAssignmentQualified.kt @@ -3,4 +3,3 @@ fun foo() { y = x.av } -// EXPECTED_TYPE: kotlin/Int \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/variableAssignmentQualified.txt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/variableAssignmentQualified.txt new file mode 100644 index 00000000000..4937dc665e7 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/variableAssignmentQualified.txt @@ -0,0 +1,2 @@ +expression: av +expected type: kotlin/Int diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/whileCondition.kt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/whileCondition.kt index 3dadaff806a..8b3c4d4a92f 100644 --- a/idea/idea-frontend-fir/testData/components/expectedExpressionType/whileCondition.kt +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/whileCondition.kt @@ -2,4 +2,3 @@ fun x() { while(xy){ } -// EXPECTED_TYPE: kotlin/Boolean \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/whileCondition.txt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/whileCondition.txt new file mode 100644 index 00000000000..a678b7e0471 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/whileCondition.txt @@ -0,0 +1,2 @@ +expression: xy +expected type: kotlin/Boolean diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/whileConditionQualified.kt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/whileConditionQualified.kt index 080a09ca2b0..fe4b8dd12ea 100644 --- a/idea/idea-frontend-fir/testData/components/expectedExpressionType/whileConditionQualified.kt +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/whileConditionQualified.kt @@ -1,5 +1,3 @@ fun x() { while(x.fdfd){ -} - -// EXPECTED_TYPE: kotlin/Boolean \ No newline at end of file +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/components/expectedExpressionType/whileConditionQualified.txt b/idea/idea-frontend-fir/testData/components/expectedExpressionType/whileConditionQualified.txt new file mode 100644 index 00000000000..10d27926d5f --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expectedExpressionType/whileConditionQualified.txt @@ -0,0 +1,2 @@ +expression: fdfd +expected type: kotlin/Boolean diff --git a/idea/idea-frontend-fir/testData/components/expressionType/assignmentExpressionTarget.kt b/idea/idea-frontend-fir/testData/components/expressionType/assignmentExpressionTarget.kt index a81a6c8028b..0e3fe0fe270 100644 --- a/idea/idea-frontend-fir/testData/components/expressionType/assignmentExpressionTarget.kt +++ b/idea/idea-frontend-fir/testData/components/expressionType/assignmentExpressionTarget.kt @@ -1,8 +1,4 @@ fun test(s: String) { var i: Int = 0 i = s.length -} - -// RESULT -// expression: i -// type: kotlin.Int +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/components/expressionType/assignmentExpressionTarget.txt b/idea/idea-frontend-fir/testData/components/expressionType/assignmentExpressionTarget.txt new file mode 100644 index 00000000000..5345faed6a0 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expressionType/assignmentExpressionTarget.txt @@ -0,0 +1,2 @@ +expression: i +type: kotlin.Int diff --git a/idea/idea-frontend-fir/testData/components/expressionType/binaryExpression.kt b/idea/idea-frontend-fir/testData/components/expressionType/binaryExpression.kt index c4e34f1dbab..efe551d0b59 100644 --- a/idea/idea-frontend-fir/testData/components/expressionType/binaryExpression.kt +++ b/idea/idea-frontend-fir/testData/components/expressionType/binaryExpression.kt @@ -1,5 +1 @@ -val x = 1 + 2 - -// RESULT -// expression: 1 + 2 -// type: kotlin.Int +val x = 1 + 2 \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/components/expressionType/binaryExpression.txt b/idea/idea-frontend-fir/testData/components/expressionType/binaryExpression.txt new file mode 100644 index 00000000000..91fb529c016 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expressionType/binaryExpression.txt @@ -0,0 +1,2 @@ +expression: 1 + 2 +type: kotlin.Int diff --git a/idea/idea-frontend-fir/testData/components/expressionType/breakExpression.kt b/idea/idea-frontend-fir/testData/components/expressionType/breakExpression.kt index 76819150ae7..a70d2381b57 100644 --- a/idea/idea-frontend-fir/testData/components/expressionType/breakExpression.kt +++ b/idea/idea-frontend-fir/testData/components/expressionType/breakExpression.kt @@ -3,7 +3,3 @@ fun x(): Int { break } } - -// RESULT -// expression: break -// type: kotlin.Nothing diff --git a/idea/idea-frontend-fir/testData/components/expressionType/breakExpression.txt b/idea/idea-frontend-fir/testData/components/expressionType/breakExpression.txt new file mode 100644 index 00000000000..4e841e550d5 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expressionType/breakExpression.txt @@ -0,0 +1,2 @@ +expression: break +type: kotlin.Nothing diff --git a/idea/idea-frontend-fir/testData/components/expressionType/forExpression.kt b/idea/idea-frontend-fir/testData/components/expressionType/forExpression.kt index 573ed368f8e..b2d1361d745 100644 --- a/idea/idea-frontend-fir/testData/components/expressionType/forExpression.kt +++ b/idea/idea-frontend-fir/testData/components/expressionType/forExpression.kt @@ -1,7 +1,3 @@ fun x(): Int { for(i in 1..2) {} } - -// RESULT -// expression: for(i in 1..2) {} -// type: kotlin.Unit diff --git a/idea/idea-frontend-fir/testData/components/expressionType/forExpression.txt b/idea/idea-frontend-fir/testData/components/expressionType/forExpression.txt new file mode 100644 index 00000000000..9bea82abe77 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expressionType/forExpression.txt @@ -0,0 +1,2 @@ +expression: for(i in 1..2) {} +type: kotlin.Unit diff --git a/idea/idea-frontend-fir/testData/components/expressionType/functionCall.kt b/idea/idea-frontend-fir/testData/components/expressionType/functionCall.kt index 1b13c05a025..3676991e88a 100644 --- a/idea/idea-frontend-fir/testData/components/expressionType/functionCall.kt +++ b/idea/idea-frontend-fir/testData/components/expressionType/functionCall.kt @@ -1,6 +1,2 @@ val a = 12 val x = 12.toByte() - -// RESULT -// expression: 12.toByte() -// type: kotlin.Byte diff --git a/idea/idea-frontend-fir/testData/components/expressionType/functionCall.txt b/idea/idea-frontend-fir/testData/components/expressionType/functionCall.txt new file mode 100644 index 00000000000..58c177d845e --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expressionType/functionCall.txt @@ -0,0 +1,2 @@ +expression: 12.toByte() +type: kotlin.Byte diff --git a/idea/idea-frontend-fir/testData/components/expressionType/inParens.kt b/idea/idea-frontend-fir/testData/components/expressionType/inParens.kt index 29b384c0f42..534ae9c2d6f 100644 --- a/idea/idea-frontend-fir/testData/components/expressionType/inParens.kt +++ b/idea/idea-frontend-fir/testData/components/expressionType/inParens.kt @@ -1,5 +1 @@ val x = (1 + 2) + 3 - -// RESULT -// expression: (1 + 2) -// type: kotlin.Int diff --git a/idea/idea-frontend-fir/testData/components/expressionType/inParens.txt b/idea/idea-frontend-fir/testData/components/expressionType/inParens.txt new file mode 100644 index 00000000000..ff90b6b93b0 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expressionType/inParens.txt @@ -0,0 +1,2 @@ +expression: (1 + 2) +type: kotlin.Int diff --git a/idea/idea-frontend-fir/testData/components/expressionType/insideStringTemplate.kt b/idea/idea-frontend-fir/testData/components/expressionType/insideStringTemplate.kt index fce9d334d66..1ee83d45752 100644 --- a/idea/idea-frontend-fir/testData/components/expressionType/insideStringTemplate.kt +++ b/idea/idea-frontend-fir/testData/components/expressionType/insideStringTemplate.kt @@ -1,6 +1,2 @@ val a = 10 val x = "abc${a}defg" - -// RESULT -// expression: a -// type: kotlin.Int diff --git a/idea/idea-frontend-fir/testData/components/expressionType/insideStringTemplate.txt b/idea/idea-frontend-fir/testData/components/expressionType/insideStringTemplate.txt new file mode 100644 index 00000000000..df412c6a5ec --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expressionType/insideStringTemplate.txt @@ -0,0 +1,2 @@ +expression: a +type: kotlin.Int diff --git a/idea/idea-frontend-fir/testData/components/expressionType/insideStringTemplateWithBinrary.kt b/idea/idea-frontend-fir/testData/components/expressionType/insideStringTemplateWithBinrary.kt index e5d1a373bd7..8f39357ccbb 100644 --- a/idea/idea-frontend-fir/testData/components/expressionType/insideStringTemplateWithBinrary.kt +++ b/idea/idea-frontend-fir/testData/components/expressionType/insideStringTemplateWithBinrary.kt @@ -1,6 +1,2 @@ val a = 10 -val x = "abc${a + 20}defg" - -// RESULT -// expression: a -// type: kotlin.Int +val x = "abc${a + 20}defg" \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/components/expressionType/insideStringTemplateWithBinrary.txt b/idea/idea-frontend-fir/testData/components/expressionType/insideStringTemplateWithBinrary.txt new file mode 100644 index 00000000000..df412c6a5ec --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expressionType/insideStringTemplateWithBinrary.txt @@ -0,0 +1,2 @@ +expression: a +type: kotlin.Int diff --git a/idea/idea-frontend-fir/testData/components/expressionType/intLiteral.kt b/idea/idea-frontend-fir/testData/components/expressionType/intLiteral.kt index b910fb77b6e..66d77d6167e 100644 --- a/idea/idea-frontend-fir/testData/components/expressionType/intLiteral.kt +++ b/idea/idea-frontend-fir/testData/components/expressionType/intLiteral.kt @@ -1,5 +1 @@ -val x = 1 - -// RESULT -// expression: 1 -// type: kotlin.Int +val x = 1 \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/components/expressionType/intLiteral.txt b/idea/idea-frontend-fir/testData/components/expressionType/intLiteral.txt new file mode 100644 index 00000000000..b9883c7e737 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expressionType/intLiteral.txt @@ -0,0 +1,2 @@ +expression: 1 +type: kotlin.Int diff --git a/idea/idea-frontend-fir/testData/components/expressionType/property.kt b/idea/idea-frontend-fir/testData/components/expressionType/property.kt index 73d10ea4fbd..0f93e958ed4 100644 --- a/idea/idea-frontend-fir/testData/components/expressionType/property.kt +++ b/idea/idea-frontend-fir/testData/components/expressionType/property.kt @@ -1,6 +1,2 @@ val a = 10 val x = 1 - -// RESULT -// expression: val x = 1 -// type: kotlin.Unit diff --git a/idea/idea-frontend-fir/testData/components/expressionType/property.txt b/idea/idea-frontend-fir/testData/components/expressionType/property.txt new file mode 100644 index 00000000000..23f93064e74 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expressionType/property.txt @@ -0,0 +1,2 @@ +expression: val x = 1 +type: kotlin.Unit diff --git a/idea/idea-frontend-fir/testData/components/expressionType/returnExpression.kt b/idea/idea-frontend-fir/testData/components/expressionType/returnExpression.kt index f73e8976105..58f436caa7c 100644 --- a/idea/idea-frontend-fir/testData/components/expressionType/returnExpression.kt +++ b/idea/idea-frontend-fir/testData/components/expressionType/returnExpression.kt @@ -1,7 +1,3 @@ fun x(): Int { return 1 -} - -// RESULT -// expression: return 1 -// type: kotlin.Nothing +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/testData/components/expressionType/returnExpression.txt b/idea/idea-frontend-fir/testData/components/expressionType/returnExpression.txt new file mode 100644 index 00000000000..9c17ea9450f --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expressionType/returnExpression.txt @@ -0,0 +1,2 @@ +expression: return 1 +type: kotlin.Nothing diff --git a/idea/idea-frontend-fir/testData/components/expressionType/stringLiteral.kt b/idea/idea-frontend-fir/testData/components/expressionType/stringLiteral.kt index 780aaea518e..60150b1541e 100644 --- a/idea/idea-frontend-fir/testData/components/expressionType/stringLiteral.kt +++ b/idea/idea-frontend-fir/testData/components/expressionType/stringLiteral.kt @@ -1,5 +1 @@ val x = "abc" - -// RESULT -// expression: "abc" -// type: kotlin.String diff --git a/idea/idea-frontend-fir/testData/components/expressionType/stringLiteral.txt b/idea/idea-frontend-fir/testData/components/expressionType/stringLiteral.txt new file mode 100644 index 00000000000..6f19e36cb6c --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expressionType/stringLiteral.txt @@ -0,0 +1,2 @@ +expression: "abc" +type: kotlin.String diff --git a/idea/idea-frontend-fir/testData/components/expressionType/whileExpression.kt b/idea/idea-frontend-fir/testData/components/expressionType/whileExpression.kt index 61aad1166cd..bc6bd544cd2 100644 --- a/idea/idea-frontend-fir/testData/components/expressionType/whileExpression.kt +++ b/idea/idea-frontend-fir/testData/components/expressionType/whileExpression.kt @@ -1,7 +1,3 @@ fun x(): Int { while(true) {} } - -// RESULT -// expression: while(true) {} -// type: kotlin.Unit diff --git a/idea/idea-frontend-fir/testData/components/expressionType/whileExpression.txt b/idea/idea-frontend-fir/testData/components/expressionType/whileExpression.txt new file mode 100644 index 00000000000..0f5c9cedfc1 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/expressionType/whileExpression.txt @@ -0,0 +1,2 @@ +expression: while(true) {} +type: kotlin.Unit diff --git a/idea/idea-frontend-fir/testData/components/overridenDeclarations/inOtherFile.txt b/idea/idea-frontend-fir/testData/components/overridenDeclarations/inOtherFile.txt new file mode 100644 index 00000000000..56d27ea1f16 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/overridenDeclarations/inOtherFile.txt @@ -0,0 +1,4 @@ +ALL: + B.foo(x: Int): Int +DIRECT: + B.foo(x: Int): Int diff --git a/idea/idea-frontend-fir/testData/components/overridenDeclarations/intersectionOverride.txt b/idea/idea-frontend-fir/testData/components/overridenDeclarations/intersectionOverride.txt new file mode 100644 index 00000000000..261618fe003 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/overridenDeclarations/intersectionOverride.txt @@ -0,0 +1,6 @@ +ALL: + C.foo(x: String): Unit + D.foo(x: String): Unit +DIRECT: + C.foo(x: String): Unit + D.foo(x: String): Unit diff --git a/idea/idea-frontend-fir/testData/components/overridenDeclarations/intersectionOverride2.txt b/idea/idea-frontend-fir/testData/components/overridenDeclarations/intersectionOverride2.txt new file mode 100644 index 00000000000..261618fe003 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/overridenDeclarations/intersectionOverride2.txt @@ -0,0 +1,6 @@ +ALL: + C.foo(x: String): Unit + D.foo(x: String): Unit +DIRECT: + C.foo(x: String): Unit + D.foo(x: String): Unit diff --git a/idea/idea-frontend-fir/testData/components/overridenDeclarations/javaAccessors.txt b/idea/idea-frontend-fir/testData/components/overridenDeclarations/javaAccessors.txt new file mode 100644 index 00000000000..06093ac2278 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/overridenDeclarations/javaAccessors.txt @@ -0,0 +1,5 @@ +ALL: + /B.x: Int + C.x: Int +DIRECT: + /B.x: Int diff --git a/idea/idea-frontend-fir/testData/components/overridenDeclarations/multipleInterfaces.txt b/idea/idea-frontend-fir/testData/components/overridenDeclarations/multipleInterfaces.txt new file mode 100644 index 00000000000..ebfb487f6b7 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/overridenDeclarations/multipleInterfaces.txt @@ -0,0 +1,8 @@ +ALL: + B.foo(x: String): Unit + C.foo(x: String): Unit + D.foo(x: String): Unit +DIRECT: + B.foo(x: String): Unit + C.foo(x: String): Unit + D.foo(x: String): Unit diff --git a/idea/idea-frontend-fir/testData/components/overridenDeclarations/sequenceOfOverrides.txt b/idea/idea-frontend-fir/testData/components/overridenDeclarations/sequenceOfOverrides.txt new file mode 100644 index 00000000000..33b93983dc7 --- /dev/null +++ b/idea/idea-frontend-fir/testData/components/overridenDeclarations/sequenceOfOverrides.txt @@ -0,0 +1,6 @@ +ALL: + B.foo(x: Int): Unit + C.foo(x: Int): Unit + D.foo(x: Int): Unit +DIRECT: + B.foo(x: Int): Unit diff --git a/idea/idea-frontend-fir/testData/fileScopeTest/simpleFileScope.txt b/idea/idea-frontend-fir/testData/fileScopeTest/simpleFileScope.txt new file mode 100644 index 00000000000..80d27e7d217 --- /dev/null +++ b/idea/idea-frontend-fir/testData/fileScopeTest/simpleFileScope.txt @@ -0,0 +1,96 @@ +FILE SYMBOL: +KtFirFileSymbol: + annotationClassIds: [] + annotations: [] + origin: SOURCE + +CALLABLE NAMES: +[test, testVal] + +CALLABLE SYMBOLS: +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: /test + dispatchType: null + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: FINAL + name: test + origin: SOURCE + receiverType: null + symbolKind: TOP_LEVEL + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirKotlinPropertySymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: /testVal + dispatchType: null + getter: KtFirPropertyGetterSymbol() + hasBackingField: true + hasGetter: true + hasSetter: false + initializer: 2 + isConst: false + isExtension: false + isLateInit: false + isOverride: false + isVal: true + modality: FINAL + name: testVal + origin: SOURCE + receiverType: null + setter: null + symbolKind: TOP_LEVEL + visibility: Public + +CLASSIFIER NAMES: +[C, I] + +CLASSIFIER SYMBOLS: +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [] + annotations: [] + classIdIfNonLocal: C + classKind: CLASS + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: C + origin: SOURCE + superTypes: [[] kotlin/Any] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [] + annotations: [] + classIdIfNonLocal: I + classKind: INTERFACE + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: ABSTRACT + name: I + origin: SOURCE + superTypes: [[] kotlin/Any] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public diff --git a/idea/idea-frontend-fir/testData/memberScopeByFqName/Int.txt b/idea/idea-frontend-fir/testData/memberScopeByFqName/Int.txt new file mode 100644 index 00000000000..1aa2d52205e --- /dev/null +++ b/idea/idea-frontend-fir/testData/memberScopeByFqName/Int.txt @@ -0,0 +1,1331 @@ +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.and + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: FINAL + name: and + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.compareTo + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: compareTo + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.compareTo + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: compareTo + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.compareTo + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: compareTo + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.compareTo + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: OPEN + name: compareTo + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.compareTo + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: compareTo + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.compareTo + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: compareTo + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.dec + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: dec + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.div + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: div + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Double + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.div + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: div + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Float + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.div + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: div + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.div + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: div + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Long + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.div + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: div + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.div + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: div + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.inc + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: inc + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.inv + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: FINAL + name: inv + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.minus + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: minus + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Double + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.minus + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: minus + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Float + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.minus + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: minus + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.minus + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: minus + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Long + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.minus + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: minus + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.minus + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: minus + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.or + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: FINAL + name: or + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.plus + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: plus + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Double + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.plus + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: plus + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Float + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.plus + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: plus + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.plus + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: plus + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Long + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.plus + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: plus + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.plus + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: plus + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/ranges/IntRange + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.rangeTo + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: rangeTo + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/ranges/IntRange + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.rangeTo + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: rangeTo + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/ranges/LongRange + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.rangeTo + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: rangeTo + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/ranges/IntRange + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.rangeTo + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: rangeTo + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [kotlin/SinceKotlin] + annotations: [kotlin/SinceKotlin(version = 1.1)] + callableIdIfNonLocal: kotlin/Int.rem + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: rem + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Double + annotationClassIds: [kotlin/SinceKotlin] + annotations: [kotlin/SinceKotlin(version = 1.1)] + callableIdIfNonLocal: kotlin/Int.rem + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: rem + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Float + annotationClassIds: [kotlin/SinceKotlin] + annotations: [kotlin/SinceKotlin(version = 1.1)] + callableIdIfNonLocal: kotlin/Int.rem + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: rem + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [kotlin/SinceKotlin] + annotations: [kotlin/SinceKotlin(version = 1.1)] + callableIdIfNonLocal: kotlin/Int.rem + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: rem + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Long + annotationClassIds: [kotlin/SinceKotlin] + annotations: [kotlin/SinceKotlin(version = 1.1)] + callableIdIfNonLocal: kotlin/Int.rem + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: rem + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [kotlin/SinceKotlin] + annotations: [kotlin/SinceKotlin(version = 1.1)] + callableIdIfNonLocal: kotlin/Int.rem + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: rem + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.shl + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: FINAL + name: shl + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(bitCount)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.shr + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: FINAL + name: shr + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(bitCount)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.times + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: times + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Double + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.times + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: times + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Float + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.times + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: times + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.times + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: times + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Long + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.times + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: times + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.times + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: times + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Byte + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.toByte + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: toByte + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Char + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.toChar + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: toChar + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Double + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.toDouble + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: toDouble + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Float + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.toFloat + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: toFloat + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.toInt + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: toInt + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Long + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.toLong + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: toLong + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Short + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.toShort + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: toShort + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.unaryMinus + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: unaryMinus + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.unaryPlus + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: FINAL + name: unaryPlus + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.ushr + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: FINAL + name: ushr + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(bitCount)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Int.xor + dispatchType: kotlin/Int + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: FINAL + name: xor + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Boolean + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Any.equals + dispatchType: kotlin/Any + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: OPEN + name: equals + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Any.hashCode + dispatchType: kotlin/Any + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: hashCode + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/String + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Any.toString + dispatchType: kotlin/Any + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: toString + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [] + annotations: [] + classIdIfNonLocal: kotlin/Int.Companion + classKind: COMPANION_OBJECT + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: Companion + origin: LIBRARY + superTypes: [[] kotlin/Any] + symbolKind: MEMBER + typeParameters: [] + visibility: Public + +KtFirConstructorSymbol: + annotatedType: [] java/lang/Integer + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: null + containingClassIdIfNonLocal: java/lang/Integer + dispatchType: null + isExtension: false + isPrimary: false + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0)] + visibility: Public + +KtFirConstructorSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: null + containingClassIdIfNonLocal: kotlin/Int + dispatchType: null + isExtension: false + isPrimary: true + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Private diff --git a/idea/idea-frontend-fir/testData/memberScopeByFqName/MutableList.txt b/idea/idea-frontend-fir/testData/memberScopeByFqName/MutableList.txt new file mode 100644 index 00000000000..672b2ae058c --- /dev/null +++ b/idea/idea-frontend-fir/testData/memberScopeByFqName/MutableList.txt @@ -0,0 +1,506 @@ +KtFirFunctionSymbol: + annotatedType: [] kotlin/Boolean + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/collections/MutableList.add + dispatchType: kotlin/collections/MutableList + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: ABSTRACT + name: add + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(element)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Unit + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/collections/MutableList.add + dispatchType: kotlin/collections/MutableList + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: ABSTRACT + name: add + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(index), KtFirValueParameterSymbol(element)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Boolean + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/collections/MutableList.addAll + dispatchType: kotlin/collections/MutableList + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: ABSTRACT + name: addAll + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(index), KtFirValueParameterSymbol(elements)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Boolean + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/collections/MutableList.addAll + dispatchType: kotlin/collections/MutableList + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: ABSTRACT + name: addAll + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(elements)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Unit + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/collections/MutableList.clear + dispatchType: kotlin/collections/MutableList + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: ABSTRACT + name: clear + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/collections/MutableListIterator + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/collections/MutableList.listIterator + dispatchType: kotlin/collections/MutableList + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: ABSTRACT + name: listIterator + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/collections/MutableListIterator + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/collections/MutableList.listIterator + dispatchType: kotlin/collections/MutableList + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: ABSTRACT + name: listIterator + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(index)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Boolean + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/collections/MutableList.remove + dispatchType: kotlin/collections/MutableList + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: ABSTRACT + name: remove + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(element)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Boolean + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/collections/MutableList.removeAll + dispatchType: kotlin/collections/MutableList + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: ABSTRACT + name: removeAll + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(elements)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] E + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/collections/MutableList.removeAt + dispatchType: kotlin/collections/MutableList + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: ABSTRACT + name: removeAt + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(index)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Boolean + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/collections/MutableList.retainAll + dispatchType: kotlin/collections/MutableList + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: ABSTRACT + name: retainAll + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(elements)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] E + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/collections/MutableList.set + dispatchType: kotlin/collections/MutableList + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: ABSTRACT + name: set + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(index), KtFirValueParameterSymbol(element)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/collections/MutableList + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/collections/MutableList.subList + dispatchType: kotlin/collections/MutableList + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: ABSTRACT + name: subList + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(fromIndex), KtFirValueParameterSymbol(toIndex)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Boolean + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/collections/MutableList.contains + dispatchType: kotlin/collections/MutableList + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: ABSTRACT + name: contains + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(element)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Boolean + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/collections/MutableList.containsAll + dispatchType: kotlin/collections/MutableList + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: ABSTRACT + name: containsAll + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(elements)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] E + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/collections/MutableList.get + dispatchType: kotlin/collections/MutableList + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: ABSTRACT + name: get + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(index)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/collections/MutableList.indexOf + dispatchType: kotlin/collections/MutableList + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: ABSTRACT + name: indexOf + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(element)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Boolean + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/collections/List.isEmpty + dispatchType: kotlin/collections/List + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: ABSTRACT + name: isEmpty + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/collections/MutableIterator + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/collections/MutableList.iterator + dispatchType: kotlin/collections/MutableList + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: ABSTRACT + name: iterator + origin: INTERSECTION_OVERRIDE + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/collections/MutableList.lastIndexOf + dispatchType: kotlin/collections/MutableList + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: ABSTRACT + name: lastIndexOf + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(element)] + visibility: Public + +KtFirKotlinPropertySymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/collections/List.size + dispatchType: kotlin/collections/List + getter: KtFirPropertyGetterSymbol() + hasBackingField: false + hasGetter: true + hasSetter: false + initializer: null + isConst: false + isExtension: false + isLateInit: false + isOverride: false + isVal: true + modality: ABSTRACT + name: size + origin: LIBRARY + receiverType: null + setter: null + symbolKind: MEMBER + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Boolean + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Any.equals + dispatchType: kotlin/Any + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: OPEN + name: equals + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Any.hashCode + dispatchType: kotlin/Any + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: hashCode + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/String + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Any.toString + dispatchType: kotlin/Any + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: toString + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public diff --git a/idea/idea-frontend-fir/testData/memberScopeByFqName/java.lang.String.txt b/idea/idea-frontend-fir/testData/memberScopeByFqName/java.lang.String.txt new file mode 100644 index 00000000000..50418c8412d --- /dev/null +++ b/idea/idea-frontend-fir/testData/memberScopeByFqName/java.lang.String.txt @@ -0,0 +1,1526 @@ +KtFirJavaFieldSymbol: + annotatedType: [] ft + callableIdIfNonLocal: java/lang/String.value + isExtension: false + isVal: true + modality: FINAL + name: value + origin: JAVA + receiverType: null + symbolKind: MEMBER + visibility: Private + +KtFirJavaFieldSymbol: + annotatedType: [] kotlin/Int + callableIdIfNonLocal: java/lang/String.hash + isExtension: false + isVal: false + modality: OPEN + name: hash + origin: JAVA + receiverType: null + symbolKind: MEMBER + visibility: Private + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.hash32 + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: hash32 + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: PackageVisibility + +KtFirJavaFieldSymbol: + annotatedType: [] kotlin/Int + callableIdIfNonLocal: java/lang/String.hash32 + isExtension: false + isVal: false + modality: OPEN + name: hash32 + origin: JAVA + receiverType: null + symbolKind: MEMBER + visibility: Private + +KtFirSyntheticJavaPropertySymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.length + dispatchType: java/lang/String + getter: KtFirPropertyGetterSymbol() + hasBackingField: true + hasGetter: true + hasSetter: false + initializer: null + isExtension: false + isOverride: false + isVal: true + javaGetterName: length + javaSetterName: null + modality: OPEN + name: length + origin: JAVA_SYNTHETIC_PROPERTY + receiverType: null + setter: null + symbolKind: MEMBER + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Boolean + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.isEmpty + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: isEmpty + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Char + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.charAt + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: charAt + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.codePointAt + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: codePointAt + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.codePointBefore + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: codePointBefore + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.codePointCount + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: codePointCount + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0), KtFirValueParameterSymbol(p1)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.offsetByCodePoints + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: offsetByCodePoints + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0), KtFirValueParameterSymbol(p1)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Unit + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.getChars + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: getChars + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0), KtFirValueParameterSymbol(p1)] + visibility: PackageVisibility + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Unit + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.getChars + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: getChars + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0), KtFirValueParameterSymbol(p1), KtFirValueParameterSymbol(p2), KtFirValueParameterSymbol(p3)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Unit + annotationClassIds: [kotlin/Deprecated] + annotations: [kotlin/Deprecated(message = Deprecated in Java)] + callableIdIfNonLocal: java/lang/String.getBytes + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: getBytes + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0), KtFirValueParameterSymbol(p1), KtFirValueParameterSymbol(p2), KtFirValueParameterSymbol(p3)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] ft + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.getBytes + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: getBytes + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] ft + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.getBytes + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: getBytes + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] ft + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.getBytes + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: getBytes + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Boolean + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.equals + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: OPEN + name: equals + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Boolean + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.contentEquals + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: contentEquals + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Boolean + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.contentEquals + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: contentEquals + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Boolean + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.equalsIgnoreCase + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: equalsIgnoreCase + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.compareTo + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: OPEN + name: compareTo + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.compareToIgnoreCase + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: compareToIgnoreCase + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Boolean + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.regionMatches + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: regionMatches + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0), KtFirValueParameterSymbol(p1), KtFirValueParameterSymbol(p2), KtFirValueParameterSymbol(p3)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Boolean + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.regionMatches + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: regionMatches + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0), KtFirValueParameterSymbol(p1), KtFirValueParameterSymbol(p2), KtFirValueParameterSymbol(p3), KtFirValueParameterSymbol(p4)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Boolean + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.startsWith + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: startsWith + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0), KtFirValueParameterSymbol(p1)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Boolean + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.startsWith + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: startsWith + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Boolean + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.endsWith + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: endsWith + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.hashCode + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: hashCode + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.indexOf + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: indexOf + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.indexOf + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: indexOf + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0), KtFirValueParameterSymbol(p1)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.indexOf + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: indexOf + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.indexOf + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: indexOf + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0), KtFirValueParameterSymbol(p1)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.indexOfSupplementary + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: indexOfSupplementary + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0), KtFirValueParameterSymbol(p1)] + visibility: Private + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.lastIndexOf + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: lastIndexOf + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.lastIndexOf + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: lastIndexOf + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0), KtFirValueParameterSymbol(p1)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.lastIndexOf + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: lastIndexOf + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.lastIndexOf + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: lastIndexOf + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0), KtFirValueParameterSymbol(p1)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.lastIndexOfSupplementary + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: lastIndexOfSupplementary + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0), KtFirValueParameterSymbol(p1)] + visibility: Private + +KtFirFunctionSymbol: + annotatedType: [] ft + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.substring + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: substring + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] ft + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.substring + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: substring + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0), KtFirValueParameterSymbol(p1)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] @EnhancedNullability kotlin/CharSequence + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.subSequence + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: subSequence + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0), KtFirValueParameterSymbol(p1)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] ft + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.concat + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: concat + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] ft + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.replace + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: replace + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0), KtFirValueParameterSymbol(p1)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] ft + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.replace + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: replace + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0), KtFirValueParameterSymbol(p1)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Boolean + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.matches + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: matches + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Boolean + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.contains + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: OPEN + name: contains + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] ft + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.replaceFirst + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: replaceFirst + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0), KtFirValueParameterSymbol(p1)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] ft + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.replaceAll + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: replaceAll + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0), KtFirValueParameterSymbol(p1)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] ft>, kotlin/Array>?> + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.split + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: split + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0), KtFirValueParameterSymbol(p1)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] ft>, kotlin/Array>?> + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.split + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: split + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] ft + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.toLowerCase + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: toLowerCase + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] ft + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.toLowerCase + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: toLowerCase + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] ft + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.toUpperCase + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: toUpperCase + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] ft + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.toUpperCase + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: toUpperCase + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] ft + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.trim + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: trim + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] @EnhancedNullability kotlin/String + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.toString + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: toString + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] ft + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.toCharArray + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: toCharArray + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] ft + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: java/lang/String.intern + dispatchType: java/lang/String + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: intern + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Char + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/CharSequence.get + dispatchType: kotlin/CharSequence + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: ABSTRACT + name: get + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(index)] + visibility: Public + +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [] + annotations: [] + classIdIfNonLocal: java/lang/String.CaseInsensitiveComparator + classKind: CLASS + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: OPEN + name: CaseInsensitiveComparator + origin: JAVA + superTypes: [[] kotlin/Any, [] java/util/Comparator>, [] java/io/Serializable] + symbolKind: MEMBER + typeParameters: [] + visibility: Private + +KtFirConstructorSymbol: + annotatedType: [] java/lang/String + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: null + containingClassIdIfNonLocal: java/lang/String + dispatchType: null + isExtension: false + isPrimary: false + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirConstructorSymbol: + annotatedType: [] java/lang/String + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: null + containingClassIdIfNonLocal: java/lang/String + dispatchType: null + isExtension: false + isPrimary: false + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0)] + visibility: Public + +KtFirConstructorSymbol: + annotatedType: [] java/lang/String + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: null + containingClassIdIfNonLocal: java/lang/String + dispatchType: null + isExtension: false + isPrimary: false + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0)] + visibility: Public + +KtFirConstructorSymbol: + annotatedType: [] java/lang/String + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: null + containingClassIdIfNonLocal: java/lang/String + dispatchType: null + isExtension: false + isPrimary: false + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0), KtFirValueParameterSymbol(p1), KtFirValueParameterSymbol(p2)] + visibility: Public + +KtFirConstructorSymbol: + annotatedType: [] java/lang/String + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: null + containingClassIdIfNonLocal: java/lang/String + dispatchType: null + isExtension: false + isPrimary: false + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0), KtFirValueParameterSymbol(p1), KtFirValueParameterSymbol(p2)] + visibility: Public + +KtFirConstructorSymbol: + annotatedType: [] java/lang/String + annotationClassIds: [kotlin/Deprecated] + annotations: [kotlin/Deprecated(message = Deprecated in Java)] + callableIdIfNonLocal: null + containingClassIdIfNonLocal: java/lang/String + dispatchType: null + isExtension: false + isPrimary: false + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0), KtFirValueParameterSymbol(p1), KtFirValueParameterSymbol(p2), KtFirValueParameterSymbol(p3)] + visibility: Public + +KtFirConstructorSymbol: + annotatedType: [] java/lang/String + annotationClassIds: [kotlin/Deprecated] + annotations: [kotlin/Deprecated(message = Deprecated in Java)] + callableIdIfNonLocal: null + containingClassIdIfNonLocal: java/lang/String + dispatchType: null + isExtension: false + isPrimary: false + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0), KtFirValueParameterSymbol(p1)] + visibility: Public + +KtFirConstructorSymbol: + annotatedType: [] java/lang/String + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: null + containingClassIdIfNonLocal: java/lang/String + dispatchType: null + isExtension: false + isPrimary: false + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0), KtFirValueParameterSymbol(p1), KtFirValueParameterSymbol(p2), KtFirValueParameterSymbol(p3)] + visibility: Public + +KtFirConstructorSymbol: + annotatedType: [] java/lang/String + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: null + containingClassIdIfNonLocal: java/lang/String + dispatchType: null + isExtension: false + isPrimary: false + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0), KtFirValueParameterSymbol(p1), KtFirValueParameterSymbol(p2), KtFirValueParameterSymbol(p3)] + visibility: Public + +KtFirConstructorSymbol: + annotatedType: [] java/lang/String + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: null + containingClassIdIfNonLocal: java/lang/String + dispatchType: null + isExtension: false + isPrimary: false + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0), KtFirValueParameterSymbol(p1)] + visibility: Public + +KtFirConstructorSymbol: + annotatedType: [] java/lang/String + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: null + containingClassIdIfNonLocal: java/lang/String + dispatchType: null + isExtension: false + isPrimary: false + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0), KtFirValueParameterSymbol(p1)] + visibility: Public + +KtFirConstructorSymbol: + annotatedType: [] java/lang/String + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: null + containingClassIdIfNonLocal: java/lang/String + dispatchType: null + isExtension: false + isPrimary: false + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0), KtFirValueParameterSymbol(p1), KtFirValueParameterSymbol(p2)] + visibility: Public + +KtFirConstructorSymbol: + annotatedType: [] java/lang/String + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: null + containingClassIdIfNonLocal: java/lang/String + dispatchType: null + isExtension: false + isPrimary: false + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0)] + visibility: Public + +KtFirConstructorSymbol: + annotatedType: [] java/lang/String + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: null + containingClassIdIfNonLocal: java/lang/String + dispatchType: null + isExtension: false + isPrimary: false + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0)] + visibility: Public + +KtFirConstructorSymbol: + annotatedType: [] java/lang/String + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: null + containingClassIdIfNonLocal: java/lang/String + dispatchType: null + isExtension: false + isPrimary: false + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0)] + visibility: Public + +KtFirConstructorSymbol: + annotatedType: [] java/lang/String + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: null + containingClassIdIfNonLocal: java/lang/String + dispatchType: null + isExtension: false + isPrimary: false + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0), KtFirValueParameterSymbol(p1)] + visibility: PackageVisibility + +KtFirConstructorSymbol: + annotatedType: [] java/lang/String + annotationClassIds: [kotlin/Deprecated] + annotations: [kotlin/Deprecated(message = Deprecated in Java)] + callableIdIfNonLocal: null + containingClassIdIfNonLocal: java/lang/String + dispatchType: null + isExtension: false + isPrimary: false + origin: JAVA + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p0), KtFirValueParameterSymbol(p1), KtFirValueParameterSymbol(p2)] + visibility: PackageVisibility diff --git a/idea/idea-frontend-fir/testData/memberScopeByFqName/kotlin.Function2.txt b/idea/idea-frontend-fir/testData/memberScopeByFqName/kotlin.Function2.txt new file mode 100644 index 00000000000..79a214f48e1 --- /dev/null +++ b/idea/idea-frontend-fir/testData/memberScopeByFqName/kotlin.Function2.txt @@ -0,0 +1,83 @@ +KtFirFunctionSymbol: + annotatedType: [] R + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Function2.invoke + dispatchType: kotlin/Function2 + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: ABSTRACT + name: invoke + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(p1), KtFirValueParameterSymbol(p2)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Boolean + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Any.equals + dispatchType: kotlin/Any + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: OPEN + name: equals + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(other)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Any.hashCode + dispatchType: kotlin/Any + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: hashCode + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/String + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/Any.toString + dispatchType: kotlin/Any + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: OPEN + name: toString + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public diff --git a/idea/idea-frontend-fir/testData/symbols/symbolByFqName/class.txt b/idea/idea-frontend-fir/testData/symbols/symbolByFqName/class.txt new file mode 100644 index 00000000000..cb6ad62b236 --- /dev/null +++ b/idea/idea-frontend-fir/testData/symbols/symbolByFqName/class.txt @@ -0,0 +1,18 @@ +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [] + annotations: [] + classIdIfNonLocal: kotlin/Lazy + classKind: INTERFACE + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: ABSTRACT + name: Lazy + origin: LIBRARY + superTypes: [[] kotlin/Any] + symbolKind: TOP_LEVEL + typeParameters: [KtFirTypeParameterSymbol(T)] + visibility: Public diff --git a/idea/idea-frontend-fir/testData/symbols/symbolByFqName/classFromJdk.txt b/idea/idea-frontend-fir/testData/symbols/symbolByFqName/classFromJdk.txt new file mode 100644 index 00000000000..a2a8553c90e --- /dev/null +++ b/idea/idea-frontend-fir/testData/symbols/symbolByFqName/classFromJdk.txt @@ -0,0 +1,18 @@ +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [] + annotations: [] + classIdIfNonLocal: java/lang/String + classKind: CLASS + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: String + origin: JAVA + superTypes: [[] kotlin/Any, [] java/io/Serializable, [] kotlin/Comparable>, [] kotlin/CharSequence] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public diff --git a/idea/idea-frontend-fir/testData/symbols/symbolByFqName/enumEntry.txt b/idea/idea-frontend-fir/testData/symbols/symbolByFqName/enumEntry.txt new file mode 100644 index 00000000000..34171a86f0e --- /dev/null +++ b/idea/idea-frontend-fir/testData/symbols/symbolByFqName/enumEntry.txt @@ -0,0 +1,9 @@ +KtFirEnumEntrySymbol: + annotatedType: [] kotlin/LazyThreadSafetyMode + callableIdIfNonLocal: kotlin/LazyThreadSafetyMode.SYNCHRONIZED + containingEnumClassIdIfNonLocal: kotlin/LazyThreadSafetyMode + isExtension: false + name: SYNCHRONIZED + origin: LIBRARY + receiverType: null + symbolKind: MEMBER diff --git a/idea/idea-frontend-fir/testData/symbols/symbolByFqName/fileWalkDirectionEnum.txt b/idea/idea-frontend-fir/testData/symbols/symbolByFqName/fileWalkDirectionEnum.txt new file mode 100644 index 00000000000..fdbf2ea6237 --- /dev/null +++ b/idea/idea-frontend-fir/testData/symbols/symbolByFqName/fileWalkDirectionEnum.txt @@ -0,0 +1,62 @@ +KtFirFunctionSymbol: + annotatedType: [] kotlin/collections/List + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/collections/listOf + dispatchType: null + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: FINAL + name: listOf + origin: LIBRARY + receiverType: null + symbolKind: TOP_LEVEL + typeParameters: [KtFirTypeParameterSymbol(T)] + valueParameters: [KtFirValueParameterSymbol(element)] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/collections/List + annotationClassIds: [kotlin/internal/InlineOnly] + annotations: [kotlin/internal/InlineOnly()] + callableIdIfNonLocal: kotlin/collections/listOf + dispatchType: null + isExtension: false + isExternal: false + isInline: true + isOperator: false + isOverride: false + isSuspend: false + modality: FINAL + name: listOf + origin: LIBRARY + receiverType: null + symbolKind: TOP_LEVEL + typeParameters: [KtFirTypeParameterSymbol(T)] + valueParameters: [] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/collections/List + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/collections/listOf + dispatchType: null + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: FINAL + name: listOf + origin: LIBRARY + receiverType: null + symbolKind: TOP_LEVEL + typeParameters: [KtFirTypeParameterSymbol(T)] + valueParameters: [KtFirValueParameterSymbol(elements)] + visibility: Public diff --git a/idea/idea-frontend-fir/testData/symbols/symbolByFqName/iterator.txt b/idea/idea-frontend-fir/testData/symbols/symbolByFqName/iterator.txt new file mode 100644 index 00000000000..ce16cf18730 --- /dev/null +++ b/idea/idea-frontend-fir/testData/symbols/symbolByFqName/iterator.txt @@ -0,0 +1,18 @@ +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [] + annotations: [] + classIdIfNonLocal: kotlin/collections/Iterator + classKind: INTERFACE + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: ABSTRACT + name: Iterator + origin: LIBRARY + superTypes: [[] kotlin/Any] + symbolKind: TOP_LEVEL + typeParameters: [KtFirTypeParameterSymbol(T)] + visibility: Public diff --git a/idea/idea-frontend-fir/testData/symbols/symbolByFqName/listOf.txt b/idea/idea-frontend-fir/testData/symbols/symbolByFqName/listOf.txt new file mode 100644 index 00000000000..2767ea56adb --- /dev/null +++ b/idea/idea-frontend-fir/testData/symbols/symbolByFqName/listOf.txt @@ -0,0 +1,18 @@ +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [] + annotations: [] + classIdIfNonLocal: kotlin/io/FileWalkDirection + classKind: ENUM_CLASS + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: FileWalkDirection + origin: LIBRARY + superTypes: [[] kotlin/Enum] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public diff --git a/idea/idea-frontend-fir/testData/symbols/symbolByFqName/memberFunction.txt b/idea/idea-frontend-fir/testData/symbols/symbolByFqName/memberFunction.txt new file mode 100644 index 00000000000..e07a4e5f78c --- /dev/null +++ b/idea/idea-frontend-fir/testData/symbols/symbolByFqName/memberFunction.txt @@ -0,0 +1,20 @@ +KtFirFunctionSymbol: + annotatedType: [] E + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/collections/List.get + dispatchType: kotlin/collections/List + isExtension: false + isExternal: false + isInline: false + isOperator: true + isOverride: false + isSuspend: false + modality: ABSTRACT + name: get + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(index)] + visibility: Public diff --git a/idea/idea-frontend-fir/testData/symbols/symbolByFqName/memberFunctionWithOverloads.txt b/idea/idea-frontend-fir/testData/symbols/symbolByFqName/memberFunctionWithOverloads.txt new file mode 100644 index 00000000000..ee62cc9cec2 --- /dev/null +++ b/idea/idea-frontend-fir/testData/symbols/symbolByFqName/memberFunctionWithOverloads.txt @@ -0,0 +1,41 @@ +KtFirFunctionSymbol: + annotatedType: [] kotlin/collections/ListIterator + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/collections/List.listIterator + dispatchType: kotlin/collections/List + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: ABSTRACT + name: listIterator + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/collections/ListIterator + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: kotlin/collections/List.listIterator + dispatchType: kotlin/collections/List + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: ABSTRACT + name: listIterator + origin: LIBRARY + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(index)] + visibility: Public diff --git a/idea/idea-frontend-fir/testData/symbols/symbolByFqName/nestedClass.txt b/idea/idea-frontend-fir/testData/symbols/symbolByFqName/nestedClass.txt new file mode 100644 index 00000000000..0a9d4ccaf9b --- /dev/null +++ b/idea/idea-frontend-fir/testData/symbols/symbolByFqName/nestedClass.txt @@ -0,0 +1,18 @@ +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [] + annotations: [] + classIdIfNonLocal: kotlin/collections/MutableMap.MutableEntry + classKind: INTERFACE + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: ABSTRACT + name: MutableEntry + origin: LIBRARY + superTypes: [[] kotlin/collections/Map.Entry] + symbolKind: MEMBER + typeParameters: [KtFirTypeParameterSymbol(K), KtFirTypeParameterSymbol(V)] + visibility: Public diff --git a/idea/idea-frontend-fir/testData/symbols/symbolByPsi/annotations.txt b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/annotations.txt new file mode 100644 index 00000000000..8ce846d7d82 --- /dev/null +++ b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/annotations.txt @@ -0,0 +1,100 @@ +KtFirValueParameterSymbol: + annotatedType: [] kotlin/String + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: null + hasDefaultValue: false + isExtension: false + isVararg: false + name: param1 + origin: SOURCE + receiverType: null + symbolKind: LOCAL + +KtFirValueParameterSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: null + hasDefaultValue: false + isExtension: false + isVararg: false + name: param2 + origin: SOURCE + receiverType: null + symbolKind: LOCAL + +KtFirConstructorSymbol: + annotatedType: [] Anno + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: null + containingClassIdIfNonLocal: Anno + dispatchType: null + isExtension: false + isPrimary: true + origin: SOURCE + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(param1), KtFirValueParameterSymbol(param2)] + visibility: Public + +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [] + annotations: [] + classIdIfNonLocal: Anno + classKind: ANNOTATION_CLASS + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: Anno + origin: SOURCE + superTypes: [[] kotlin/Annotation] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Unit + annotationClassIds: [Anno] + annotations: [Anno(param1 = funparam, param2 = 3)] + callableIdIfNonLocal: /X.x + dispatchType: X + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: FINAL + name: x + origin: SOURCE + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [Anno] + annotations: [Anno(param1 = param, param2 = 2)] + classIdIfNonLocal: X + classKind: CLASS + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: X + origin: SOURCE + superTypes: [[] kotlin/Any] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public diff --git a/idea/idea-frontend-fir/testData/symbols/symbolByPsi/anonymousObject.txt b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/anonymousObject.txt new file mode 100644 index 00000000000..08e1f1899a9 --- /dev/null +++ b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/anonymousObject.txt @@ -0,0 +1,97 @@ +KtFirFunctionSymbol: + annotatedType: [] kotlin/Unit + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: null + dispatchType: + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: true + isSuspend: false + modality: FINAL + name: run + origin: SOURCE + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirKotlinPropertySymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: null + dispatchType: + getter: KtFirPropertyGetterSymbol() + hasBackingField: true + hasGetter: true + hasSetter: false + initializer: 123 + isConst: false + isExtension: false + isLateInit: false + isOverride: false + isVal: true + modality: FINAL + name: data + origin: SOURCE + receiverType: null + setter: null + symbolKind: MEMBER + visibility: Public + +KtFirAnonymousObjectSymbol: + annotationClassIds: [] + annotations: [] + classIdIfNonLocal: null + classKind: ANONYMOUS_OBJECT + name: null + origin: SOURCE + superTypes: [[] java/lang/Runnable] + symbolKind: LOCAL + +KtFirKotlinPropertySymbol: + annotatedType: [] java/lang/Runnable + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: /AnonymousContainer.anonymousObject + dispatchType: AnonymousContainer + getter: KtFirPropertyGetterSymbol() + hasBackingField: true + hasGetter: true + hasSetter: false + initializer: KtUnsupportedConstantValue + isConst: false + isExtension: false + isLateInit: false + isOverride: false + isVal: true + modality: FINAL + name: anonymousObject + origin: SOURCE + receiverType: null + setter: null + symbolKind: MEMBER + visibility: Public + +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [] + annotations: [] + classIdIfNonLocal: AnonymousContainer + classKind: CLASS + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: AnonymousContainer + origin: SOURCE + superTypes: [[] kotlin/Any] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public diff --git a/idea/idea-frontend-fir/testData/symbols/symbolByPsi/class.txt b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/class.txt new file mode 100644 index 00000000000..f122dfc2ada --- /dev/null +++ b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/class.txt @@ -0,0 +1,18 @@ +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [] + annotations: [] + classIdIfNonLocal: A + classKind: CLASS + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: A + origin: SOURCE + superTypes: [[] kotlin/Any] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public diff --git a/idea/idea-frontend-fir/testData/symbols/symbolByPsi/classMembes.txt b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/classMembes.txt new file mode 100644 index 00000000000..f9f8b3edb92 --- /dev/null +++ b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/classMembes.txt @@ -0,0 +1,63 @@ +KtFirKotlinPropertySymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: /A.a + dispatchType: A + getter: KtFirPropertyGetterSymbol() + hasBackingField: true + hasGetter: true + hasSetter: false + initializer: 10 + isConst: false + isExtension: false + isLateInit: false + isOverride: false + isVal: true + modality: FINAL + name: a + origin: SOURCE + receiverType: null + setter: null + symbolKind: MEMBER + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: /A.x + dispatchType: A + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: FINAL + name: x + origin: SOURCE + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [] + annotations: [] + classIdIfNonLocal: A + classKind: CLASS + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: A + origin: SOURCE + superTypes: [[] kotlin/Any] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public diff --git a/idea/idea-frontend-fir/testData/symbols/symbolByPsi/classPrimaryConstructor.txt b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/classPrimaryConstructor.txt new file mode 100644 index 00000000000..e4bc6668807 --- /dev/null +++ b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/classPrimaryConstructor.txt @@ -0,0 +1,34 @@ +KtFirConstructorSymbol: + annotatedType: [] A + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: null + containingClassIdIfNonLocal: A + dispatchType: null + isExtension: false + isPrimary: true + origin: SOURCE + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [] + annotations: [] + classIdIfNonLocal: A + classKind: CLASS + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: A + origin: SOURCE + superTypes: [[] kotlin/Any] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public diff --git a/idea/idea-frontend-fir/testData/symbols/symbolByPsi/classSecondaryConstructors.txt b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/classSecondaryConstructors.txt new file mode 100644 index 00000000000..34ab5ad3284 --- /dev/null +++ b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/classSecondaryConstructors.txt @@ -0,0 +1,105 @@ +KtFirConstructorSymbol: + annotatedType: [] A + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: null + containingClassIdIfNonLocal: A + dispatchType: null + isExtension: false + isPrimary: true + origin: SOURCE + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirValueParameterSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: null + hasDefaultValue: false + isExtension: false + isVararg: false + name: x + origin: SOURCE + receiverType: null + symbolKind: LOCAL + +KtFirConstructorSymbol: + annotatedType: [] A + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: null + containingClassIdIfNonLocal: A + dispatchType: null + isExtension: false + isPrimary: false + origin: SOURCE + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(x)] + visibility: Public + +KtFirValueParameterSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: null + hasDefaultValue: false + isExtension: false + isVararg: false + name: y + origin: SOURCE + receiverType: null + symbolKind: LOCAL + +KtFirValueParameterSymbol: + annotatedType: [] kotlin/String + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: null + hasDefaultValue: false + isExtension: false + isVararg: false + name: z + origin: SOURCE + receiverType: null + symbolKind: LOCAL + +KtFirConstructorSymbol: + annotatedType: [] A + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: null + containingClassIdIfNonLocal: A + dispatchType: null + isExtension: false + isPrimary: false + origin: SOURCE + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(y), KtFirValueParameterSymbol(z)] + visibility: Public + +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [] + annotations: [] + classIdIfNonLocal: A + classKind: CLASS + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: A + origin: SOURCE + superTypes: [[] kotlin/Any] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public diff --git a/idea/idea-frontend-fir/testData/symbols/symbolByPsi/classWithTypeParams.txt b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/classWithTypeParams.txt new file mode 100644 index 00000000000..c7f634b7ca3 --- /dev/null +++ b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/classWithTypeParams.txt @@ -0,0 +1,32 @@ +KtFirTypeParameterSymbol: + isReified: false + name: T + origin: SOURCE + upperBounds: [kotlin/Any?] + variance: INVARIANT + +KtFirTypeParameterSymbol: + isReified: false + name: R + origin: SOURCE + upperBounds: [kotlin/Any?] + variance: INVARIANT + +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [] + annotations: [] + classIdIfNonLocal: A + classKind: CLASS + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: A + origin: SOURCE + superTypes: [[] kotlin/Any] + symbolKind: TOP_LEVEL + typeParameters: [KtFirTypeParameterSymbol(T), KtFirTypeParameterSymbol(R)] + visibility: Public diff --git a/idea/idea-frontend-fir/testData/symbols/symbolByPsi/enum.txt b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/enum.txt new file mode 100644 index 00000000000..efc46eac38b --- /dev/null +++ b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/enum.txt @@ -0,0 +1,38 @@ +KtFirEnumEntrySymbol: + annotatedType: [] X + callableIdIfNonLocal: /X.Y + containingEnumClassIdIfNonLocal: X + isExtension: false + name: Y + origin: SOURCE + receiverType: null + symbolKind: MEMBER + +KtFirEnumEntrySymbol: + annotatedType: [] X + callableIdIfNonLocal: /X.Z + containingEnumClassIdIfNonLocal: X + isExtension: false + name: Z + origin: SOURCE + receiverType: null + symbolKind: MEMBER + +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [] + annotations: [] + classIdIfNonLocal: X + classKind: ENUM_CLASS + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: X + origin: SOURCE + superTypes: [[] kotlin/Enum] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public diff --git a/idea/idea-frontend-fir/testData/symbols/symbolByPsi/extensionFunction.txt b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/extensionFunction.txt new file mode 100644 index 00000000000..9c25782b8d1 --- /dev/null +++ b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/extensionFunction.txt @@ -0,0 +1,20 @@ +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: /foo + dispatchType: null + isExtension: true + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: FINAL + name: foo + origin: SOURCE + receiverType: [] kotlin/String + symbolKind: TOP_LEVEL + typeParameters: [] + valueParameters: [] + visibility: Public diff --git a/idea/idea-frontend-fir/testData/symbols/symbolByPsi/function.txt b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/function.txt new file mode 100644 index 00000000000..1717fcc475b --- /dev/null +++ b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/function.txt @@ -0,0 +1,33 @@ +KtFirValueParameterSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: null + hasDefaultValue: false + isExtension: false + isVararg: false + name: x + origin: SOURCE + receiverType: null + symbolKind: LOCAL + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Unit + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: /foo + dispatchType: null + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: FINAL + name: foo + origin: SOURCE + receiverType: null + symbolKind: TOP_LEVEL + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(x)] + visibility: Public diff --git a/idea/idea-frontend-fir/testData/symbols/symbolByPsi/functionWithTypeParams.txt b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/functionWithTypeParams.txt new file mode 100644 index 00000000000..9a81681f97f --- /dev/null +++ b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/functionWithTypeParams.txt @@ -0,0 +1,40 @@ +KtFirTypeParameterSymbol: + isReified: false + name: X + origin: SOURCE + upperBounds: [kotlin/Any?] + variance: INVARIANT + +KtFirValueParameterSymbol: + annotatedType: [] X + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: null + hasDefaultValue: false + isExtension: false + isVararg: false + name: x + origin: SOURCE + receiverType: null + symbolKind: LOCAL + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Unit + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: /foo + dispatchType: null + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: FINAL + name: foo + origin: SOURCE + receiverType: null + symbolKind: TOP_LEVEL + typeParameters: [KtFirTypeParameterSymbol(X)] + valueParameters: [KtFirValueParameterSymbol(x)] + visibility: Public diff --git a/idea/idea-frontend-fir/testData/symbols/symbolByPsi/implicitReturn.txt b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/implicitReturn.txt new file mode 100644 index 00000000000..f302cf13794 --- /dev/null +++ b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/implicitReturn.txt @@ -0,0 +1,20 @@ +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: /foo + dispatchType: null + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: FINAL + name: foo + origin: SOURCE + receiverType: null + symbolKind: TOP_LEVEL + typeParameters: [] + valueParameters: [] + visibility: Public diff --git a/idea/idea-frontend-fir/testData/symbols/symbolByPsi/localDeclarations.txt b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/localDeclarations.txt new file mode 100644 index 00000000000..0b7ce29bfcb --- /dev/null +++ b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/localDeclarations.txt @@ -0,0 +1,70 @@ +KtFirLocalVariableSymbol: + annotatedType: [] kotlin/Int + callableIdIfNonLocal: null + isExtension: false + isVal: true + name: q + origin: SOURCE + receiverType: null + symbolKind: LOCAL + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Unit + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: null + dispatchType: null + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: FINAL + name: aaa + origin: SOURCE + receiverType: null + symbolKind: LOCAL + typeParameters: [] + valueParameters: [] + visibility: Local + +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [] + annotations: [] + classIdIfNonLocal: null + classKind: CLASS + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: F + origin: SOURCE + superTypes: [[] kotlin/Any] + symbolKind: LOCAL + typeParameters: [] + visibility: Local + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Unit + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: /yyy + dispatchType: null + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: FINAL + name: yyy + origin: SOURCE + receiverType: null + symbolKind: TOP_LEVEL + typeParameters: [] + valueParameters: [] + visibility: Public diff --git a/idea/idea-frontend-fir/testData/symbols/symbolByPsi/memberFunctions.txt b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/memberFunctions.txt new file mode 100644 index 00000000000..1c2f4982362 --- /dev/null +++ b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/memberFunctions.txt @@ -0,0 +1,60 @@ +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: /A.x + dispatchType: A + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: FINAL + name: x + origin: SOURCE + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Unit + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: /A.y + dispatchType: A + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: FINAL + name: y + origin: SOURCE + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [] + annotations: [] + classIdIfNonLocal: A + classKind: CLASS + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: A + origin: SOURCE + superTypes: [[] kotlin/Any] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public diff --git a/idea/idea-frontend-fir/testData/symbols/symbolByPsi/memberProperties.txt b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/memberProperties.txt new file mode 100644 index 00000000000..31ed3156bf1 --- /dev/null +++ b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/memberProperties.txt @@ -0,0 +1,83 @@ +KtFirKotlinPropertySymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: /A.x + dispatchType: A + getter: KtFirPropertyGetterSymbol() + hasBackingField: true + hasGetter: true + hasSetter: false + initializer: 10 + isConst: false + isExtension: false + isLateInit: false + isOverride: false + isVal: true + modality: FINAL + name: x + origin: SOURCE + receiverType: null + setter: null + symbolKind: MEMBER + visibility: Public + +KtFirPropertyGetterSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: null + dispatchType: null + hasBody: true + isDefault: false + isExtension: false + isInline: false + isOverride: false + modality: FINAL + origin: SOURCE + receiverType: null + symbolKind: ACCESSOR + visibility: Public + +KtFirKotlinPropertySymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: /A.y + dispatchType: A + getter: KtFirPropertyGetterSymbol() + hasBackingField: false + hasGetter: true + hasSetter: false + initializer: null + isConst: false + isExtension: true + isLateInit: false + isOverride: false + isVal: true + modality: FINAL + name: y + origin: SOURCE + receiverType: [] kotlin/Int + setter: null + symbolKind: MEMBER + visibility: Public + +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [] + annotations: [] + classIdIfNonLocal: A + classKind: CLASS + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: A + origin: SOURCE + superTypes: [[] kotlin/Any] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public diff --git a/idea/idea-frontend-fir/testData/symbols/symbolByPsi/outerAndInnerClasses.txt b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/outerAndInnerClasses.txt new file mode 100644 index 00000000000..ab771f0b598 --- /dev/null +++ b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/outerAndInnerClasses.txt @@ -0,0 +1,183 @@ +KtFirTypeParameterSymbol: + isReified: false + name: T + origin: SOURCE + upperBounds: [kotlin/Any?] + variance: INVARIANT + +KtFirTypeParameterSymbol: + isReified: false + name: T1 + origin: SOURCE + upperBounds: [kotlin/Any?] + variance: INVARIANT + +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [] + annotations: [] + classIdIfNonLocal: X.Y + classKind: CLASS + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: true + modality: FINAL + name: Y + origin: SOURCE + superTypes: [[] kotlin/Any] + symbolKind: MEMBER + typeParameters: [KtFirTypeParameterSymbol(T1)] + visibility: Public + +KtFirTypeParameterSymbol: + isReified: false + name: T2 + origin: SOURCE + upperBounds: [kotlin/Any?] + variance: INVARIANT + +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [] + annotations: [] + classIdIfNonLocal: X.Z + classKind: CLASS + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: Z + origin: SOURCE + superTypes: [[] kotlin/Any] + symbolKind: MEMBER + typeParameters: [KtFirTypeParameterSymbol(T2)] + visibility: Public + +KtFirTypeParameterSymbol: + isReified: false + name: T3 + origin: SOURCE + upperBounds: [kotlin/Any?] + variance: INVARIANT + +KtFirTypeParameterSymbol: + isReified: false + name: T4 + origin: SOURCE + upperBounds: [kotlin/Any?] + variance: INVARIANT + +KtFirTypeParameterSymbol: + isReified: false + name: T5 + origin: SOURCE + upperBounds: [kotlin/Any?] + variance: INVARIANT + +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [] + annotations: [] + classIdIfNonLocal: null + classKind: CLASS + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: true + modality: FINAL + name: K + origin: SOURCE + superTypes: [[] kotlin/Any] + symbolKind: LOCAL + typeParameters: [KtFirTypeParameterSymbol(T5)] + visibility: Local + +KtFirTypeParameterSymbol: + isReified: false + name: T6 + origin: SOURCE + upperBounds: [kotlin/Any?] + variance: INVARIANT + +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [] + annotations: [] + classIdIfNonLocal: null + classKind: CLASS + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: C + origin: SOURCE + superTypes: [[] kotlin/Any] + symbolKind: LOCAL + typeParameters: [KtFirTypeParameterSymbol(T6)] + visibility: Local + +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [] + annotations: [] + classIdIfNonLocal: null + classKind: CLASS + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: U + origin: SOURCE + superTypes: [[] kotlin/Any] + symbolKind: LOCAL + typeParameters: [KtFirTypeParameterSymbol(T4)] + visibility: Local + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Unit + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: /X.foo + dispatchType: X + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: FINAL + name: foo + origin: SOURCE + receiverType: null + symbolKind: MEMBER + typeParameters: [KtFirTypeParameterSymbol(T3)] + valueParameters: [] + visibility: Public + +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [] + annotations: [] + classIdIfNonLocal: X + classKind: CLASS + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: X + origin: SOURCE + superTypes: [[] kotlin/Any] + symbolKind: TOP_LEVEL + typeParameters: [KtFirTypeParameterSymbol(T)] + visibility: Public diff --git a/idea/idea-frontend-fir/testData/symbols/symbolByPsi/topLevelFunctions.txt b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/topLevelFunctions.txt new file mode 100644 index 00000000000..7a4cecbb6ed --- /dev/null +++ b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/topLevelFunctions.txt @@ -0,0 +1,41 @@ +KtFirFunctionSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: /x + dispatchType: null + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: FINAL + name: x + origin: SOURCE + receiverType: null + symbolKind: TOP_LEVEL + typeParameters: [] + valueParameters: [] + visibility: Public + +KtFirFunctionSymbol: + annotatedType: [] kotlin/Unit + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: /y + dispatchType: null + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: FINAL + name: y + origin: SOURCE + receiverType: null + symbolKind: TOP_LEVEL + typeParameters: [] + valueParameters: [] + visibility: Public diff --git a/idea/idea-frontend-fir/testData/symbols/symbolByPsi/topLevelProperties.txt b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/topLevelProperties.txt new file mode 100644 index 00000000000..b2cdfe246e7 --- /dev/null +++ b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/topLevelProperties.txt @@ -0,0 +1,64 @@ +KtFirKotlinPropertySymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: /x + dispatchType: null + getter: KtFirPropertyGetterSymbol() + hasBackingField: true + hasGetter: true + hasSetter: false + initializer: 10 + isConst: false + isExtension: false + isLateInit: false + isOverride: false + isVal: true + modality: FINAL + name: x + origin: SOURCE + receiverType: null + setter: null + symbolKind: TOP_LEVEL + visibility: Public + +KtFirPropertyGetterSymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: null + dispatchType: null + hasBody: true + isDefault: false + isExtension: false + isInline: false + isOverride: false + modality: FINAL + origin: SOURCE + receiverType: null + symbolKind: ACCESSOR + visibility: Public + +KtFirKotlinPropertySymbol: + annotatedType: [] kotlin/Int + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: /y + dispatchType: null + getter: KtFirPropertyGetterSymbol() + hasBackingField: false + hasGetter: true + hasSetter: false + initializer: null + isConst: false + isExtension: true + isLateInit: false + isOverride: false + isVal: true + modality: FINAL + name: y + origin: SOURCE + receiverType: [] kotlin/Int + setter: null + symbolKind: TOP_LEVEL + visibility: Public diff --git a/idea/idea-frontend-fir/testData/symbols/symbolByPsi/typeAlias.txt b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/typeAlias.txt new file mode 100644 index 00000000000..8adb12ca2cf --- /dev/null +++ b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/typeAlias.txt @@ -0,0 +1,39 @@ +KtFirTypeParameterSymbol: + isReified: false + name: T + origin: SOURCE + upperBounds: [kotlin/Any?] + variance: INVARIANT + +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [] + annotations: [] + classIdIfNonLocal: X + classKind: CLASS + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: X + origin: SOURCE + superTypes: [[] kotlin/Any] + symbolKind: TOP_LEVEL + typeParameters: [KtFirTypeParameterSymbol(T)] + visibility: Public + +KtFirTypeParameterSymbol: + isReified: false + name: Z + origin: SOURCE + upperBounds: [kotlin/Any?] + variance: INVARIANT + +KtFirTypeAliasSymbol: + classIdIfNonLocal: Y + expandedType: X + name: Y + origin: SOURCE + symbolKind: TOP_LEVEL diff --git a/idea/idea-frontend-fir/testData/symbols/symbolByPsi/typeAnnotations.txt b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/typeAnnotations.txt new file mode 100644 index 00000000000..3e400c94d6d --- /dev/null +++ b/idea/idea-frontend-fir/testData/symbols/symbolByPsi/typeAnnotations.txt @@ -0,0 +1,171 @@ +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [kotlin/annotation/Target] + annotations: [kotlin/annotation/Target(allowedTargets = KtUnsupportedConstantValue)] + classIdIfNonLocal: Anno1 + classKind: ANNOTATION_CLASS + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: Anno1 + origin: SOURCE + superTypes: [[] kotlin/Annotation] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [kotlin/annotation/Target] + annotations: [kotlin/annotation/Target(allowedTargets = KtUnsupportedConstantValue)] + classIdIfNonLocal: Anno2 + classKind: ANNOTATION_CLASS + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: Anno2 + origin: SOURCE + superTypes: [[] kotlin/Annotation] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [kotlin/annotation/Target] + annotations: [kotlin/annotation/Target(allowedTargets = KtUnsupportedConstantValue)] + classIdIfNonLocal: Anno3 + classKind: ANNOTATION_CLASS + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: Anno3 + origin: SOURCE + superTypes: [[] kotlin/Annotation] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [kotlin/annotation/Target] + annotations: [kotlin/annotation/Target(allowedTargets = KtUnsupportedConstantValue)] + classIdIfNonLocal: Anno4 + classKind: ANNOTATION_CLASS + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: Anno4 + origin: SOURCE + superTypes: [[] kotlin/Annotation] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [] + annotations: [] + classIdIfNonLocal: I + classKind: INTERFACE + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: ABSTRACT + name: I + origin: SOURCE + superTypes: [[] kotlin/Any] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public + +KtFirValueParameterSymbol: + annotatedType: [Anno2()] @R|Anno2|() I + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: null + hasDefaultValue: false + isExtension: false + isVararg: false + name: arg + origin: SOURCE + receiverType: null + symbolKind: LOCAL + +KtFirFunctionSymbol: + annotatedType: [Anno3()] @R|Anno3|() I + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: /X.f + dispatchType: X + isExtension: false + isExternal: false + isInline: false + isOperator: false + isOverride: false + isSuspend: false + modality: FINAL + name: f + origin: SOURCE + receiverType: null + symbolKind: MEMBER + typeParameters: [] + valueParameters: [KtFirValueParameterSymbol(arg)] + visibility: Public + +KtFirKotlinPropertySymbol: + annotatedType: [Anno4()] @R|Anno4|() I + annotationClassIds: [] + annotations: [] + callableIdIfNonLocal: /X.x + dispatchType: X + getter: KtFirPropertyGetterSymbol() + hasBackingField: true + hasGetter: true + hasSetter: false + initializer: KtUnsupportedConstantValue + isConst: false + isExtension: false + isLateInit: false + isOverride: false + isVal: true + modality: FINAL + name: x + origin: SOURCE + receiverType: null + setter: null + symbolKind: MEMBER + visibility: Public + +KtFirNamedClassOrObjectSymbol: + annotationClassIds: [] + annotations: [] + classIdIfNonLocal: X + classKind: CLASS + companionObject: null + isData: false + isExternal: false + isFun: false + isInline: false + isInner: false + modality: FINAL + name: X + origin: SOURCE + superTypes: [[Anno1()] @R|Anno1|() I] + symbolKind: TOP_LEVEL + typeParameters: [] + visibility: Public diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/AbstractKtDeclarationAndFirDeclarationEqualityChecker.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/AbstractKtDeclarationAndFirDeclarationEqualityChecker.kt deleted file mode 100644 index dd615133877..00000000000 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/AbstractKtDeclarationAndFirDeclarationEqualityChecker.kt +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2010-2020 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.idea.fir - -import com.intellij.openapi.util.io.FileUtil -import com.intellij.rt.execution.junit.FileComparisonFailure -import org.jetbrains.kotlin.fir.declarations.FirFunction -import org.jetbrains.kotlin.idea.fir.low.level.api.api.KtDeclarationAndFirDeclarationEqualityChecker -import org.jetbrains.kotlin.idea.fir.low.level.api.api.getOrBuildFirOfType -import org.jetbrains.kotlin.idea.fir.low.level.api.api.getResolveState -import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase -import org.jetbrains.kotlin.psi.KtFile -import org.jetbrains.kotlin.psi.KtFunction -import org.jetbrains.kotlin.psi.psiUtil.forEachDescendantOfType -import java.io.File - -abstract class AbstractKtDeclarationAndFirDeclarationEqualityChecker : KotlinLightCodeInsightFixtureTestCase() { - protected fun doTest(path: String) { - val file = File(path) - val ktFile = myFixture.configureByText(file.name, FileUtil.loadFile(file)) as KtFile - val resolveState = ktFile.getResolveState() - ktFile.forEachDescendantOfType { ktFunction -> - val firFunction = ktFunction.getOrBuildFirOfType>(resolveState) - if (!KtDeclarationAndFirDeclarationEqualityChecker.representsTheSameDeclaration(ktFunction, firFunction)) { - throw FileComparisonFailure( - /* message= */ null, - KtDeclarationAndFirDeclarationEqualityChecker.renderPsi(ktFunction), - KtDeclarationAndFirDeclarationEqualityChecker.renderFir(firFunction), - /* expectedFilePath= */ null - ) - } - } - } -} diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/KtDeclarationAndFirDeclarationEqualityCheckerGenerated.java b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/KtDeclarationAndFirDeclarationEqualityCheckerGenerated.java deleted file mode 100644 index 342420eb289..00000000000 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/KtDeclarationAndFirDeclarationEqualityCheckerGenerated.java +++ /dev/null @@ -1,46 +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.idea.fir; - -import com.intellij.testFramework.TestDataPath; -import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; -import org.jetbrains.kotlin.test.KotlinTestUtils; -import org.jetbrains.kotlin.test.util.KtTestUtil; -import org.jetbrains.kotlin.test.TestMetadata; -import org.junit.runner.RunWith; - -import java.io.File; -import java.util.regex.Pattern; - -/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ -@SuppressWarnings("all") -@TestMetadata("idea/idea-frontend-fir/testData/ktDeclarationAndFirDeclarationEqualityChecker") -@TestDataPath("$PROJECT_ROOT") -@RunWith(JUnit3RunnerWithInners.class) -public class KtDeclarationAndFirDeclarationEqualityCheckerGenerated extends AbstractKtDeclarationAndFirDeclarationEqualityChecker { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - - public void testAllFilesPresentInKtDeclarationAndFirDeclarationEqualityChecker() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-frontend-fir/testData/ktDeclarationAndFirDeclarationEqualityChecker"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - - @TestMetadata("extensionMethods.kt") - public void testExtensionMethods() throws Exception { - runTest("idea/idea-frontend-fir/testData/ktDeclarationAndFirDeclarationEqualityChecker/extensionMethods.kt"); - } - - @TestMetadata("functionalTypes.kt") - public void testFunctionalTypes() throws Exception { - runTest("idea/idea-frontend-fir/testData/ktDeclarationAndFirDeclarationEqualityChecker/functionalTypes.kt"); - } - - @TestMetadata("inClass.kt") - public void testInClass() throws Exception { - runTest("idea/idea-frontend-fir/testData/ktDeclarationAndFirDeclarationEqualityChecker/inClass.kt"); - } -} diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/KtAnalysisSessionContractsTest.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/KtAnalysisSessionContractsTest.kt deleted file mode 100644 index d0d61087ca6..00000000000 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/KtAnalysisSessionContractsTest.kt +++ /dev/null @@ -1,69 +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.idea.fir.frontend.api - -import com.intellij.openapi.application.ApplicationManager -import com.intellij.testFramework.LightProjectDescriptor -import junit.framework.Assert -import org.jetbrains.kotlin.idea.frontend.api.WriteActionStartInsideAnalysisContextException -import org.jetbrains.kotlin.idea.frontend.api.analyse -import org.jetbrains.kotlin.idea.frontend.api.analyseWithCustomToken -import org.jetbrains.kotlin.idea.frontend.api.tokens.AlwaysAccessibleValidityTokenFactory -import org.jetbrains.kotlin.idea.frontend.api.tokens.HackToForceAllowRunningAnalyzeOnEDT -import org.jetbrains.kotlin.idea.frontend.api.tokens.hackyAllowRunningOnEdt -import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase -import org.jetbrains.kotlin.idea.test.KotlinLightProjectDescriptor -import org.jetbrains.kotlin.idea.util.application.runWriteAction -import org.jetbrains.kotlin.psi.KtFile - -class KtAnalysisSessionContractsTest : KotlinLightCodeInsightFixtureTestCase() { - override val captureExceptions: Boolean get() = false - - fun testThatWriteActionCannotBeCalledInsideAnalyseCall() { - val fakeFile = createFakeKtFile() - - var wasThrown = false - ApplicationManager.getApplication().invokeAndWait { - @OptIn(HackToForceAllowRunningAnalyzeOnEDT::class) - hackyAllowRunningOnEdt { - analyse(fakeFile) { - try { - runWriteAction { } - } catch (_: WriteActionStartInsideAnalysisContextException) { - wasThrown = true - } - } - } - } - Assert.assertTrue("WriteActionStartInsideAnalysisContextException was not thrown", wasThrown) - } - - fun testThatWriteActionCannotBeCalledInsideAnalyseCallWithCustomToken() { - val fakeFile = createFakeKtFile() - - var wasThrown = false - ApplicationManager.getApplication().invokeAndWait { - @OptIn(HackToForceAllowRunningAnalyzeOnEDT::class) - hackyAllowRunningOnEdt { - analyseWithCustomToken(fakeFile, AlwaysAccessibleValidityTokenFactory) { - try { - runWriteAction { } - } catch (_: WriteActionStartInsideAnalysisContextException) { - wasThrown = true - } - } - } - } - Assert.assertTrue("WriteActionStartInsideAnalysisContextException was not thrown", wasThrown) - } - - - private fun createFakeKtFile(): KtFile = - myFixture.configureByText("file.kt", "fun a() {}") as KtFile - - override fun getProjectDescriptor(): LightProjectDescriptor = - KotlinLightProjectDescriptor.INSTANCE -} \ No newline at end of file diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/AbstractExpectedExpressionTypeTest.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/AbstractExpectedExpressionTypeTest.kt index 8dc6dabf9b7..7edb38e3a3e 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/AbstractExpectedExpressionTypeTest.kt +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/AbstractExpectedExpressionTypeTest.kt @@ -5,26 +5,19 @@ package org.jetbrains.kotlin.idea.fir.frontend.api.components -import com.intellij.openapi.util.io.FileUtil -import com.intellij.psi.util.parentOfType import org.jetbrains.kotlin.idea.fir.executeOnPooledThreadInReadAction +import org.jetbrains.kotlin.idea.fir.test.framework.AbstractKtIdeaTestWithSingleTestFileTest +import org.jetbrains.kotlin.idea.fir.test.framework.expressionMarkerProvider import org.jetbrains.kotlin.idea.frontend.api.analyse -import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase import org.jetbrains.kotlin.psi.KtExpression import org.jetbrains.kotlin.psi.KtFile -import org.jetbrains.kotlin.test.KotlinTestUtils -import org.jetbrains.kotlin.test.utils.IgnoreTests -import java.io.File +import org.jetbrains.kotlin.test.services.TestModuleStructure +import org.jetbrains.kotlin.test.services.TestServices +import org.jetbrains.kotlin.test.services.assertions -abstract class AbstractExpectedExpressionTypeTest : KotlinLightCodeInsightFixtureTestCase() { - override fun isFirPlugin() = true - - protected fun doTest(path: String) { - val testDataFile = File(path) - val ktFile = myFixture.configureByText(testDataFile.name, FileUtil.loadFile(testDataFile)) as KtFile - - val expressionAtCaret = ktFile.findElementAt(myFixture.caretOffset)?.parentOfType() - ?: error("No element was found at caret or no is present in the test file") +abstract class AbstractExpectedExpressionTypeTest : AbstractKtIdeaTestWithSingleTestFileTest() { + override fun doTestByFileStructure(ktFile: KtFile, moduleStructure: TestModuleStructure, testServices: TestServices) { + val expressionAtCaret = testServices.expressionMarkerProvider.getElementOfTypAtCaret(ktFile) as KtExpression val actualExpectedTypeText: String? = executeOnPooledThreadInReadAction { analyse(ktFile) { @@ -32,20 +25,11 @@ abstract class AbstractExpectedExpressionTypeTest : KotlinLightCodeInsightFixtur } } - IgnoreTests.runTestWithFixMeSupport(testDataFile.toPath()) { - KotlinTestUtils.assertEqualsToFile(File(path), testDataFile.getTextWithActualType(actualExpectedTypeText)) + val actual = buildString { + appendLine("expression: ${expressionAtCaret.text}") + appendLine("expected type: $actualExpectedTypeText") } - } - private fun File.getTextWithActualType(actualType: String?) : String { - val text = FileUtil.loadFile(this) - val textWithoutTypeDirective = text.split('\n') - .filterNot { it.startsWith(EXPECTED_TYPE_TEXT_DIRECTIVE) } - .joinToString(separator = "\n") - return "$textWithoutTypeDirective\n$EXPECTED_TYPE_TEXT_DIRECTIVE $actualType" + testServices.assertions.assertEqualsToFile(testDataFileSibling(".txt"), actual) } - - companion object { - private const val EXPECTED_TYPE_TEXT_DIRECTIVE = "// EXPECTED_TYPE:" - } -} \ No newline at end of file +} diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/AbstractHLExpressionTypeTest.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/AbstractHLExpressionTypeTest.kt index c0fa17c554f..bcbd6bda78c 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/AbstractHLExpressionTypeTest.kt +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/AbstractHLExpressionTypeTest.kt @@ -6,29 +6,25 @@ package org.jetbrains.kotlin.idea.fir.frontend.api.components import org.jetbrains.kotlin.idea.fir.executeOnPooledThreadInReadAction +import org.jetbrains.kotlin.idea.fir.test.framework.AbstractKtIdeaTestWithSingleTestFileTest +import org.jetbrains.kotlin.idea.fir.test.framework.expressionMarkerProvider import org.jetbrains.kotlin.idea.frontend.api.analyse -import org.jetbrains.kotlin.idea.fir.test.framework.AbstractKtIdeaTest -import org.jetbrains.kotlin.idea.fir.test.framework.TestFileStructure -import org.jetbrains.kotlin.idea.fir.test.framework.TestStructureExpectedDataBlock -import org.jetbrains.kotlin.idea.fir.test.framework.TestStructureRenderer -import org.jetbrains.kotlin.idea.util.application.executeOnPooledThread import org.jetbrains.kotlin.psi.KtExpression -import org.jetbrains.kotlin.test.KotlinTestUtils +import org.jetbrains.kotlin.psi.KtFile +import org.jetbrains.kotlin.test.services.TestModuleStructure +import org.jetbrains.kotlin.test.services.TestServices +import org.jetbrains.kotlin.test.services.assertions -abstract class AbstractHLExpressionTypeTest : AbstractKtIdeaTest() { - override fun doTestByFileStructure(fileStructure: TestFileStructure) { - val expression = fileStructure.mainFile.selectedExpression as KtExpression? - ?: error("Selected expression was not provided") +abstract class AbstractHLExpressionTypeTest : AbstractKtIdeaTestWithSingleTestFileTest() { + override fun doTestByFileStructure(ktFile: KtFile, moduleStructure: TestModuleStructure, testServices: TestServices) { + val expression = testServices.expressionMarkerProvider.getSelectedElement(ktFile) as KtExpression val type = executeOnPooledThreadInReadAction { analyse(expression) { expression.getKtType().render() } } - val actual = TestStructureRenderer.render( - fileStructure, - TestStructureExpectedDataBlock( - "expression: ${expression.text}", - "type: $type" - ) - ) - KotlinTestUtils.assertEqualsToFile(fileStructure.filePath.toFile(), actual) + val actual = buildString { + appendLine("expression: ${expression.text}") + appendLine("type: $type") + } + testServices.assertions.assertEqualsToFile(testDataFileSibling(".txt"), actual) } } \ No newline at end of file diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/AbstractOverriddenDeclarationProviderTest.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/AbstractOverriddenDeclarationProviderTest.kt index 5792d6d822c..87226c1e9c6 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/AbstractOverriddenDeclarationProviderTest.kt +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/AbstractOverriddenDeclarationProviderTest.kt @@ -5,37 +5,40 @@ package org.jetbrains.kotlin.idea.fir.frontend.api.components -import com.intellij.psi.util.parentOfType -import com.intellij.psi.util.parentsOfType import org.jetbrains.kotlin.idea.fir.executeOnPooledThreadInReadAction +import org.jetbrains.kotlin.idea.fir.low.level.api.util.parentsOfType +import org.jetbrains.kotlin.idea.fir.test.framework.* import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession import org.jetbrains.kotlin.idea.frontend.api.analyse import org.jetbrains.kotlin.idea.frontend.api.symbols.KtCallableSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.KtFunctionSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.KtSyntheticJavaPropertySymbol -import org.jetbrains.kotlin.idea.fir.test.framework.AbstractKtIdeaTest -import org.jetbrains.kotlin.idea.fir.test.framework.TestFileStructure -import org.jetbrains.kotlin.idea.fir.test.framework.TestStructureExpectedDataBlock -import org.jetbrains.kotlin.idea.fir.test.framework.TestStructureRenderer import org.jetbrains.kotlin.idea.frontend.api.components.KtTypeRendererOptions import org.jetbrains.kotlin.psi.KtDeclaration +import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.test.KotlinTestUtils +import org.jetbrains.kotlin.test.services.TestModuleStructure +import org.jetbrains.kotlin.test.services.TestServices +import org.jetbrains.kotlin.test.services.assertions -abstract class AbstractOverriddenDeclarationProviderTest : AbstractKtIdeaTest() { - override fun doTestByFileStructure(fileStructure: TestFileStructure) { - val signatures = executeOnPooledThreadInReadAction { - analyse(fileStructure.mainKtFile) { - val symbol = getElementOfTypeAtCaret().getSymbol() as KtCallableSymbol +abstract class AbstractOverriddenDeclarationProviderTest : AbstractKtSingleModuleTest() { + override fun doTestByFileStructure(ktFiles: List, moduleStructure: TestModuleStructure, testServices: TestServices) { + val declaration = testServices.expressionMarkerProvider.getElementOfTypAtCaret(ktFiles.first()) + + val actual = executeOnPooledThreadInReadAction { + analyse(ktFiles.first()) { + val symbol = declaration.getSymbol() as KtCallableSymbol val allOverriddenSymbols = symbol.getAllOverriddenSymbols().map { renderSignature(it) } val directlyOverriddenSymbols = symbol.getDirectlyOverriddenSymbols().map { renderSignature(it) } - listOf( - TestStructureExpectedDataBlock("ALL:", allOverriddenSymbols), - TestStructureExpectedDataBlock("DIRECT:", directlyOverriddenSymbols), - ) + buildString { + appendLine("ALL:") + allOverriddenSymbols.forEach { appendLine(" $it") } + appendLine("DIRECT:") + directlyOverriddenSymbols.forEach { appendLine(" $it") } + } } } - val actual = TestStructureRenderer.render(fileStructure, signatures) - KotlinTestUtils.assertEqualsToFile(fileStructure.filePath.toFile(), actual) + testServices.assertions.assertEqualsToFile(testDataFileSibling(".txt"), actual) } private fun KtAnalysisSession.renderSignature(symbol: KtCallableSymbol): String = buildString { diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/AbstractRendererTest.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/AbstractRendererTest.kt index 2307e9cd363..cfe8bb44e7e 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/AbstractRendererTest.kt +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/AbstractRendererTest.kt @@ -5,24 +5,18 @@ package org.jetbrains.kotlin.idea.fir.frontend.api.components -import com.intellij.openapi.util.io.FileUtil import org.jetbrains.kotlin.idea.fir.executeOnPooledThreadInReadAction +import org.jetbrains.kotlin.idea.fir.test.framework.AbstractKtIdeaTestWithSingleTestFileTest import org.jetbrains.kotlin.idea.frontend.api.analyse import org.jetbrains.kotlin.idea.frontend.api.components.KtDeclarationRendererOptions import org.jetbrains.kotlin.idea.frontend.api.components.KtTypeRendererOptions -import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase import org.jetbrains.kotlin.psi.KtFile -import org.jetbrains.kotlin.test.KotlinTestUtils -import java.io.File - -abstract class AbstractRendererTest : KotlinLightCodeInsightFixtureTestCase() { - override fun isFirPlugin() = true - - protected fun doTest(path: String) { - val testDataFile = File(path) - val ktFile = myFixture.configureByText(testDataFile.name, FileUtil.loadFile(testDataFile)) as KtFile - +import org.jetbrains.kotlin.test.services.TestModuleStructure +import org.jetbrains.kotlin.test.services.TestServices +import org.jetbrains.kotlin.test.services.assertions +abstract class AbstractRendererTest : AbstractKtIdeaTestWithSingleTestFileTest() { + override fun doTestByFileStructure(ktFile: KtFile, moduleStructure: TestModuleStructure, testServices: TestServices) { val options = KtDeclarationRendererOptions.DEFAULT.copy( approximateTypes = true, renderContainingDeclarations = true, @@ -40,6 +34,6 @@ abstract class AbstractRendererTest : KotlinLightCodeInsightFixtureTestCase() { } } - KotlinTestUtils.assertEqualsToFile(File(path + ".rendered"), actual) + testServices.assertions.assertEqualsToFile(testDataFileSibling(".rendered"), actual) } } diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/AbstractReturnExpressionTargetTest.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/AbstractReturnExpressionTargetTest.kt deleted file mode 100644 index ba46a534761..00000000000 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/AbstractReturnExpressionTargetTest.kt +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2010-2020 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.idea.fir.frontend.api.components - -import com.intellij.openapi.util.io.FileUtil -import com.intellij.psi.PsiComment -import com.intellij.psi.util.parentOfType -import junit.framework.Assert -import org.jetbrains.kotlin.idea.fir.executeOnPooledThreadInReadAction -import org.jetbrains.kotlin.idea.frontend.api.analyse -import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase -import org.jetbrains.kotlin.psi.KtDeclaration -import org.jetbrains.kotlin.psi.KtFile -import org.jetbrains.kotlin.psi.KtReturnExpression -import org.jetbrains.kotlin.psi.psiUtil.forEachDescendantOfType -import org.jetbrains.kotlin.test.InTextDirectivesUtils -import java.io.File - -abstract class AbstractReturnExpressionTargetTest : KotlinLightCodeInsightFixtureTestCase() { - override fun isFirPlugin() = true - - protected fun doTest(path: String) { - val testDataFile = File(path) - val ktFile = myFixture.configureByText(testDataFile.name, FileUtil.loadFile(testDataFile)) as KtFile - - val ktReturnExpressionAtCaret = ktFile.findElementAt(myFixture.caretOffset)?.parentOfType() - ?: error("No element was found at caret or no is present in the test file") - - val expectedReturnTarget = ktFile.getExpectedReturnTarget() - - val actualReturnTargetPsi: KtDeclaration? = executeOnPooledThreadInReadAction { - analyse(ktFile) { - val actualReturnTargetSymbol = ktReturnExpressionAtCaret.getReturnTargetSymbol() ?: return@analyse null - actualReturnTargetSymbol.psi as KtDeclaration - } - } - - Assert.assertEquals(expectedReturnTarget?.text, actualReturnTargetPsi?.text) - } - - private fun KtFile.getExpectedReturnTarget(): KtDeclaration? { - var declaration: KtDeclaration? = null - forEachDescendantOfType { comment -> - if (comment.text == EXPECTED_RETURN_TARGET_COMMENT) { - if (declaration != null) { - error("More than one $EXPECTED_RETURN_TARGET_COMMENT found") - } - declaration = comment.parentOfType() - } - } - val noDeclarationExpected = InTextDirectivesUtils.findStringWithPrefixes(text, NO_TARGET_EXPECTED_PREFIX) != null - return when { - noDeclarationExpected && declaration != null -> { - error("$noDeclarationExpected was present together with $EXPECTED_RETURN_TARGET_COMMENT") - } - !noDeclarationExpected && declaration == null -> { - error("No $EXPECTED_RETURN_TARGET_COMMENT present, but $NO_TARGET_EXPECTED_PREFIX is not provided") - } - else -> declaration - } - } - - companion object { - private const val EXPECTED_RETURN_TARGET_COMMENT = "/* EXPECTED_TARGET */" - private const val NO_TARGET_EXPECTED_PREFIX = "// NO_TARGET_EXPECTED" - } -} \ No newline at end of file diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/ExpectedExpressionTypeTestGenerated.java b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/ExpectedExpressionTypeTestGenerated.java index 398d366ea20..bfd7fd26d91 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/ExpectedExpressionTypeTestGenerated.java +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/ExpectedExpressionTypeTestGenerated.java @@ -6,154 +6,175 @@ package org.jetbrains.kotlin.idea.fir.frontend.api.components; import com.intellij.testFramework.TestDataPath; -import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; -import org.jetbrains.kotlin.test.KotlinTestUtils; import org.jetbrains.kotlin.test.util.KtTestUtil; import org.jetbrains.kotlin.test.TestMetadata; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; import java.io.File; import java.util.regex.Pattern; -/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */ @SuppressWarnings("all") @TestMetadata("idea/idea-frontend-fir/testData/components/expectedExpressionType") @TestDataPath("$PROJECT_ROOT") -@RunWith(JUnit3RunnerWithInners.class) public class ExpectedExpressionTypeTestGenerated extends AbstractExpectedExpressionTypeTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - + @Test public void testAllFilesPresentInExpectedExpressionType() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-frontend-fir/testData/components/expectedExpressionType"), Pattern.compile("^(.+)\\.kt$"), null, true); } + @Test @TestMetadata("functionExpressionBody.kt") public void testFunctionExpressionBody() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expectedExpressionType/functionExpressionBody.kt"); } + @Test @TestMetadata("functionExpressionBodyQualified.kt") public void testFunctionExpressionBodyQualified() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expectedExpressionType/functionExpressionBodyQualified.kt"); } + @Test @TestMetadata("functionExpressionBodyWithTypeFromRHS.kt") public void testFunctionExpressionBodyWithTypeFromRHS() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expectedExpressionType/functionExpressionBodyWithTypeFromRHS.kt"); } + @Test @TestMetadata("functionExpressionBodyWithoutExplicitType.kt") public void testFunctionExpressionBodyWithoutExplicitType() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expectedExpressionType/functionExpressionBodyWithoutExplicitType.kt"); } + @Test @TestMetadata("functionLambdaParam.kt") public void testFunctionLambdaParam() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expectedExpressionType/functionLambdaParam.kt"); } + @Test @TestMetadata("functionNamedlParam.kt") public void testFunctionNamedlParam() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expectedExpressionType/functionNamedlParam.kt"); } + @Test @TestMetadata("functionParamWithTypeParam.kt") public void testFunctionParamWithTypeParam() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expectedExpressionType/functionParamWithTypeParam.kt"); } + @Test @TestMetadata("functionPositionalParam.kt") public void testFunctionPositionalParam() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expectedExpressionType/functionPositionalParam.kt"); } + @Test @TestMetadata("functionPositionalParamQualified.kt") public void testFunctionPositionalParamQualified() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expectedExpressionType/functionPositionalParamQualified.kt"); } + @Test @TestMetadata("ifCondition.kt") public void testIfCondition() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expectedExpressionType/ifCondition.kt"); } + @Test @TestMetadata("ifConditionQualified.kt") public void testIfConditionQualified() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expectedExpressionType/ifConditionQualified.kt"); } + @Test @TestMetadata("infixFunctionAsRegularCallParam.kt") public void testInfixFunctionAsRegularCallParam() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expectedExpressionType/infixFunctionAsRegularCallParam.kt"); } + @Test @TestMetadata("infixFunctionParam.kt") public void testInfixFunctionParam() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expectedExpressionType/infixFunctionParam.kt"); } + @Test @TestMetadata("infixFunctionParamQualified.kt") public void testInfixFunctionParamQualified() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expectedExpressionType/infixFunctionParamQualified.kt"); } + @Test @TestMetadata("propertyDeclaration.kt") public void testPropertyDeclaration() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expectedExpressionType/propertyDeclaration.kt"); } + @Test @TestMetadata("propertyDeclarationQualified.kt") public void testPropertyDeclarationQualified() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expectedExpressionType/propertyDeclarationQualified.kt"); } + @Test @TestMetadata("propertyDeclarationWithTypeFromRHS.kt") public void testPropertyDeclarationWithTypeFromRHS() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expectedExpressionType/propertyDeclarationWithTypeFromRHS.kt"); } + @Test @TestMetadata("propertyDeclarationWithoutExplicitType.kt") public void testPropertyDeclarationWithoutExplicitType() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expectedExpressionType/propertyDeclarationWithoutExplicitType.kt"); } + @Test @TestMetadata("returnFromFunction.kt") public void testReturnFromFunction() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expectedExpressionType/returnFromFunction.kt"); } + @Test @TestMetadata("returnFromFunctionQualifiedReceiver.kt") public void testReturnFromFunctionQualifiedReceiver() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expectedExpressionType/returnFromFunctionQualifiedReceiver.kt"); } + @Test @TestMetadata("returnFromFunctionQualifiedSelector.kt") public void testReturnFromFunctionQualifiedSelector() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expectedExpressionType/returnFromFunctionQualifiedSelector.kt"); } + @Test @TestMetadata("returnFromLambda.kt") public void testReturnFromLambda() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expectedExpressionType/returnFromLambda.kt"); } + @Test @TestMetadata("variableAssignment.kt") public void testVariableAssignment() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expectedExpressionType/variableAssignment.kt"); } + @Test @TestMetadata("variableAssignmentQualified.kt") public void testVariableAssignmentQualified() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expectedExpressionType/variableAssignmentQualified.kt"); } + @Test @TestMetadata("whileCondition.kt") public void testWhileCondition() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expectedExpressionType/whileCondition.kt"); } + @Test @TestMetadata("whileConditionQualified.kt") public void testWhileConditionQualified() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expectedExpressionType/whileConditionQualified.kt"); diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/HLExpressionTypeTestGenerated.java b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/HLExpressionTypeTestGenerated.java index cb48558e2dc..9d87769129d 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/HLExpressionTypeTestGenerated.java +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/HLExpressionTypeTestGenerated.java @@ -6,89 +6,97 @@ package org.jetbrains.kotlin.idea.fir.frontend.api.components; import com.intellij.testFramework.TestDataPath; -import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; -import org.jetbrains.kotlin.test.KotlinTestUtils; import org.jetbrains.kotlin.test.util.KtTestUtil; import org.jetbrains.kotlin.test.TestMetadata; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; import java.io.File; import java.util.regex.Pattern; -/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */ @SuppressWarnings("all") @TestMetadata("idea/idea-frontend-fir/testData/components/expressionType") @TestDataPath("$PROJECT_ROOT") -@RunWith(JUnit3RunnerWithInners.class) public class HLExpressionTypeTestGenerated extends AbstractHLExpressionTypeTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - + @Test public void testAllFilesPresentInExpressionType() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-frontend-fir/testData/components/expressionType"), Pattern.compile("^(.+)\\.kt$"), null, true); } + @Test @TestMetadata("assignmentExpressionTarget.kt") public void testAssignmentExpressionTarget() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expressionType/assignmentExpressionTarget.kt"); } + @Test @TestMetadata("binaryExpression.kt") public void testBinaryExpression() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expressionType/binaryExpression.kt"); } + @Test @TestMetadata("breakExpression.kt") public void testBreakExpression() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expressionType/breakExpression.kt"); } + @Test @TestMetadata("forExpression.kt") public void testForExpression() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expressionType/forExpression.kt"); } + @Test @TestMetadata("functionCall.kt") public void testFunctionCall() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expressionType/functionCall.kt"); } + @Test @TestMetadata("inParens.kt") public void testInParens() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expressionType/inParens.kt"); } + @Test @TestMetadata("insideStringTemplate.kt") public void testInsideStringTemplate() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expressionType/insideStringTemplate.kt"); } + @Test @TestMetadata("insideStringTemplateWithBinrary.kt") public void testInsideStringTemplateWithBinrary() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expressionType/insideStringTemplateWithBinrary.kt"); } + @Test @TestMetadata("intLiteral.kt") public void testIntLiteral() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expressionType/intLiteral.kt"); } + @Test @TestMetadata("property.kt") public void testProperty() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expressionType/property.kt"); } + @Test @TestMetadata("returnExpression.kt") public void testReturnExpression() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expressionType/returnExpression.kt"); } + @Test @TestMetadata("stringLiteral.kt") public void testStringLiteral() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expressionType/stringLiteral.kt"); } + @Test @TestMetadata("whileExpression.kt") public void testWhileExpression() throws Exception { runTest("idea/idea-frontend-fir/testData/components/expressionType/whileExpression.kt"); diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/OverriddenDeclarationProviderTestGenerated.java b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/OverriddenDeclarationProviderTestGenerated.java index 9baff0fdd20..863ddd71b75 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/OverriddenDeclarationProviderTestGenerated.java +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/OverriddenDeclarationProviderTestGenerated.java @@ -6,54 +6,55 @@ package org.jetbrains.kotlin.idea.fir.frontend.api.components; import com.intellij.testFramework.TestDataPath; -import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; -import org.jetbrains.kotlin.test.KotlinTestUtils; import org.jetbrains.kotlin.test.util.KtTestUtil; import org.jetbrains.kotlin.test.TestMetadata; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; import java.io.File; import java.util.regex.Pattern; -/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */ @SuppressWarnings("all") @TestMetadata("idea/idea-frontend-fir/testData/components/overridenDeclarations") @TestDataPath("$PROJECT_ROOT") -@RunWith(JUnit3RunnerWithInners.class) public class OverriddenDeclarationProviderTestGenerated extends AbstractOverriddenDeclarationProviderTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - + @Test public void testAllFilesPresentInOverridenDeclarations() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-frontend-fir/testData/components/overridenDeclarations"), Pattern.compile("^(.+)\\.kt$"), null, true); } + @Test @TestMetadata("inOtherFile.kt") public void testInOtherFile() throws Exception { runTest("idea/idea-frontend-fir/testData/components/overridenDeclarations/inOtherFile.kt"); } + @Test @TestMetadata("intersectionOverride.kt") public void testIntersectionOverride() throws Exception { runTest("idea/idea-frontend-fir/testData/components/overridenDeclarations/intersectionOverride.kt"); } + @Test @TestMetadata("intersectionOverride2.kt") public void testIntersectionOverride2() throws Exception { runTest("idea/idea-frontend-fir/testData/components/overridenDeclarations/intersectionOverride2.kt"); } + @Test @TestMetadata("javaAccessors.kt") public void testJavaAccessors() throws Exception { runTest("idea/idea-frontend-fir/testData/components/overridenDeclarations/javaAccessors.kt"); } + @Test @TestMetadata("multipleInterfaces.kt") public void testMultipleInterfaces() throws Exception { runTest("idea/idea-frontend-fir/testData/components/overridenDeclarations/multipleInterfaces.kt"); } + @Test @TestMetadata("sequenceOfOverrides.kt") public void testSequenceOfOverrides() throws Exception { runTest("idea/idea-frontend-fir/testData/components/overridenDeclarations/sequenceOfOverrides.kt"); diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/RendererTestGenerated.java b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/RendererTestGenerated.java index 97482fa1870..0682785c2af 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/RendererTestGenerated.java +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/RendererTestGenerated.java @@ -6,159 +6,181 @@ package org.jetbrains.kotlin.idea.fir.frontend.api.components; import com.intellij.testFramework.TestDataPath; -import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; -import org.jetbrains.kotlin.test.KotlinTestUtils; import org.jetbrains.kotlin.test.util.KtTestUtil; import org.jetbrains.kotlin.test.TestMetadata; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; import java.io.File; import java.util.regex.Pattern; -/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */ @SuppressWarnings("all") @TestMetadata("idea/idea-frontend-fir/testData/components/declarationRenderer") @TestDataPath("$PROJECT_ROOT") -@RunWith(JUnit3RunnerWithInners.class) public class RendererTestGenerated extends AbstractRendererTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - + @Test public void testAllFilesPresentInDeclarationRenderer() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-frontend-fir/testData/components/declarationRenderer"), Pattern.compile("^(.+)\\.kt$"), null, true); } + @Test @TestMetadata("annotation.kt") public void testAnnotation() throws Exception { runTest("idea/idea-frontend-fir/testData/components/declarationRenderer/annotation.kt"); } + @Test @TestMetadata("complexTypes.kt") public void testComplexTypes() throws Exception { runTest("idea/idea-frontend-fir/testData/components/declarationRenderer/complexTypes.kt"); } + @Test @TestMetadata("constructorInObject.kt") public void testConstructorInObject() throws Exception { runTest("idea/idea-frontend-fir/testData/components/declarationRenderer/constructorInObject.kt"); } + @Test @TestMetadata("constructorOfAnonymousObject.kt") public void testConstructorOfAnonymousObject() throws Exception { runTest("idea/idea-frontend-fir/testData/components/declarationRenderer/constructorOfAnonymousObject.kt"); } + @Test @TestMetadata("delegates.kt") public void testDelegates() throws Exception { runTest("idea/idea-frontend-fir/testData/components/declarationRenderer/delegates.kt"); } + @Test @TestMetadata("derivedClass.kt") public void testDerivedClass() throws Exception { runTest("idea/idea-frontend-fir/testData/components/declarationRenderer/derivedClass.kt"); } + @Test @TestMetadata("emptyAnonymousObject.kt") public void testEmptyAnonymousObject() throws Exception { runTest("idea/idea-frontend-fir/testData/components/declarationRenderer/emptyAnonymousObject.kt"); } + @Test @TestMetadata("enums.kt") public void testEnums() throws Exception { runTest("idea/idea-frontend-fir/testData/components/declarationRenderer/enums.kt"); } + @Test @TestMetadata("enums2.kt") public void testEnums2() throws Exception { runTest("idea/idea-frontend-fir/testData/components/declarationRenderer/enums2.kt"); } + @Test @TestMetadata("expectActual.kt") public void testExpectActual() throws Exception { runTest("idea/idea-frontend-fir/testData/components/declarationRenderer/expectActual.kt"); } + @Test @TestMetadata("F.kt") public void testF() throws Exception { runTest("idea/idea-frontend-fir/testData/components/declarationRenderer/F.kt"); } + @Test @TestMetadata("functionTypes.kt") public void testFunctionTypes() throws Exception { runTest("idea/idea-frontend-fir/testData/components/declarationRenderer/functionTypes.kt"); } + @Test @TestMetadata("genericFunctions.kt") public void testGenericFunctions() throws Exception { runTest("idea/idea-frontend-fir/testData/components/declarationRenderer/genericFunctions.kt"); } + @Test @TestMetadata("genericProperty.kt") public void testGenericProperty() throws Exception { runTest("idea/idea-frontend-fir/testData/components/declarationRenderer/genericProperty.kt"); } + @Test @TestMetadata("intersectionType.kt") public void testIntersectionType() throws Exception { runTest("idea/idea-frontend-fir/testData/components/declarationRenderer/intersectionType.kt"); } + @Test @TestMetadata("nestedClass.kt") public void testNestedClass() throws Exception { runTest("idea/idea-frontend-fir/testData/components/declarationRenderer/nestedClass.kt"); } + @Test @TestMetadata("NestedOfAliasedType.kt") public void testNestedOfAliasedType() throws Exception { runTest("idea/idea-frontend-fir/testData/components/declarationRenderer/NestedOfAliasedType.kt"); } + @Test @TestMetadata("NestedSuperType.kt") public void testNestedSuperType() throws Exception { runTest("idea/idea-frontend-fir/testData/components/declarationRenderer/NestedSuperType.kt"); } + @Test @TestMetadata("noPrimaryConstructor.kt") public void testNoPrimaryConstructor() throws Exception { runTest("idea/idea-frontend-fir/testData/components/declarationRenderer/noPrimaryConstructor.kt"); } + @Test @TestMetadata("simpleClass.kt") public void testSimpleClass() throws Exception { runTest("idea/idea-frontend-fir/testData/components/declarationRenderer/simpleClass.kt"); } + @Test @TestMetadata("simpleFun.kt") public void testSimpleFun() throws Exception { runTest("idea/idea-frontend-fir/testData/components/declarationRenderer/simpleFun.kt"); } + @Test @TestMetadata("simpleTypeAlias.kt") public void testSimpleTypeAlias() throws Exception { runTest("idea/idea-frontend-fir/testData/components/declarationRenderer/simpleTypeAlias.kt"); } + @Test @TestMetadata("typeAliasWithGeneric.kt") public void testTypeAliasWithGeneric() throws Exception { runTest("idea/idea-frontend-fir/testData/components/declarationRenderer/typeAliasWithGeneric.kt"); } + @Test @TestMetadata("typeParameterVsNested.kt") public void testTypeParameterVsNested() throws Exception { runTest("idea/idea-frontend-fir/testData/components/declarationRenderer/typeParameterVsNested.kt"); } + @Test @TestMetadata("typeParameters.kt") public void testTypeParameters() throws Exception { runTest("idea/idea-frontend-fir/testData/components/declarationRenderer/typeParameters.kt"); } + @Test @TestMetadata("vararg.kt") public void testVararg() throws Exception { runTest("idea/idea-frontend-fir/testData/components/declarationRenderer/vararg.kt"); } + @Test @TestMetadata("where.kt") public void testWhere() throws Exception { runTest("idea/idea-frontend-fir/testData/components/declarationRenderer/where.kt"); diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/ReturnExpressionTargetTestGenerated.java b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/ReturnExpressionTargetTestGenerated.java deleted file mode 100644 index 78f9ac52451..00000000000 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/ReturnExpressionTargetTestGenerated.java +++ /dev/null @@ -1,51 +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.idea.fir.frontend.api.components; - -import com.intellij.testFramework.TestDataPath; -import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; -import org.jetbrains.kotlin.test.KotlinTestUtils; -import org.jetbrains.kotlin.test.util.KtTestUtil; -import org.jetbrains.kotlin.test.TestMetadata; -import org.junit.runner.RunWith; - -import java.io.File; -import java.util.regex.Pattern; - -/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ -@SuppressWarnings("all") -@TestMetadata("idea/idea-frontend-fir/testData/components/returnExpressionTarget") -@TestDataPath("$PROJECT_ROOT") -@RunWith(JUnit3RunnerWithInners.class) -public class ReturnExpressionTargetTestGenerated extends AbstractReturnExpressionTargetTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - - public void testAllFilesPresentInReturnExpressionTarget() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-frontend-fir/testData/components/returnExpressionTarget"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - - @TestMetadata("returnFromFunctionViaLambdaWithoutLabel.kt") - public void testReturnFromFunctionViaLambdaWithoutLabel() throws Exception { - runTest("idea/idea-frontend-fir/testData/components/returnExpressionTarget/returnFromFunctionViaLambdaWithoutLabel.kt"); - } - - @TestMetadata("returnFromFunctionWithLabel.kt") - public void testReturnFromFunctionWithLabel() throws Exception { - runTest("idea/idea-frontend-fir/testData/components/returnExpressionTarget/returnFromFunctionWithLabel.kt"); - } - - @TestMetadata("returnFromFunctionWithoutLabel.kt") - public void testReturnFromFunctionWithoutLabel() throws Exception { - runTest("idea/idea-frontend-fir/testData/components/returnExpressionTarget/returnFromFunctionWithoutLabel.kt"); - } - - @TestMetadata("returnFromLambdaWithLabel.kt") - public void testReturnFromLambdaWithLabel() throws Exception { - runTest("idea/idea-frontend-fir/testData/components/returnExpressionTarget/returnFromLambdaWithLabel.kt"); - } -} diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/TypeCreatorTest.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/TypeCreatorTest.kt deleted file mode 100644 index dcd2f03bf61..00000000000 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/components/TypeCreatorTest.kt +++ /dev/null @@ -1,90 +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.idea.fir.frontend.api.components - -import com.intellij.testFramework.LightProjectDescriptor -import org.jetbrains.kotlin.idea.fir.executeOnPooledThreadInReadAction -import org.jetbrains.kotlin.idea.fir.invalidateCaches -import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession -import org.jetbrains.kotlin.idea.frontend.api.analyse -import org.jetbrains.kotlin.idea.frontend.api.components.KtTypeRendererOptions -import org.jetbrains.kotlin.idea.frontend.api.components.buildClassType -import org.jetbrains.kotlin.idea.frontend.api.types.KtType -import org.jetbrains.kotlin.idea.frontend.api.types.KtTypeNullability -import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase -import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor -import org.jetbrains.kotlin.name.ClassId -import org.jetbrains.kotlin.name.StandardClassIds -import org.jetbrains.kotlin.psi.KtFile -import org.jetbrains.kotlin.types.Variance -import org.junit.Test - -internal class TypeCreatorTest : KotlinLightCodeInsightFixtureTestCase() { - override fun isFirPlugin() = true - - override fun tearDown() { - project.invalidateCaches(file as? KtFile) - super.tearDown() - } - - private fun doTest( - expected: String, - buildType: KtAnalysisSession.() -> KtType, - ) { - val fakeKtFile = myFixture.configureByText("file.kt", "val a = 10") as KtFile - val renderedType = executeOnPooledThreadInReadAction { - analyse(fakeKtFile) { - val ktType = buildType() - ktType.render(RENDERING_OPTIONS) - } - } - assertEquals(expected, renderedType) - } - - override fun getProjectDescriptor(): LightProjectDescriptor = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE - - @Test - fun testClassTypeByClassId() { - doTest("List") { - buildClassType(StandardClassIds.List) { - argument(buildClassType(StandardClassIds.Int) { nullability = KtTypeNullability.NULLABLE }) - } - } - } - - @Test - fun testClassTypeBySymbolClassId() { - doTest("MutableList") { - val listSymbol = StandardClassIds.MutableList.getCorrespondingToplevelClassOrObjectSymbol()!! - buildClassType(listSymbol) { - argument(buildClassType(StandardClassIds.Int)) - } - } - } - - @Test - fun testClassTypeByUnresolvedClassId() { - doTest("ERROR_TYPE ") { - buildClassType(ClassId.fromString("NonExistingListClass")) { - argument(buildClassType(StandardClassIds.Int) { nullability = KtTypeNullability.NULLABLE }) - } - } - } - - @Test - fun testTypeArgumentVariance() { - doTest("KClass") { - buildClassType(StandardClassIds.KClass) { - argument(buildClassType(StandardClassIds.Number), variance = Variance.OUT_VARIANCE) - } - } - } - - - companion object { - private val RENDERING_OPTIONS = KtTypeRendererOptions.SHORT_NAMES.copy(renderUnresolvedTypeAsResolved = false) - } -} \ No newline at end of file diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/fir/AbstractResolveCallTest.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/fir/AbstractResolveCallTest.kt index 35c8cfe9802..d726b80ac96 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/fir/AbstractResolveCallTest.kt +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/fir/AbstractResolveCallTest.kt @@ -5,12 +5,10 @@ package org.jetbrains.kotlin.idea.fir.frontend.api.fir -import com.intellij.openapi.editor.CaretState -import com.intellij.openapi.util.TextRange import com.intellij.psi.PsiElement -import com.intellij.testFramework.LightCodeInsightTestCase -import org.jetbrains.kotlin.idea.fir.addExternalTestFiles import org.jetbrains.kotlin.idea.fir.executeOnPooledThreadInReadAction +import org.jetbrains.kotlin.idea.fir.test.framework.AbstractKtSingleModuleTest +import org.jetbrains.kotlin.idea.fir.test.framework.expressionMarkerProvider import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession import org.jetbrains.kotlin.idea.frontend.api.analyse import org.jetbrains.kotlin.idea.frontend.api.calls.KtCall @@ -20,54 +18,26 @@ import org.jetbrains.kotlin.idea.frontend.api.symbols.KtFunctionLikeSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.KtFunctionSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.KtValueParameterSymbol import org.jetbrains.kotlin.idea.frontend.api.types.KtType -import org.jetbrains.kotlin.psi.KtBinaryExpression -import org.jetbrains.kotlin.psi.KtCallExpression -import org.jetbrains.kotlin.psi.KtFile -import org.jetbrains.kotlin.psi.KtValueArgument -import org.jetbrains.kotlin.psi.psiUtil.elementsInRange -import org.jetbrains.kotlin.test.KotlinTestUtils -import org.jetbrains.kotlin.test.util.KtTestUtil -import java.io.File +import org.jetbrains.kotlin.psi.* +import org.jetbrains.kotlin.test.services.TestModuleStructure +import org.jetbrains.kotlin.test.services.TestServices +import org.jetbrains.kotlin.test.services.assertions import kotlin.reflect.KProperty1 import kotlin.reflect.full.memberProperties import kotlin.reflect.full.primaryConstructor import kotlin.reflect.jvm.javaGetter +abstract class AbstractResolveCallTest : AbstractKtSingleModuleTest() { + override fun doTestByFileStructure(ktFiles: List, moduleStructure: TestModuleStructure, testServices: TestServices) { + val ktFile = ktFiles.first() + val expression = testServices.expressionMarkerProvider.getSelectedElement(ktFile) -abstract class AbstractResolveCallTest : @Suppress("DEPRECATION") LightCodeInsightTestCase() { - override fun getTestDataPath(): String = KtTestUtil.getHomeDirectory() + "/" - - protected fun doTest(path: String) { - addExternalTestFiles(path) - configureByFile(path) - val elements = editor.caretModel.caretsAndSelections.map { selection -> - getSingleSelectedElement(selection) - } - - val actualText = executeOnPooledThreadInReadAction { - val callInfos = analyse(file as KtFile) { - elements.map { resolveCall(it) } + val actual = executeOnPooledThreadInReadAction { + analyse(ktFile) { + resolveCall(expression)?.stringRepresentation() } - - if (callInfos.isEmpty()) { - error("There are should be at least one call selected") - } - - val textWithoutLatestComments = run { - val rawText = File(path).readText() - """(?m)^// CALL:\s.*$""".toRegex().replace(rawText, "").trimEnd() - } - buildString { - append(textWithoutLatestComments) - append("\n\n") - analyse(file as KtFile) { - callInfos.joinTo(this@buildString, separator = "\n") { info -> - "// CALL: ${info?.stringRepresentation()}" - } - } - } - } - KotlinTestUtils.assertEqualsToFile(File(path), actualText) + } ?: "null" + testServices.assertions.assertEqualsToFile(testDataFileSibling(".txt"), actual) } private fun KtAnalysisSession.resolveCall(element: PsiElement): KtCall? = when (element) { @@ -77,21 +47,6 @@ abstract class AbstractResolveCallTest : @Suppress("DEPRECATION") LightCodeInsig else -> error("Selected should be either KtCallExpression or KtBinaryExpression but was $element") } - - private fun getSingleSelectedElement(selection: CaretState): PsiElement { - val selectionRange = selection.getTextRange() - val elements = file.elementsInRange(selectionRange) - if (elements.size != 1) { - val selectionText = file.text.substring(selectionRange.startOffset, selectionRange.endOffset) - error("Single element should be found for selection `$selectionText`, but $elements were found") - } - return elements.first() - } - - private fun CaretState.getTextRange() = TextRange.create( - editor.logicalPositionToOffset(selectionStart!!), - editor.logicalPositionToOffset(selectionEnd!!) - ) } private fun KtCall.stringRepresentation(): String { diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/fir/ResolveCallTestGenerated.java b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/fir/ResolveCallTestGenerated.java index 6f89ba16777..c08444aca87 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/fir/ResolveCallTestGenerated.java +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/fir/ResolveCallTestGenerated.java @@ -6,74 +6,79 @@ package org.jetbrains.kotlin.idea.fir.frontend.api.fir; import com.intellij.testFramework.TestDataPath; -import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; -import org.jetbrains.kotlin.test.KotlinTestUtils; import org.jetbrains.kotlin.test.util.KtTestUtil; import org.jetbrains.kotlin.test.TestMetadata; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; import java.io.File; import java.util.regex.Pattern; -/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */ @SuppressWarnings("all") @TestMetadata("idea/idea-frontend-fir/testData/analysisSession/resolveCall") @TestDataPath("$PROJECT_ROOT") -@RunWith(JUnit3RunnerWithInners.class) public class ResolveCallTestGenerated extends AbstractResolveCallTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - + @Test public void testAllFilesPresentInResolveCall() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-frontend-fir/testData/analysisSession/resolveCall"), Pattern.compile("^(.+)\\.kt$"), null, true); } + @Test @TestMetadata("functionCallInTheSameFile.kt") public void testFunctionCallInTheSameFile() throws Exception { runTest("idea/idea-frontend-fir/testData/analysisSession/resolveCall/functionCallInTheSameFile.kt"); } + @Test @TestMetadata("functionWithReceiverCall.kt") public void testFunctionWithReceiverCall() throws Exception { runTest("idea/idea-frontend-fir/testData/analysisSession/resolveCall/functionWithReceiverCall.kt"); } + @Test @TestMetadata("functionWithReceiverSafeCall.kt") public void testFunctionWithReceiverSafeCall() throws Exception { runTest("idea/idea-frontend-fir/testData/analysisSession/resolveCall/functionWithReceiverSafeCall.kt"); } + @Test @TestMetadata("implicitConstuctorCall.kt") public void testImplicitConstuctorCall() throws Exception { runTest("idea/idea-frontend-fir/testData/analysisSession/resolveCall/implicitConstuctorCall.kt"); } + @Test @TestMetadata("implicitJavaConstuctorCall.kt") public void testImplicitJavaConstuctorCall() throws Exception { runTest("idea/idea-frontend-fir/testData/analysisSession/resolveCall/implicitJavaConstuctorCall.kt"); } + @Test @TestMetadata("javaFunctionCall.kt") public void testJavaFunctionCall() throws Exception { runTest("idea/idea-frontend-fir/testData/analysisSession/resolveCall/javaFunctionCall.kt"); } + @Test @TestMetadata("resolveCallInSuperConstructorParam.kt") public void testResolveCallInSuperConstructorParam() throws Exception { runTest("idea/idea-frontend-fir/testData/analysisSession/resolveCall/resolveCallInSuperConstructorParam.kt"); } + @Test @TestMetadata("simpleCallWithNonMatchingArgs.kt") public void testSimpleCallWithNonMatchingArgs() throws Exception { runTest("idea/idea-frontend-fir/testData/analysisSession/resolveCall/simpleCallWithNonMatchingArgs.kt"); } + @Test @TestMetadata("variableAsFunction.kt") public void testVariableAsFunction() throws Exception { runTest("idea/idea-frontend-fir/testData/analysisSession/resolveCall/variableAsFunction.kt"); } + @Test @TestMetadata("variableAsFunctionLikeCall.kt") public void testVariableAsFunctionLikeCall() throws Exception { runTest("idea/idea-frontend-fir/testData/analysisSession/resolveCall/variableAsFunctionLikeCall.kt"); diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/scopes/AbstractFileScopeTest.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/scopes/AbstractFileScopeTest.kt index d68a9b4c56c..fa92a02ad20 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/scopes/AbstractFileScopeTest.kt +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/scopes/AbstractFileScopeTest.kt @@ -5,20 +5,19 @@ package org.jetbrains.kotlin.idea.fir.frontend.api.scopes -import com.intellij.openapi.util.io.FileUtil import org.jetbrains.kotlin.idea.fir.executeOnPooledThreadInReadAction +import org.jetbrains.kotlin.idea.fir.test.framework.AbstractKtIdeaTestWithSingleTestFileTest import org.jetbrains.kotlin.idea.frontend.api.analyse import org.jetbrains.kotlin.idea.frontend.api.symbols.DebugSymbolRenderer -import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.test.KotlinTestUtils +import org.jetbrains.kotlin.test.services.TestModuleStructure +import org.jetbrains.kotlin.test.services.TestServices +import org.jetbrains.kotlin.test.services.assertions import java.io.File -abstract class AbstractFileScopeTest : KotlinLightCodeInsightFixtureTestCase() { - - protected fun doTest(path: String) { - val ktFile = myFixture.configureByText("file.kt", FileUtil.loadFile(File(path))) as KtFile - +abstract class AbstractFileScopeTest : AbstractKtIdeaTestWithSingleTestFileTest() { + override fun doTestByFileStructure(ktFile: KtFile, moduleStructure: TestModuleStructure, testServices: TestServices) { val actual = executeOnPooledThreadInReadAction { analyse(ktFile) { val symbol = ktFile.getFileSymbol() @@ -31,13 +30,13 @@ abstract class AbstractFileScopeTest : KotlinLightCodeInsightFixtureTestCase() { val renderedClassifiers = scope.getClassifierSymbols().map { DebugSymbolRenderer.render(it) } "FILE SYMBOL:\n" + renderedSymbol + - "\nCALLABLE NAMES:\n" + callableNames.joinToString(prefix = "[", postfix = "]\n", separator = ", ") + - "\nCALLABLE SYMBOLS:\n" + renderedCallables.joinToString(separator = "\n") + - "\nCLASSIFIER NAMES:\n" + classifierNames.joinToString(prefix = "[", postfix = "]\n", separator = ", ") + - "\nCLASSIFIER SYMBOLS:\n" + renderedClassifiers.joinToString(separator = "\n") + "\nCALLABLE NAMES:\n" + callableNames.joinToString(prefix = "[", postfix = "]\n", separator = ", ") + + "\nCALLABLE SYMBOLS:\n" + renderedCallables.joinToString(separator = "\n") + + "\nCLASSIFIER NAMES:\n" + classifierNames.joinToString(prefix = "[", postfix = "]\n", separator = ", ") + + "\nCLASSIFIER SYMBOLS:\n" + renderedClassifiers.joinToString(separator = "\n") } } - KotlinTestUtils.assertEqualsToFile(File("$path.result"), actual) + testServices.assertions.assertEqualsToFile(testDataFileSibling(".txt"), actual) } } \ No newline at end of file diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/scopes/AbstractMemberScopeTest.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/scopes/AbstractMemberScopeTest.kt index 26fed2d8d1e..af0633613c7 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/scopes/AbstractMemberScopeTest.kt +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/scopes/AbstractMemberScopeTest.kt @@ -10,11 +10,12 @@ import org.jetbrains.kotlin.idea.fir.frontend.api.SymbolByFqName import org.jetbrains.kotlin.idea.fir.frontend.api.symbols.AbstractSymbolByFqNameTest import org.jetbrains.kotlin.idea.frontend.api.symbols.KtClassOrObjectSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.KtSymbol -import org.jetbrains.kotlin.idea.fir.test.framework.TestFileStructure +import org.jetbrains.kotlin.psi.KtFile +import org.jetbrains.kotlin.test.services.TestServices abstract class AbstractMemberScopeByFqNameTest : AbstractSymbolByFqNameTest() { - override fun KtAnalysisSession.collectSymbols(fileStructure: TestFileStructure): List { - val symbolData = SymbolByFqName.getSymbolDataFromFile(fileStructure.filePath) + override fun KtAnalysisSession.collectSymbols(ktFile: KtFile, testServices: TestServices): List { + val symbolData = SymbolByFqName.getSymbolDataFromFile(testDataPath) val symbols = with(symbolData) { toSymbols() } val classSymbol = symbols.singleOrNull() as? KtClassOrObjectSymbol ?: error("Should be a single class symbol, but $symbols found") diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/scopes/FileScopeTestGenerated.java b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/scopes/FileScopeTestGenerated.java index 203e76552d8..95766e19f53 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/scopes/FileScopeTestGenerated.java +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/scopes/FileScopeTestGenerated.java @@ -6,29 +6,25 @@ package org.jetbrains.kotlin.idea.fir.frontend.api.scopes; import com.intellij.testFramework.TestDataPath; -import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; -import org.jetbrains.kotlin.test.KotlinTestUtils; import org.jetbrains.kotlin.test.util.KtTestUtil; import org.jetbrains.kotlin.test.TestMetadata; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; import java.io.File; import java.util.regex.Pattern; -/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */ @SuppressWarnings("all") @TestMetadata("idea/idea-frontend-fir/testData/fileScopeTest") @TestDataPath("$PROJECT_ROOT") -@RunWith(JUnit3RunnerWithInners.class) public class FileScopeTestGenerated extends AbstractFileScopeTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - + @Test public void testAllFilesPresentInFileScopeTest() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-frontend-fir/testData/fileScopeTest"), Pattern.compile("^(.+)\\.kt$"), null, true); } + @Test @TestMetadata("simpleFileScope.kt") public void testSimpleFileScope() throws Exception { runTest("idea/idea-frontend-fir/testData/fileScopeTest/simpleFileScope.kt"); diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/scopes/MemberScopeByFqNameTestGenerated.java b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/scopes/MemberScopeByFqNameTestGenerated.java index 3a61563923b..6baf80eaf94 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/scopes/MemberScopeByFqNameTestGenerated.java +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/scopes/MemberScopeByFqNameTestGenerated.java @@ -6,44 +6,43 @@ package org.jetbrains.kotlin.idea.fir.frontend.api.scopes; import com.intellij.testFramework.TestDataPath; -import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; -import org.jetbrains.kotlin.test.KotlinTestUtils; import org.jetbrains.kotlin.test.util.KtTestUtil; import org.jetbrains.kotlin.test.TestMetadata; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; import java.io.File; import java.util.regex.Pattern; -/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */ @SuppressWarnings("all") @TestMetadata("idea/idea-frontend-fir/testData/memberScopeByFqName") @TestDataPath("$PROJECT_ROOT") -@RunWith(JUnit3RunnerWithInners.class) public class MemberScopeByFqNameTestGenerated extends AbstractMemberScopeByFqNameTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - + @Test public void testAllFilesPresentInMemberScopeByFqName() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-frontend-fir/testData/memberScopeByFqName"), Pattern.compile("^(.+)\\.kt$"), null, true); } + @Test @TestMetadata("Int.kt") public void testInt() throws Exception { runTest("idea/idea-frontend-fir/testData/memberScopeByFqName/Int.kt"); } + @Test @TestMetadata("java.lang.String.kt") public void testJava_lang_String() throws Exception { runTest("idea/idea-frontend-fir/testData/memberScopeByFqName/java.lang.String.kt"); } + @Test @TestMetadata("kotlin.Function2.kt") public void testKotlin_Function2() throws Exception { runTest("idea/idea-frontend-fir/testData/memberScopeByFqName/kotlin.Function2.kt"); } + @Test @TestMetadata("MutableList.kt") public void testMutableList() throws Exception { runTest("idea/idea-frontend-fir/testData/memberScopeByFqName/MutableList.kt"); diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/symbols/AbstractMemoryLeakInSymbolsTest.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/symbols/AbstractMemoryLeakInSymbolsTest.kt deleted file mode 100644 index d2021896c70..00000000000 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/symbols/AbstractMemoryLeakInSymbolsTest.kt +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright 2010-2020 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.idea.fir.frontend.api.symbols - -import com.intellij.openapi.components.service -import com.intellij.openapi.util.io.FileUtil -import com.sun.management.HotSpotDiagnosticMXBean -import junit.framework.Assert -import org.jetbrains.kotlin.idea.caches.project.LibraryModificationTracker -import org.jetbrains.kotlin.idea.fir.executeOnPooledThreadInReadAction -import org.jetbrains.kotlin.idea.fir.low.level.api.api.KotlinOutOfBlockModificationTrackerFactory -import org.jetbrains.kotlin.idea.fir.low.level.api.trackers.KotlinFirOutOfBlockModificationTrackerFactory -import org.jetbrains.kotlin.idea.frontend.api.InvalidWayOfUsingAnalysisSession -import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSessionProvider -import org.jetbrains.kotlin.idea.frontend.api.analyse -import org.jetbrains.kotlin.idea.frontend.api.fir.KtFirAnalysisSessionProvider -import org.jetbrains.kotlin.idea.frontend.api.fir.symbols.KtFirSymbol -import org.jetbrains.kotlin.idea.frontend.api.symbols.KtSymbol -import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase -import org.jetbrains.kotlin.psi.KtDeclaration -import org.jetbrains.kotlin.psi.KtFile -import org.jetbrains.kotlin.psi.psiUtil.collectDescendantsOfType -import java.io.File -import java.lang.management.ManagementFactory -import java.nio.file.Path -import java.nio.file.Paths -import java.text.SimpleDateFormat -import java.util.* - -abstract class AbstractMemoryLeakInSymbolsTest : KotlinLightCodeInsightFixtureTestCase() { - override fun isFirPlugin() = true - - protected fun doTest(path: String) { - val testDataFile = File(path) - val ktFile = myFixture.configureByText(testDataFile.name, FileUtil.loadFile(testDataFile)) as KtFile - val symbols = executeOnPooledThreadInReadAction { - analyse(ktFile) { - ktFile.collectDescendantsOfType().map { it.getSymbol() } - } - } - - invalidateAllCaches(ktFile) - System.gc() - - val leakedSymbols = executeOnPooledThreadInReadAction { - symbols.map { it.hasNoFirElementLeak() }.filterIsInstance() - } - if (leakedSymbols.isNotEmpty()) { - val memoryDumpPath = dumpHeap() - Assert.fail( - """Some symbols leaked (${leakedSymbols.size}/${symbols.size}) - Memory dump is $memoryDumpPath - Symbols: - ${leakedSymbols.joinToString(separator = "\n") { it.symbol }} - """.trimIndent() - ) - } - } - - @OptIn(InvalidWayOfUsingAnalysisSession::class) - private fun invalidateAllCaches(ktFile: KtFile) { - (project.service() as KotlinFirOutOfBlockModificationTrackerFactory).incrementModificationsCount() - project.service().incModificationCount() - (project.service() as KtFirAnalysisSessionProvider).clearCaches() - executeOnPooledThreadInReadAction { analyse(ktFile) {} } - } - - private fun KtSymbol.hasNoFirElementLeak(): LeakCheckResult { - require(this is KtFirSymbol<*>) - return if (firRef.isCollected()) LeakCheckResult.NoLeak - else LeakCheckResult.Leak(this::class.simpleName!!) - } - - private sealed class LeakCheckResult { - object NoLeak : LeakCheckResult() - data class Leak(val symbol: String) : LeakCheckResult() - } - - private fun dumpHeap(): Path { - val fileNameSuffix = SimpleDateFormat("yyMMddHHmmss").format(Date()) - val path = Paths.get(basePath).resolve("memoryLeakDump_${fileNameSuffix}.hprof") - val server = ManagementFactory.getPlatformMBeanServer() - ManagementFactory.newPlatformMXBeanProxy( - server, - "com.sun.management:type=HotSpotDiagnostic", - HotSpotDiagnosticMXBean::class.java - ).dumpHeap(path.toString(), true) - return path.toAbsolutePath() - } -} diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/symbols/AbstractSymbolByFqNameTest.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/symbols/AbstractSymbolByFqNameTest.kt index 4dde7c35018..0833a308a18 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/symbols/AbstractSymbolByFqNameTest.kt +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/symbols/AbstractSymbolByFqNameTest.kt @@ -7,12 +7,24 @@ package org.jetbrains.kotlin.idea.fir.frontend.api.symbols import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession import org.jetbrains.kotlin.idea.fir.frontend.api.SymbolByFqName -import org.jetbrains.kotlin.idea.fir.test.framework.TestFileStructure import org.jetbrains.kotlin.idea.frontend.api.symbols.KtSymbol +import org.jetbrains.kotlin.psi.KtFile +import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder +import org.jetbrains.kotlin.test.directives.JvmEnvironmentConfigurationDirectives +import org.jetbrains.kotlin.test.services.TestServices abstract class AbstractSymbolByFqNameTest : AbstractSymbolTest() { - override fun KtAnalysisSession.collectSymbols(fileStructure: TestFileStructure): List { - val symbolData = SymbolByFqName.getSymbolDataFromFile(fileStructure.filePath) + override fun KtAnalysisSession.collectSymbols(ktFile: KtFile, testServices: TestServices): List { + val symbolData = SymbolByFqName.getSymbolDataFromFile(testDataPath) return with(symbolData) { toSymbols() } } + + override fun configureTest(builder: TestConfigurationBuilder) { + super.configureTest(builder) + with(builder) { + defaultDirectives { + +JvmEnvironmentConfigurationDirectives.WITH_STDLIB + } + } + } } \ No newline at end of file diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/symbols/AbstractSymbolByPsiTest.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/symbols/AbstractSymbolByPsiTest.kt index b22b6cf7608..10ad09f86ea 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/symbols/AbstractSymbolByPsiTest.kt +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/symbols/AbstractSymbolByPsiTest.kt @@ -6,14 +6,16 @@ package org.jetbrains.kotlin.idea.fir.frontend.api.symbols import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession -import org.jetbrains.kotlin.idea.fir.test.framework.TestFileStructure import org.jetbrains.kotlin.idea.frontend.api.symbols.KtSymbol import org.jetbrains.kotlin.psi.KtDeclaration +import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.psi.psiUtil.collectDescendantsOfType +import org.jetbrains.kotlin.test.services.TestServices abstract class AbstractSymbolByPsiTest : AbstractSymbolTest() { - override fun KtAnalysisSession.collectSymbols(fileStructure: TestFileStructure): List = - fileStructure.mainKtFile.collectDescendantsOfType().map { declaration -> + override fun KtAnalysisSession.collectSymbols(ktFile: KtFile, testServices: TestServices): List { + return ktFile.collectDescendantsOfType().map { declaration -> declaration.getSymbol() } + } } \ No newline at end of file diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/symbols/AbstractSymbolByReferenceTest.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/symbols/AbstractSymbolByReferenceTest.kt index 6d541c9d496..64fd576c3b1 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/symbols/AbstractSymbolByReferenceTest.kt +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/symbols/AbstractSymbolByReferenceTest.kt @@ -5,15 +5,17 @@ package org.jetbrains.kotlin.idea.fir.frontend.api.symbols +import org.jetbrains.kotlin.idea.fir.test.framework.expressionMarkerProvider import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession -import org.jetbrains.kotlin.idea.references.mainReference -import org.jetbrains.kotlin.idea.fir.test.framework.TestFileStructure import org.jetbrains.kotlin.idea.frontend.api.symbols.KtSymbol +import org.jetbrains.kotlin.idea.references.mainReference +import org.jetbrains.kotlin.psi.KtFile import org.jetbrains.kotlin.psi.KtNameReferenceExpression +import org.jetbrains.kotlin.test.services.TestServices abstract class AbstractSymbolByReferenceTest : AbstractSymbolTest() { - override fun KtAnalysisSession.collectSymbols(fileStructure: TestFileStructure): List { - val referenceExpression = getElementOfTypeAtCaret() + override fun KtAnalysisSession.collectSymbols(ktFile: KtFile, testServices: TestServices): List { + val referenceExpression = testServices.expressionMarkerProvider.getElementOfTypAtCaret(ktFile) return listOfNotNull(referenceExpression.mainReference.resolveToSymbol()) } } \ No newline at end of file diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/symbols/AbstractSymbolTest.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/symbols/AbstractSymbolTest.kt index 173310ccf2f..e7dfa595c17 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/symbols/AbstractSymbolTest.kt +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/symbols/AbstractSymbolTest.kt @@ -5,29 +5,24 @@ package org.jetbrains.kotlin.idea.fir.frontend.api.symbols -import com.intellij.openapi.application.runWriteAction -import com.intellij.openapi.command.CommandProcessor -import com.intellij.openapi.editor.Document -import com.intellij.psi.PsiDocumentManager import org.jetbrains.kotlin.idea.fir.analyseOnPooledThreadInReadAction -import org.jetbrains.kotlin.idea.fir.test.framework.* +import org.jetbrains.kotlin.idea.fir.test.framework.AbstractKtIdeaTestWithSingleTestFileTest import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession import org.jetbrains.kotlin.idea.frontend.api.symbols.DebugSymbolRenderer import org.jetbrains.kotlin.idea.frontend.api.symbols.KtSymbol import org.jetbrains.kotlin.idea.frontend.api.symbols.pointers.KtSymbolPointer import org.jetbrains.kotlin.psi.KtFile -import org.jetbrains.kotlin.psi.KtPsiFactory -import org.jetbrains.kotlin.test.KotlinTestUtils +import org.jetbrains.kotlin.test.services.TestModuleStructure +import org.jetbrains.kotlin.test.services.TestServices +import org.jetbrains.kotlin.test.services.assertions -abstract class AbstractSymbolTest : AbstractKtIdeaTest() { - abstract fun KtAnalysisSession.collectSymbols(fileStructure: TestFileStructure): List +abstract class AbstractSymbolTest : AbstractKtIdeaTestWithSingleTestFileTest() { + abstract fun KtAnalysisSession.collectSymbols(ktFile: KtFile, testServices: TestServices): List - override val allowedDirectives: List> = listOf(DIRECTIVES.DO_NOT_CHECK_SYMBOL_RESTORE) - - override fun doTestByFileStructure(fileStructure: TestFileStructure) { - val createPointers = !fileStructure.directives.isDirectivePresent(DIRECTIVES.DO_NOT_CHECK_SYMBOL_RESTORE) - val pointersWithRendered = analyseOnPooledThreadInReadAction(fileStructure.mainKtFile) { - collectSymbols(fileStructure).map { symbol -> + override fun doTestByFileStructure(ktFile: KtFile, moduleStructure: TestModuleStructure, testServices: TestServices) { + val createPointers = false //TODO !fileStructure.directives.isDirectivePresent(DIRECTIVES.DO_NOT_CHECK_SYMBOL_RESTORE) + val pointersWithRendered = analyseOnPooledThreadInReadAction(ktFile) { + collectSymbols(ktFile, testServices).map { symbol -> PointerWithRenderedSymbol( if (createPointers) symbol.createPointer() else null, DebugSymbolRenderer.render(symbol) @@ -35,69 +30,42 @@ abstract class AbstractSymbolTest : AbstractKtIdeaTest() { } } - compareResults(fileStructure, pointersWithRendered) + compareResults(pointersWithRendered, testServices) + + doOutOfBlockModification(ktFile) - doOutOfBlockModification(fileStructure.mainKtFile) if (createPointers) { - restoreSymbolsInOtherReadActionAndCompareResults(fileStructure, pointersWithRendered) + restoreSymbolsInOtherReadActionAndCompareResults(ktFile, pointersWithRendered, testServices) } } private fun compareResults( - fileStructure: TestFileStructure, - pointersWithRendered: List + pointersWithRendered: List, + testServices: TestServices, ) { - val actual = TestStructureRenderer.render( - fileStructure, - TestStructureExpectedDataBlock(values = pointersWithRendered.map { it.rendered }), - renderingMode = TestStructureRenderer.RenderingMode.ALL_BLOCKS_IN_MULTI_LINE_COMMENT, - ) - - KotlinTestUtils.assertEqualsToFile(fileStructure.filePath.toFile(), actual) + val actual = pointersWithRendered.joinToString(separator = "\n") { it.rendered } + testServices.assertions.assertEqualsToFile(testDataFileSibling(".txt"), actual) } private fun restoreSymbolsInOtherReadActionAndCompareResults( - fileStructure: TestFileStructure, - pointersWithRendered: List + ktFile: KtFile, + pointersWithRendered: List, + testServices: TestServices, ) { - val restored = analyseOnPooledThreadInReadAction(fileStructure.mainKtFile) { + val restored = analyseOnPooledThreadInReadAction(ktFile) { pointersWithRendered.map { (pointer, expectedRender) -> val restored = pointer!!.restoreSymbol() ?: error("Symbol $expectedRender was not not restored") DebugSymbolRenderer.render(restored) } } - val actualRestored = TestStructureRenderer.render( - fileStructure, - TestStructureExpectedDataBlock(values = restored), - renderingMode = TestStructureRenderer.RenderingMode.ALL_BLOCKS_IN_MULTI_LINE_COMMENT, - ) - - KotlinTestUtils.assertEqualsToFile(fileStructure.filePath.toFile(), actualRestored) + val actual = restored.joinToString(separator = "\n") + testServices.assertions.assertEqualsToFile(testDataFileSibling(".txt"), actual) } private fun doOutOfBlockModification(ktFile: KtFile) { - CommandProcessor.getInstance().runUndoTransparentAction { - runWriteAction { - val document = PsiDocumentManager.getInstance(project).getDocument(ktFile) ?: error("Cannot find document for ktFile") - val initialText = ktFile.text - val ktPsiFactory = KtPsiFactory(ktFile) - ktFile.add(ktPsiFactory.createNewLine(lineBreaks = 2)) - ktFile.add(ktPsiFactory.createProperty("val aaaaaa: Int = 10")) - commitDocument(document) - document.setText(initialText) - commitDocument(document) - } - } - } - - private fun commitDocument(document: Document) { - PsiDocumentManager.getInstance(project).commitDocument(document) - } - - private object DIRECTIVES { - val DO_NOT_CHECK_SYMBOL_RESTORE = PresenceDirective("// DO_NOT_CHECK_SYMBOL_RESTORE") + //TODO } } diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/symbols/MemoryLeakInSymbolsTestGenerated.java b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/symbols/MemoryLeakInSymbolsTestGenerated.java deleted file mode 100644 index 5f901eeab11..00000000000 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/symbols/MemoryLeakInSymbolsTestGenerated.java +++ /dev/null @@ -1,36 +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.idea.fir.frontend.api.symbols; - -import com.intellij.testFramework.TestDataPath; -import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; -import org.jetbrains.kotlin.test.KotlinTestUtils; -import org.jetbrains.kotlin.test.util.KtTestUtil; -import org.jetbrains.kotlin.test.TestMetadata; -import org.junit.runner.RunWith; - -import java.io.File; -import java.util.regex.Pattern; - -/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ -@SuppressWarnings("all") -@TestMetadata("idea/idea-frontend-fir/testData/symbolMemoryLeak") -@TestDataPath("$PROJECT_ROOT") -@RunWith(JUnit3RunnerWithInners.class) -public class MemoryLeakInSymbolsTestGenerated extends AbstractMemoryLeakInSymbolsTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - - public void testAllFilesPresentInSymbolMemoryLeak() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-frontend-fir/testData/symbolMemoryLeak"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - - @TestMetadata("symbols.kt") - public void testSymbols() throws Exception { - runTest("idea/idea-frontend-fir/testData/symbolMemoryLeak/symbols.kt"); - } -} diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/symbols/SymbolByFqNameTestGenerated.java b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/symbols/SymbolByFqNameTestGenerated.java index 10768d08709..4ab22c26ac4 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/symbols/SymbolByFqNameTestGenerated.java +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/symbols/SymbolByFqNameTestGenerated.java @@ -6,69 +6,73 @@ package org.jetbrains.kotlin.idea.fir.frontend.api.symbols; import com.intellij.testFramework.TestDataPath; -import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; -import org.jetbrains.kotlin.test.KotlinTestUtils; import org.jetbrains.kotlin.test.util.KtTestUtil; import org.jetbrains.kotlin.test.TestMetadata; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; import java.io.File; import java.util.regex.Pattern; -/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */ @SuppressWarnings("all") @TestMetadata("idea/idea-frontend-fir/testData/symbols/symbolByFqName") @TestDataPath("$PROJECT_ROOT") -@RunWith(JUnit3RunnerWithInners.class) public class SymbolByFqNameTestGenerated extends AbstractSymbolByFqNameTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - + @Test public void testAllFilesPresentInSymbolByFqName() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-frontend-fir/testData/symbols/symbolByFqName"), Pattern.compile("^(.+)\\.kt$"), null, true); } + @Test @TestMetadata("class.kt") public void testClass() throws Exception { runTest("idea/idea-frontend-fir/testData/symbols/symbolByFqName/class.kt"); } + @Test @TestMetadata("classFromJdk.kt") public void testClassFromJdk() throws Exception { runTest("idea/idea-frontend-fir/testData/symbols/symbolByFqName/classFromJdk.kt"); } + @Test @TestMetadata("enumEntry.kt") public void testEnumEntry() throws Exception { runTest("idea/idea-frontend-fir/testData/symbols/symbolByFqName/enumEntry.kt"); } + @Test @TestMetadata("fileWalkDirectionEnum.kt") public void testFileWalkDirectionEnum() throws Exception { runTest("idea/idea-frontend-fir/testData/symbols/symbolByFqName/fileWalkDirectionEnum.kt"); } + @Test @TestMetadata("iterator.kt") public void testIterator() throws Exception { runTest("idea/idea-frontend-fir/testData/symbols/symbolByFqName/iterator.kt"); } + @Test @TestMetadata("listOf.kt") public void testListOf() throws Exception { runTest("idea/idea-frontend-fir/testData/symbols/symbolByFqName/listOf.kt"); } + @Test @TestMetadata("memberFunction.kt") public void testMemberFunction() throws Exception { runTest("idea/idea-frontend-fir/testData/symbols/symbolByFqName/memberFunction.kt"); } + @Test @TestMetadata("memberFunctionWithOverloads.kt") public void testMemberFunctionWithOverloads() throws Exception { runTest("idea/idea-frontend-fir/testData/symbols/symbolByFqName/memberFunctionWithOverloads.kt"); } + @Test @TestMetadata("nestedClass.kt") public void testNestedClass() throws Exception { runTest("idea/idea-frontend-fir/testData/symbols/symbolByFqName/nestedClass.kt"); diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/symbols/SymbolByPsiTestGenerated.java b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/symbols/SymbolByPsiTestGenerated.java index 41398539f22..c9d81526c50 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/symbols/SymbolByPsiTestGenerated.java +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/symbols/SymbolByPsiTestGenerated.java @@ -6,124 +6,139 @@ package org.jetbrains.kotlin.idea.fir.frontend.api.symbols; import com.intellij.testFramework.TestDataPath; -import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; -import org.jetbrains.kotlin.test.KotlinTestUtils; import org.jetbrains.kotlin.test.util.KtTestUtil; import org.jetbrains.kotlin.test.TestMetadata; -import org.junit.runner.RunWith; +import org.junit.jupiter.api.Nested; +import org.junit.jupiter.api.Test; import java.io.File; import java.util.regex.Pattern; -/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +/** This class is generated by {@link GenerateNewCompilerTests.kt}. DO NOT MODIFY MANUALLY */ @SuppressWarnings("all") @TestMetadata("idea/idea-frontend-fir/testData/symbols/symbolByPsi") @TestDataPath("$PROJECT_ROOT") -@RunWith(JUnit3RunnerWithInners.class) public class SymbolByPsiTestGenerated extends AbstractSymbolByPsiTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - + @Test public void testAllFilesPresentInSymbolByPsi() throws Exception { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-frontend-fir/testData/symbols/symbolByPsi"), Pattern.compile("^(.+)\\.kt$"), null, true); } + @Test @TestMetadata("annotations.kt") public void testAnnotations() throws Exception { runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/annotations.kt"); } + @Test @TestMetadata("anonymousObject.kt") public void testAnonymousObject() throws Exception { runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/anonymousObject.kt"); } + @Test @TestMetadata("class.kt") public void testClass() throws Exception { runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/class.kt"); } + @Test @TestMetadata("classMembes.kt") public void testClassMembes() throws Exception { runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/classMembes.kt"); } + @Test @TestMetadata("classPrimaryConstructor.kt") public void testClassPrimaryConstructor() throws Exception { runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/classPrimaryConstructor.kt"); } + @Test @TestMetadata("classSecondaryConstructors.kt") public void testClassSecondaryConstructors() throws Exception { runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/classSecondaryConstructors.kt"); } + @Test @TestMetadata("classWithTypeParams.kt") public void testClassWithTypeParams() throws Exception { runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/classWithTypeParams.kt"); } + @Test @TestMetadata("enum.kt") public void testEnum() throws Exception { runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/enum.kt"); } + @Test @TestMetadata("extensionFunction.kt") public void testExtensionFunction() throws Exception { runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/extensionFunction.kt"); } + @Test @TestMetadata("function.kt") public void testFunction() throws Exception { runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/function.kt"); } + @Test @TestMetadata("functionWithTypeParams.kt") public void testFunctionWithTypeParams() throws Exception { runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/functionWithTypeParams.kt"); } + @Test @TestMetadata("implicitReturn.kt") public void testImplicitReturn() throws Exception { runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/implicitReturn.kt"); } + @Test @TestMetadata("localDeclarations.kt") public void testLocalDeclarations() throws Exception { runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/localDeclarations.kt"); } + @Test @TestMetadata("memberFunctions.kt") public void testMemberFunctions() throws Exception { runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/memberFunctions.kt"); } + @Test @TestMetadata("memberProperties.kt") public void testMemberProperties() throws Exception { runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/memberProperties.kt"); } + @Test @TestMetadata("outerAndInnerClasses.kt") public void testOuterAndInnerClasses() throws Exception { runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/outerAndInnerClasses.kt"); } + @Test @TestMetadata("topLevelFunctions.kt") public void testTopLevelFunctions() throws Exception { runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/topLevelFunctions.kt"); } + @Test @TestMetadata("topLevelProperties.kt") public void testTopLevelProperties() throws Exception { runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/topLevelProperties.kt"); } + @Test @TestMetadata("typeAlias.kt") public void testTypeAlias() throws Exception { runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/typeAlias.kt"); } + @Test @TestMetadata("typeAnnotations.kt") public void testTypeAnnotations() throws Exception { runTest("idea/idea-frontend-fir/testData/symbols/symbolByPsi/typeAnnotations.kt"); diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/symbols/SymbolByReferenceTestGenerated.java b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/symbols/SymbolByReferenceTestGenerated.java deleted file mode 100644 index 5f08df4f3b1..00000000000 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/symbols/SymbolByReferenceTestGenerated.java +++ /dev/null @@ -1,41 +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.idea.fir.frontend.api.symbols; - -import com.intellij.testFramework.TestDataPath; -import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; -import org.jetbrains.kotlin.test.KotlinTestUtils; -import org.jetbrains.kotlin.test.util.KtTestUtil; -import org.jetbrains.kotlin.test.TestMetadata; -import org.junit.runner.RunWith; - -import java.io.File; -import java.util.regex.Pattern; - -/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ -@SuppressWarnings("all") -@TestMetadata("idea/idea-frontend-fir/testData/symbols/symbolByReference") -@TestDataPath("$PROJECT_ROOT") -@RunWith(JUnit3RunnerWithInners.class) -public class SymbolByReferenceTestGenerated extends AbstractSymbolByReferenceTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - - @TestMetadata("accessorField.kt") - public void testAccessorField() throws Exception { - runTest("idea/idea-frontend-fir/testData/symbols/symbolByReference/accessorField.kt"); - } - - public void testAllFilesPresentInSymbolByReference() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("idea/idea-frontend-fir/testData/symbols/symbolByReference"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - - @TestMetadata("constructorViaTypeAlias.kt") - public void testConstructorViaTypeAlias() throws Exception { - runTest("idea/idea-frontend-fir/testData/symbols/symbolByReference/constructorViaTypeAlias.kt"); - } -} diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/types/KtTypeRendererTest.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/types/KtTypeRendererTest.kt deleted file mode 100644 index a346927ace9..00000000000 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/frontend/api/types/KtTypeRendererTest.kt +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright 2010-2020 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.idea.fir.frontend.api.types - -import com.intellij.testFramework.LightProjectDescriptor -import org.jetbrains.kotlin.idea.fir.executeOnPooledThreadInReadAction -import org.jetbrains.kotlin.idea.frontend.api.analyse -import org.jetbrains.kotlin.idea.frontend.api.components.KtTypeRendererOptions -import org.jetbrains.kotlin.idea.fir.invalidateCaches -import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase -import org.jetbrains.kotlin.idea.test.KotlinWithJdkAndRuntimeLightProjectDescriptor -import org.jetbrains.kotlin.psi.KtFile -import org.jetbrains.kotlin.psi.KtFunction -import org.jetbrains.kotlin.psi.KtProperty - -class KtTypeRendererTest : KotlinLightCodeInsightFixtureTestCase() { - override fun isFirPlugin() = true - - override fun tearDown() { - project.invalidateCaches(file as? KtFile) - super.tearDown() - } - - private fun doTestByTypeText( - type: String, - expected: String, - typeArguments: List = emptyList(), - rendererOptions: KtTypeRendererOptions = KtTypeRendererOptions.DEFAULT, - ) { - val typeArgumentsRendered = typeArguments - .takeIf { it.isNotEmpty() } - ?.joinToString(prefix = "<", postfix = ">") - .orEmpty() - val fakeKtFile = myFixture.configureByText("file.kt", "fun ${typeArgumentsRendered}foo(): $type = 1") as KtFile - val property = fakeKtFile.declarations.single() as KtFunction - val renderedType = executeOnPooledThreadInReadAction { - analyse(fakeKtFile) { - val ktType = property.getReturnKtType() - ktType.render(rendererOptions) - } - } - assertEquals(expected, renderedType) - } - - private fun doTestByExpression( - expression: String, - expected: String, - rendererOptions: KtTypeRendererOptions = KtTypeRendererOptions.DEFAULT, - ) { - val fakeKtFile = myFixture.configureByText("file.kt", "val a = $expression") as KtFile - val property = fakeKtFile.declarations.single() as KtProperty - val renderedType = executeOnPooledThreadInReadAction { - analyse(fakeKtFile) { - val ktType = property.initializer?.getKtType() - ?: error("fake property should have initializer") - ktType.render(rendererOptions) - } - } - assertEquals(expected, renderedType) - } - - override fun getProjectDescriptor(): LightProjectDescriptor = KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE - - fun testInt() { - doTestByTypeText(type = "Int", expected = "kotlin.Int") - } - - fun testList() { - doTestByTypeText(type = "List", expected = "kotlin.collections.List") - } - - fun testTypeArguments() { - doTestByTypeText(type = "Map", expected = "kotlin.collections.Map", typeArguments = listOf("V")) - } - - fun testNullable() { - doTestByTypeText( - type = "Map, V?>?", - expected = "kotlin.collections.Map, V?>?", - typeArguments = listOf("V") - ) - } - - fun testNoFqNames() { - doTestByTypeText( - type = "Map, V?>?", - expected = "Map, V?>?", - typeArguments = listOf("V"), - rendererOptions = KtTypeRendererOptions.SHORT_NAMES - ) - } - - fun testFlexibleType() { - doTestByExpression( - expression = "java.lang.String.CASE_INSENSITIVE_ORDER", - expected = "Comparator!", - rendererOptions = KtTypeRendererOptions.SHORT_NAMES - ) - } - - fun testFunctionalType() { - doTestByTypeText( - type = "(String, Int?) -> Long", - expected = "(String, Int?) -> Long", - rendererOptions = KtTypeRendererOptions.SHORT_NAMES - ) - } - - fun testNullableFunctionalType() { - doTestByTypeText( - type = "((String, Int?) -> Long)?", - expected = "((String, Int?) -> Long)?", - rendererOptions = KtTypeRendererOptions.SHORT_NAMES - ) - } - - fun testFunctionalTypeNoArguments() { - doTestByTypeText( - type = "() -> Long", - expected = "() -> Long", - rendererOptions = KtTypeRendererOptions.SHORT_NAMES - ) - } - - fun testFunctionalTypeReceiver() { - doTestByTypeText( - type = "Int.(String) -> Long", - expected = "Int.(String) -> Long", - rendererOptions = KtTypeRendererOptions.SHORT_NAMES - ) - } - - fun testFunctionalTypeUnitReturnType() { - doTestByTypeText( - type = "(String) -> Unit", - expected = "(String) -> Unit", - rendererOptions = KtTypeRendererOptions.SHORT_NAMES - ) - } - - fun testFunctionalTypeRenderAsUsualClassType() { - doTestByTypeText( - type = "Int.(String, Long) -> Char", - expected = "Function3", - rendererOptions = KtTypeRendererOptions.SHORT_NAMES.copy(renderFunctionType = false) - ) - } - - fun testIntersectionType() { - doTestByExpression( - expression = """ - run { - val x: Any = 10 - if (x is String && x is Int) x else null - }""".trimIndent(), - expected = "(String?&Int?)", - rendererOptions = KtTypeRendererOptions.SHORT_NAMES - ) - } -} \ No newline at end of file diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/test/framework/AbstractKtIdeaTest.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/test/framework/AbstractKtIdeaTest.kt index 36d392b35ff..3c013598a88 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/test/framework/AbstractKtIdeaTest.kt +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/test/framework/AbstractKtIdeaTest.kt @@ -5,96 +5,116 @@ package org.jetbrains.kotlin.idea.fir.test.framework -import com.intellij.openapi.util.io.FileUtil -import com.intellij.psi.PsiElement -import com.intellij.psi.util.parentOfType -import org.jetbrains.kotlin.idea.fir.test.framework.SelectedExpressionProvider -import org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase +import com.intellij.mock.MockProject +import com.intellij.psi.PsiElementFinder +import org.jetbrains.kotlin.asJava.finder.JavaElementFinder +import org.jetbrains.kotlin.fir.session.FirModuleInfoBasedModuleData +import org.jetbrains.kotlin.idea.fir.low.level.api.compiler.based.FirModuleResolveStateConfiguratorForSingleModuleTestImpl +import org.jetbrains.kotlin.idea.fir.low.level.api.compiler.based.TestModuleInfo +import org.jetbrains.kotlin.idea.fir.low.level.api.compiler.based.registerTestServices import org.jetbrains.kotlin.idea.fir.test.framework.* -import org.jetbrains.kotlin.psi.KtDeclaration +import org.jetbrains.kotlin.idea.frontend.api.InvalidWayOfUsingAnalysisSession +import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSessionProvider +import org.jetbrains.kotlin.idea.frontend.api.fir.KtFirAnalysisSessionProvider +import org.jetbrains.kotlin.platform.jvm.JvmPlatforms import org.jetbrains.kotlin.psi.KtFile -import java.io.File +import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder +import org.jetbrains.kotlin.test.builders.testConfiguration +import org.jetbrains.kotlin.test.frontend.fir.FirModuleInfoProvider +import org.jetbrains.kotlin.test.frontend.fir.firModuleInfoProvider +import org.jetbrains.kotlin.test.model.DependencyKind +import org.jetbrains.kotlin.test.model.FrontendKinds +import org.jetbrains.kotlin.test.services.* +import org.jetbrains.kotlin.test.services.configuration.CommonEnvironmentConfigurator +import org.jetbrains.kotlin.test.services.configuration.JvmEnvironmentConfigurator +import org.jetbrains.kotlin.test.services.impl.TemporaryDirectoryManagerImpl +import org.junit.jupiter.api.BeforeEach +import org.junit.jupiter.api.TestInfo +import java.nio.file.Path +import java.nio.file.Paths +import kotlin.io.path.nameWithoutExtension -abstract class AbstractKtIdeaTest : KotlinLightCodeInsightFixtureTestCase() { - protected open val allowedDirectives: List> = emptyList() +abstract class AbstractKtIdeaTest { + private lateinit var testInfo: KotlinTestInfo - protected fun doTest(path: String) { - val testDataFile = File(path) - val text = FileUtil.loadFile(testDataFile) - val testFileStructure = createTestFileStructure(text, testDataFile) - doTestByFileStructure(testFileStructure) + private val configure: TestConfigurationBuilder.() -> Unit = { + globalDefaults { + frontend = FrontendKinds.FIR + targetPlatform = JvmPlatforms.defaultJvmPlatform + dependencyKind = DependencyKind.Source + } + useConfigurators( + ::CommonEnvironmentConfigurator, + ::JvmEnvironmentConfigurator, + ) + assertions = JUnit5Assertions + useAdditionalService(::TemporaryDirectoryManagerImpl) + + useSourcePreprocessor(::ExpressionMarkersSourceFilePreprocessor) + useAdditionalService(::ExpressionMarkerProvider) + useAdditionalService(::FirModuleInfoProvider) + + configureTest(this) + + this.testInfo = this@AbstractKtIdeaTest.testInfo } - private fun createTestFileStructure(text: String, testDataFile: File): TestFileStructure { - val files = FileSplitter.splitIntoFiles(text, testDataFile.name) - val mainFile = createTestFile(files.first(), isMainFile = true) - val testFiles = files.drop(1).map { file -> - createTestFile(file, isMainFile = false) + protected lateinit var testDataPath: Path + + protected fun testDataFileSibling(extension: String): Path { + val extensionWithDot = "." + extension.removePrefix(".") + return testDataPath.resolveSibling(testDataPath.nameWithoutExtension + extensionWithDot) + } + + open fun configureTest(builder: TestConfigurationBuilder) {} + + + @OptIn(InvalidWayOfUsingAnalysisSession::class) + protected fun runTest(path: String) { + testDataPath = Paths.get(path) + val testConfiguration = testConfiguration(path, configure) + val testServices = testConfiguration.testServices + val moduleStructure = testConfiguration.moduleStructureExtractor.splitTestDataByModules( + path, + testConfiguration.directives, + ).also { + testConfiguration.testServices.register(TestModuleStructure::class, it) } - val directives = parseDirectives(text) - return TestFileStructure( - filePath = testDataFile.toPath(), - caretPosition = getCaretPosition(text), - directives = directives, - mainFile = mainFile as TestFile.KtTestRootFile, - otherFiles = testFiles + + val singleModule = moduleStructure.modules.single() + val project = testServices.compilerConfigurationProvider.getProject(singleModule) + val ktFiles = testServices.sourceFileProvider.getKtFilesForSourceFiles(singleModule.files, project) + + PsiElementFinder.EP.getPoint(project).unregisterExtension(JavaElementFinder::class.java) + + val moduleInfo = TestModuleInfo(singleModule) + testServices.firModuleInfoProvider.registerModuleData(singleModule, FirModuleInfoBasedModuleData(moduleInfo)) + val configurator = FirModuleResolveStateConfiguratorForSingleModuleTestImpl(testServices, singleModule, ktFiles, moduleInfo) + + with(project as MockProject) { + registerTestServices(configurator, ktFiles) + registerService(KtAnalysisSessionProvider::class.java, KtFirAnalysisSessionProvider::class.java) + } + + doTestByFileStructure(ktFiles.values.toList(), moduleStructure, testServices) + } + + abstract fun doTestByFileStructure(ktFiles: List, moduleStructure: TestModuleStructure, testServices: TestServices) + + @BeforeEach + fun initTestInfo(testInfo: TestInfo) { + this.testInfo = KotlinTestInfo( + className = testInfo.testClass.orElseGet(null)?.name ?: "_undefined_", + methodName = testInfo.testMethod.orElseGet(null)?.name ?: "_testUndefined_", + tags = testInfo.tags ) } - private fun getCaretPosition(text: String) = text.indexOfOrNull(KtTest.CARET_SYMBOL) - - private fun parseDirectives(text: String): TestFileDirectives { - val directives = text.lineSequence().mapNotNull(::extractDirectiveIfAny) - return TestFileDirectives(directives.toMap()) - } - - private fun extractDirectiveIfAny(line: String): Pair? { - val directive = allowedDirectives.firstOrNull { directive -> line.startsWith(directive.name) } ?: return null - val value = line.substringAfter(directive.name).trim() - val parsedValue = directive.parse(value) - ?: error("Invalid ${directive.name} value `$value`") - return directive.name to parsedValue - } - - private fun createTestFile(file: FileSplitter.FileNameWithText, isMainFile: Boolean): TestFile { - return if (isMainFile) { - val (ktFile, expression) = SelectedExpressionProvider.getFileWithSelectedExpressions(file.text) { - myFixture.configureByText(file.name, it) as KtFile - } - TestFile.KtTestRootFile(ktFile, expression) - } else { - TestFile.createByPsiFile(myFixture.addFileToProject(file.name, file.text)) - } - } - - protected inline fun getElementOfTypeAtCaret(): P = - file.findElementAt(myFixture.caretOffset) - ?.parentOfType

() - ?: error("No ${P::class.simpleName} found at caret with position ${myFixture.caretOffset}") - - abstract fun doTestByFileStructure(fileStructure: TestFileStructure) + protected fun getCaretPosition(text: String) = text.indexOfOrNull(KtTest.CARET_SYMBOL) } -private object FileSplitter { - data class FileNameWithText(val name: String, val text: String) - fun splitIntoFiles(text: String, defaultName: String): List { - val result = mutableListOf() - val stopAt = text.indexOfOrNull(KtTest.RESULT_DIRECTIVE) ?: text.length - var index = text.indexOfOrNull(KtTest.FILE_DIRECTIVE) ?: return listOf(FileNameWithText(defaultName, text.substring(0, stopAt).trim())) - while (index < stopAt) { - val eolIndex = text.indexOfOrNull("\n", index) ?: text.length - val fileName = text.substring(index + KtTest.FILE_DIRECTIVE.length, eolIndex).trim() - val nextFileIndex = text.indexOfOrNull(KtTest.FILE_DIRECTIVE, index + 1) ?: stopAt - val fileText = text.substring(eolIndex, nextFileIndex).trim() - index = nextFileIndex - result += FileNameWithText(fileName, fileText) - } - return result - } -} - -private fun String.indexOfOrNull(substring: String) = +fun String.indexOfOrNull(substring: String) = indexOf(substring).takeIf { it >= 0 } private fun String.indexOfOrNull(substring: String, startingIndex: Int) = diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/test/framework/AbstractKtIdeaTestWithSingleTestFileTest.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/test/framework/AbstractKtIdeaTestWithSingleTestFileTest.kt new file mode 100644 index 00000000000..390a8556e0d --- /dev/null +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/test/framework/AbstractKtIdeaTestWithSingleTestFileTest.kt @@ -0,0 +1,18 @@ +/* + * 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.idea.fir.test.framework + +import org.jetbrains.kotlin.psi.KtFile +import org.jetbrains.kotlin.test.services.TestModuleStructure +import org.jetbrains.kotlin.test.services.TestServices + +abstract class AbstractKtIdeaTestWithSingleTestFileTest : AbstractKtSingleModuleTest() { + final override fun doTestByFileStructure(ktFiles: List, moduleStructure: TestModuleStructure, testServices: TestServices) { + doTestByFileStructure(ktFiles.first(), moduleStructure, testServices) + } + + abstract fun doTestByFileStructure(ktFile: KtFile, moduleStructure: TestModuleStructure, testServices: TestServices) +} \ No newline at end of file diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/test/framework/AbstractKtSingleModuleTest.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/test/framework/AbstractKtSingleModuleTest.kt new file mode 100644 index 00000000000..36055f4eeb6 --- /dev/null +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/test/framework/AbstractKtSingleModuleTest.kt @@ -0,0 +1,8 @@ +/* + * 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.idea.fir.test.framework + +abstract class AbstractKtSingleModuleTest : AbstractKtIdeaTest() \ No newline at end of file diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/test/framework/ExpressionMarkersSourceFilePreprocessor.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/test/framework/ExpressionMarkersSourceFilePreprocessor.kt new file mode 100644 index 00000000000..45603ff75ea --- /dev/null +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/test/framework/ExpressionMarkersSourceFilePreprocessor.kt @@ -0,0 +1,87 @@ +/* + * 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.idea.fir.test.framework + +import com.intellij.openapi.util.TextRange +import org.jetbrains.kotlin.idea.fir.low.level.api.util.parentOfType +import org.jetbrains.kotlin.psi.KtElement +import org.jetbrains.kotlin.psi.KtFile +import org.jetbrains.kotlin.psi.psiUtil.elementsInRange +import org.jetbrains.kotlin.test.model.TestFile +import org.jetbrains.kotlin.test.services.SourceFilePreprocessor +import org.jetbrains.kotlin.test.services.TestService +import org.jetbrains.kotlin.test.services.TestServices + +internal class ExpressionMarkersSourceFilePreprocessor(testServices: TestServices) : SourceFilePreprocessor(testServices) { + override fun process(file: TestFile, content: String): String { + val withSelectedProcessed = processSelectedExpression(file, content) + return processCaretExpression(file, withSelectedProcessed) + } + + private fun processSelectedExpression(file: TestFile, content: String): String { + val startCaretPosition = content.indexOfOrNull(TAGS.OPENING_EXPRESSION_TAG) ?: return content + + val endCaretPosition = content.indexOfOrNull(TAGS.CLOSING_EXPRESSION_TAG) + ?: error("${TAGS.CLOSING_EXPRESSION_TAG} was not found in the file") + + check(startCaretPosition < endCaretPosition) + testServices.expressionMarkerProvider.addSelectedExpression( + file, + TextRange.create(startCaretPosition, endCaretPosition - TAGS.OPENING_EXPRESSION_TAG.length) + ) + return content + .replace(TAGS.OPENING_EXPRESSION_TAG, "") + .replace(TAGS.CLOSING_EXPRESSION_TAG, "") + } + + private fun processCaretExpression(file: TestFile, content: String): String { + val startCaretPosition = content.indexOfOrNull(TAGS.CARET) ?: return content + + testServices.expressionMarkerProvider.addCaret(file, startCaretPosition) + return content + .replace(TAGS.CARET, "") + } + + object TAGS { + const val OPENING_EXPRESSION_TAG = "" + const val CLOSING_EXPRESSION_TAG = "" + const val CARET = "" + } +} + +internal class ExpressionMarkerProvider(testServices: TestServices) : TestService { + private val selected = mutableMapOf() + private val atCaret = mutableMapOf() + + fun addSelectedExpression(file: TestFile, range: TextRange) { + selected[file.relativePath] = range + } + + fun addCaret(file: TestFile, caret: Int) { + atCaret[file.relativePath] = caret + } + + inline fun getElementOfTypAtCaret(file: KtFile): P { + val offset = atCaret[file.name] + ?: error("No caret found in file") + return file.findElementAt(offset) + ?.parentOfType

() + ?: error("No expression found at caret") + } + + + fun getSelectedElement(file: KtFile): KtElement { + val range = selected[file.name] + ?: error("No selected expression found in file") + val elements = file.elementsInRange(range) + if (elements.size != 1) { + error("Expected one element at rage but found ${elements.size} [${elements.joinToString { it.text }}]") + } + return elements.single() as KtElement + } +} + +internal val TestServices.expressionMarkerProvider: ExpressionMarkerProvider by TestServices.testServiceAccessor() diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/test/framework/SelectedExpressionProvider.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/test/framework/SelectedExpressionProvider.kt deleted file mode 100644 index fcfa3762e05..00000000000 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/test/framework/SelectedExpressionProvider.kt +++ /dev/null @@ -1,41 +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.idea.fir.test.framework - -import com.intellij.openapi.util.TextRange -import org.jetbrains.kotlin.psi.KtElement -import org.jetbrains.kotlin.psi.KtFile -import org.jetbrains.kotlin.psi.psiUtil.elementsInRange - -object SelectedExpressionProvider { - fun getFileWithSelectedExpressions(fileText: String, createKtFile: (text: String) -> KtFile): KtFileWithSelectedExpression { - val fileTextWithoutTags = fileText.replace(TAGS.OPENING_EXPRESSION_TAG, "").replace(TAGS.CLOSING_EXPRESSION_TAG, "") - val ktFile = createKtFile(fileTextWithoutTags) - val selectedExpression = run { - val startCaretPosition = fileText.indexOf(TAGS.OPENING_EXPRESSION_TAG) - if (startCaretPosition < 0) { - return KtFileWithSelectedExpression(ktFile, selectedExpression = null) - } - val endCaretPosition = fileText.indexOf(TAGS.CLOSING_EXPRESSION_TAG) - if (endCaretPosition < 0) { - error("${TAGS.CLOSING_EXPRESSION_TAG} was not found in the file") - } - val elements = ktFile.elementsInRange(TextRange(startCaretPosition, endCaretPosition - TAGS.OPENING_EXPRESSION_TAG.length)) - if (elements.size != 1) { - error("Expected one element at rage but found ${elements.size} [${elements.joinToString { it.text }}]") - } - elements.single() as KtElement - } - return KtFileWithSelectedExpression(ktFile, selectedExpression) - } - - data class KtFileWithSelectedExpression(val file: KtFile, val selectedExpression: KtElement?) - - object TAGS { - const val OPENING_EXPRESSION_TAG = "" - const val CLOSING_EXPRESSION_TAG = "" - } -} \ No newline at end of file diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/test/framework/TestFileDirective.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/test/framework/TestFileDirective.kt deleted file mode 100644 index 0a93c0bc945..00000000000 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/test/framework/TestFileDirective.kt +++ /dev/null @@ -1,17 +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.idea.fir.test.framework - -import java.util.* - -abstract class TestFileDirective { - abstract val name: String - abstract fun parse(value: String): VALUE? -} - -class PresenceDirective(override val name: String) : TestFileDirective() { - override fun parse(value: String): Boolean = true -} \ No newline at end of file diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/test/framework/TestFileStructure.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/test/framework/TestFileStructure.kt deleted file mode 100644 index 107dc04ca21..00000000000 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/test/framework/TestFileStructure.kt +++ /dev/null @@ -1,62 +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.idea.fir.test.framework - -import com.intellij.psi.PsiFile -import com.intellij.psi.PsiJavaFile -import org.jetbrains.kotlin.idea.fir.test.framework.PresenceDirective -import org.jetbrains.kotlin.idea.fir.test.framework.TestFileDirective -import org.jetbrains.kotlin.psi.KtElement -import org.jetbrains.kotlin.psi.KtFile -import java.nio.file.Path - -class TestFileStructure( - val filePath: Path, - val caretPosition: Int?, - val directives: TestFileDirectives, - val mainFile: TestFile.KtTestRootFile, - val otherFiles: List, -) { - val mainKtFile: KtFile - get() = mainFile.psiFile - - val allFiles: List = listOf(mainFile) + otherFiles -} - -data class TestStructureExpectedDataBlock(val name: String? = null, val values: List) { - constructor(vararg values: String) : this(name = null, values.toList()) -} - -class TestFileDirectives( - private val directives: Map -) { - fun > getDirectiveValueIfPresent(directive: DIRECTIVE): VALUE? { - val value = directives[directive.name] ?: return null - @Suppress("UNCHECKED_CAST") - return value as VALUE - } - - fun isDirectivePresent(directive: PresenceDirective): Boolean = - directive.name in directives -} - - -sealed class TestFile { - abstract val psiFile: PsiFile - - data class KtTestFile(override val psiFile: KtFile) : TestFile() - data class KtTestRootFile(override val psiFile: KtFile, val selectedExpression: KtElement?) : TestFile() - data class JavaTestFile(override val psiFile: PsiJavaFile) : TestFile() - - companion object { - fun createByPsiFile(psiFile: PsiFile) = when (psiFile) { - is KtFile -> KtTestFile(psiFile) - is PsiJavaFile -> JavaTestFile(psiFile) - else -> error("Unknown file type ${psiFile::class}") - } - } -} - diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/test/framework/TestStructureRenderer.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/test/framework/TestStructureRenderer.kt deleted file mode 100644 index babe6f1f3bf..00000000000 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/test/framework/TestStructureRenderer.kt +++ /dev/null @@ -1,100 +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.idea.fir.test.framework - -import org.jetbrains.kotlin.idea.fir.test.framework.SelectedExpressionProvider -import org.jetbrains.kotlin.idea.fir.test.framework.KtTest -import org.jetbrains.kotlin.idea.fir.test.framework.TestFile -import org.jetbrains.kotlin.idea.fir.test.framework.TestFileStructure -import org.jetbrains.kotlin.idea.fir.test.framework.TestStructureExpectedDataBlock -import org.jetbrains.kotlin.psi.psiUtil.getStartOffsetIn - -object TestStructureRenderer { - fun render( - testStructure: TestFileStructure, - vararg expectedData: TestStructureExpectedDataBlock, - renderingMode: RenderingMode = RenderingMode.EVERY_LINE_WITH_SINGLE_LINE_COMMENT, - ): String = - render(testStructure, expectedData.toList(), renderingMode) - - fun render( - testStructure: TestFileStructure, - expectedData: List, - renderingMode: RenderingMode = RenderingMode.EVERY_LINE_WITH_SINGLE_LINE_COMMENT - ): String = buildString { - renderFiles(testStructure) - appendLine() - renderExpectedData(expectedData, renderingMode) - renderCaretSymbol(testStructure) - renderExpressionTag(testStructure) - } - - private fun StringBuilder.renderCaretSymbol(testStructure: TestFileStructure) { - testStructure.caretPosition?.let { position -> - insert(position, KtTest.CARET_SYMBOL) - } - } - - private fun StringBuilder.renderExpressionTag(testStructure: TestFileStructure) { - testStructure.mainFile.selectedExpression?.let { expression -> - val offset = expression.getStartOffsetIn(testStructure.mainKtFile) - insert(offset + expression.textLength, SelectedExpressionProvider.TAGS.CLOSING_EXPRESSION_TAG) - insert(offset, SelectedExpressionProvider.TAGS.OPENING_EXPRESSION_TAG) - } - } - - private fun StringBuilder.renderFiles(testStructure: TestFileStructure) { - if (testStructure.otherFiles.isEmpty()) { - appendLine(testStructure.mainFile.psiFile.text) - } else { - testStructure.allFiles.forEach { file -> - renderFile(file) - } - } - } - - private fun StringBuilder.renderExpectedData(expectedData: List, renderingMode: RenderingMode) { - if (expectedData.isEmpty()) return - appendLine(KtTest.RESULT_DIRECTIVE) - if (renderingMode == RenderingMode.ALL_BLOCKS_IN_MULTI_LINE_COMMENT) { - appendLine("/*") - } - expectedData.forEachIndexed { index, block -> - renderExpectedDataBlock( - block, - asSingleLineComment = renderingMode == RenderingMode.EVERY_LINE_WITH_SINGLE_LINE_COMMENT - ) - if (index != expectedData.lastIndex) { - appendLine() - } - } - if (renderingMode == RenderingMode.ALL_BLOCKS_IN_MULTI_LINE_COMMENT) { - appendLine("*/") - } - } - - private fun StringBuilder.renderExpectedDataBlock(block: TestStructureExpectedDataBlock, asSingleLineComment: Boolean) { - val singleLineCommentPrefix = if (asSingleLineComment) "// " else "" - block.name?.let { name -> appendLine("$singleLineCommentPrefix$name") } - block.values.forEachIndexed { index, value -> - appendLine("$singleLineCommentPrefix${value.trim()}") - if (index != block.values.lastIndex && !asSingleLineComment) { - appendLine() - } - } - } - - private fun StringBuilder.renderFile(file: TestFile) { - appendLine("${KtTest.FILE_DIRECTIVE} ${file.psiFile.name}") - appendLine(file.psiFile.text) - appendLine() - } - - enum class RenderingMode { - EVERY_LINE_WITH_SINGLE_LINE_COMMENT, - ALL_BLOCKS_IN_MULTI_LINE_COMMENT - } -} \ No newline at end of file diff --git a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/testUtils.kt b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/testUtils.kt index 2ca23ecc792..d6afc0f51af 100644 --- a/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/testUtils.kt +++ b/idea/idea-frontend-fir/tests/org/jetbrains/kotlin/idea/fir/testUtils.kt @@ -6,25 +6,19 @@ package org.jetbrains.kotlin.idea.fir import com.intellij.openapi.application.ApplicationManager -import com.intellij.openapi.application.runReadAction -import com.intellij.openapi.components.service -import com.intellij.openapi.project.Project -import com.intellij.openapi.util.io.FileUtil -import com.intellij.testFramework.LightPlatformTestCase -import org.jetbrains.kotlin.idea.caches.project.LibraryModificationTracker -import org.jetbrains.kotlin.idea.fir.low.level.api.api.KotlinOutOfBlockModificationTrackerFactory -import org.jetbrains.kotlin.idea.util.application.runWriteAction -import org.jetbrains.kotlin.test.InTextDirectivesUtils +import com.intellij.openapi.util.Computable import org.jetbrains.kotlin.idea.fir.low.level.api.element.builder.DuplicatedFirSourceElementsException -import org.jetbrains.kotlin.idea.fir.low.level.api.trackers.KotlinFirOutOfBlockModificationTrackerFactory -import org.jetbrains.kotlin.idea.frontend.api.InvalidWayOfUsingAnalysisSession import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSession -import org.jetbrains.kotlin.idea.frontend.api.KtAnalysisSessionProvider import org.jetbrains.kotlin.idea.frontend.api.analyse -import org.jetbrains.kotlin.idea.frontend.api.fir.KtFirAnalysisSessionProvider import org.jetbrains.kotlin.psi.KtElement +import org.jetbrains.kotlin.test.InTextDirectivesUtils import java.io.File + +inline fun runReadAction(crossinline runnable: () -> T): T { + return ApplicationManager.getApplication().runReadAction(Computable { runnable() }) +} + fun executeOnPooledThreadInReadAction(action: () -> R): R = ApplicationManager.getApplication().executeOnPooledThread { runReadAction(action) }.get() @@ -34,30 +28,6 @@ inline fun analyseOnPooledThreadInReadAction(context: KtElement, crossinline } -fun addExternalTestFiles(testDataFilePath: String) { - File(testDataFilePath).getExternalFiles().forEach(::addFile) -} - -private fun addFile(file: File) { - addFile(FileUtil.loadFile(file, /* convertLineSeparators = */true), file.name) -} - -private fun addFile(text: String, fileName: String) { - runWriteAction { - val virtualDir = LightPlatformTestCase.getSourceRoot()!! - val virtualFile = virtualDir.createChildData(null, fileName) - virtualFile.getOutputStream(null)!!.writer().use { it.write(text) } - } -} - -private fun File.getExternalFiles(): List { - val directory = parentFile - val externalFileName = "${nameWithoutExtension}.external" - return directory.listFiles { _, name -> - name == "$externalFileName.kt" || name == "$externalFileName.java" - }!!.filterNotNull() -} - /** * Temporary * @see org.jetbrains.kotlin.idea.fir.low.level.api.DuplicatedFirSourceElementsException.IS_ENABLED @@ -78,13 +48,3 @@ inline fun withPossiblyDisabledDuplicatedFirSourceElementsException(fileText return action() } } - -@OptIn(InvalidWayOfUsingAnalysisSession::class) -fun Project.invalidateCaches(context: KtElement?) { - LibraryModificationTracker.getInstance(this).incModificationCount() - (service() as KotlinFirOutOfBlockModificationTrackerFactory).incrementModificationsCount() - (service() as KtFirAnalysisSessionProvider).clearCaches() - if (context != null) { - executeOnPooledThreadInReadAction { analyse(context) {} } - } -} \ No newline at end of file