[LL API] Add tests for 'out of content root' analysis mode

This commit is contained in:
Yan Zhulanow
2022-12-14 20:37:14 +09:00
committed by Space Team
parent e4c2902e81
commit f1edbc1a14
58 changed files with 2698 additions and 280 deletions
@@ -10,7 +10,8 @@ import com.intellij.openapi.project.Project
import com.intellij.psi.PsiFile
import org.jetbrains.kotlin.analysis.api.impl.base.test.configurators.AnalysisApiBaseTestServiceRegistrar
import org.jetbrains.kotlin.analysis.api.standalone.base.project.structure.KtModuleProjectStructure
import org.jetbrains.kotlin.analysis.test.framework.project.structure.KtMainModuleFactoryForSourceModules
import org.jetbrains.kotlin.analysis.test.framework.project.structure.KtModuleFactory
import org.jetbrains.kotlin.analysis.test.framework.project.structure.KtSourceModuleFactory
import org.jetbrains.kotlin.analysis.test.framework.project.structure.TestModuleStructureFactory
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfigurator
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestServiceRegistrar
@@ -35,6 +36,9 @@ object AnalysisApiFe10TestConfigurator : AnalysisApiTestConfigurator() {
get() = "descriptors"
override fun configureTest(builder: TestConfigurationBuilder, disposable: Disposable) {
builder.apply {
useAdditionalService<KtModuleFactory> { KtSourceModuleFactory() }
}
}
override val serviceRegistrars: List<AnalysisApiTestServiceRegistrar> = listOf(
@@ -47,12 +51,7 @@ object AnalysisApiFe10TestConfigurator : AnalysisApiTestConfigurator() {
testServices: TestServices,
project: Project,
): KtModuleProjectStructure {
return TestModuleStructureFactory.createProjectStructureByTestStructure(
moduleStructure,
testServices,
project,
KtMainModuleFactoryForSourceModules,
)
return TestModuleStructureFactory.createProjectStructureByTestStructure(moduleStructure, testServices, project)
}
override fun prepareFilesInModule(files: List<PsiFile>, module: TestModule, testServices: TestServices) {
@@ -63,11 +62,6 @@ object AnalysisApiFe10TestConfigurator : AnalysisApiTestConfigurator() {
JvmResolveUtil.analyze(project, files.filterIsInstance<KtFile>(), compilerConfiguration, packageProviderFactory)
}
override fun doOutOfBlockModification(file: KtFile) {
// TODO not supported yet
}
override fun preprocessTestDataPath(path: Path): Path {
val newPath = path.resolveSibling(path.nameWithoutExtension + "." + testPrefix + "." + path.extension)
if (newPath.toFile().exists()) return newPath
@@ -14,14 +14,13 @@ import org.jetbrains.kotlin.analysis.api.impl.base.util.LibraryUtils
import org.jetbrains.kotlin.analysis.api.standalone.base.project.structure.KtModuleProjectStructure
import org.jetbrains.kotlin.analysis.api.standalone.base.project.structure.KtModuleWithFiles
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.base.AnalysisApiFirTestServiceRegistrar
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.configurators.AnalysisApiFirSourceTestConfigurator
import org.jetbrains.kotlin.analysis.test.framework.project.structure.KtLibraryModuleImpl
import org.jetbrains.kotlin.analysis.test.framework.project.structure.KtModuleFactory
import org.jetbrains.kotlin.analysis.test.framework.project.structure.TestModuleStructureFactory
import org.jetbrains.kotlin.analysis.test.framework.services.libraries.compiledLibraryProvider
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfigurator
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestServiceRegistrar
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.FrontendKind
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
import org.jetbrains.kotlin.test.model.TestModule
import org.jetbrains.kotlin.test.services.TestModuleStructure
@@ -31,10 +30,10 @@ object AnalysisApiFirLibraryBinaryTestConfigurator : AnalysisApiTestConfigurator
override val analyseInDependentSession: Boolean get() = false
override val frontendKind: FrontendKind get() = FrontendKind.Fir
override fun configureTest(
builder: TestConfigurationBuilder,
disposable: Disposable
) {
override fun configureTest(builder: TestConfigurationBuilder, disposable: Disposable) {
builder.apply {
useAdditionalService<KtModuleFactory> { KtLibraryBinaryModuleFactory() }
}
}
override fun createModules(
@@ -42,38 +41,32 @@ object AnalysisApiFirLibraryBinaryTestConfigurator : AnalysisApiTestConfigurator
testServices: TestServices,
project: Project
): KtModuleProjectStructure {
return TestModuleStructureFactory.createProjectStructureByTestStructure(
moduleStructure,
testServices,
project
) { testModule: TestModule, _, _ ->
val library = testServices.compiledLibraryProvider.compileToLibrary(testModule).jar
val decompiledFiles = LibraryUtils.getAllPsiFilesFromTheJar(library, project)
KtModuleWithFiles(
KtLibraryModuleImpl(
testModule.name,
testModule.targetPlatform,
GlobalSearchScope.filesScope(project, decompiledFiles.mapTo(mutableSetOf()) { it.virtualFile }),
project,
binaryRoots = listOf(library),
librarySources = null,
),
decompiledFiles
)
}
return TestModuleStructureFactory.createProjectStructureByTestStructure(moduleStructure, testServices, project)
}
override val serviceRegistrars: List<AnalysisApiTestServiceRegistrar> =
listOf(
AnalysisApiBaseTestServiceRegistrar,
AnalysisApiFirTestServiceRegistrar,
AnalysisApiLibraryBaseTestServiceRegistrar,
)
override fun doOutOfBlockModification(file: KtFile) {
AnalysisApiFirSourceTestConfigurator(analyseInDependentSession = false).doOutOfBlockModification(file)
}
}
private class KtLibraryBinaryModuleFactory : KtModuleFactory {
override fun createModule(testModule: TestModule, testServices: TestServices, project: Project): KtModuleWithFiles {
val library = testServices.compiledLibraryProvider.compileToLibrary(testModule).jar
val decompiledFiles = LibraryUtils.getAllPsiFilesFromTheJar(library, project)
return KtModuleWithFiles(
KtLibraryModuleImpl(
testModule.name,
testModule.targetPlatform,
GlobalSearchScope.filesScope(project, decompiledFiles.mapTo(mutableSetOf()) { it.virtualFile }),
project,
binaryRoots = listOf(library),
librarySources = null,
),
decompiledFiles
)
}
}
@@ -15,16 +15,15 @@ import org.jetbrains.kotlin.analysis.api.standalone.base.project.structure.KtMod
import org.jetbrains.kotlin.analysis.api.standalone.base.project.structure.KtModuleWithFiles
import org.jetbrains.kotlin.analysis.low.level.api.fir.compiler.based.SealedClassesInheritorsCaclulatorPreAnalysisHandler
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.base.AnalysisApiFirTestServiceRegistrar
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.configurators.AnalysisApiFirSourceTestConfigurator
import org.jetbrains.kotlin.analysis.test.framework.project.structure.KtLibraryModuleImpl
import org.jetbrains.kotlin.analysis.test.framework.project.structure.KtLibrarySourceModuleImpl
import org.jetbrains.kotlin.analysis.test.framework.project.structure.KtModuleFactory
import org.jetbrains.kotlin.analysis.test.framework.project.structure.TestModuleStructureFactory
import org.jetbrains.kotlin.analysis.test.framework.services.libraries.CompiledLibraryProvider
import org.jetbrains.kotlin.analysis.test.framework.services.libraries.compiledLibraryProvider
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfigurator
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestServiceRegistrar
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.FrontendKind
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
import org.jetbrains.kotlin.test.model.TestModule
import org.jetbrains.kotlin.test.services.ServiceRegistrationData
@@ -41,6 +40,7 @@ object AnalysisApiFirLibrarySourceTestConfigurator : AnalysisApiTestConfigurator
) {
builder.apply {
useAdditionalServices(ServiceRegistrationData(CompiledLibraryProvider::class, ::CompiledLibraryProvider))
useAdditionalService<KtModuleFactory> { KtLibrarySourceModuleFactory() }
useDirectives(SealedClassesInheritorsCaclulatorPreAnalysisHandler.Directives)
usePreAnalysisHandlers(::SealedClassesInheritorsCaclulatorPreAnalysisHandler)
}
@@ -51,37 +51,7 @@ object AnalysisApiFirLibrarySourceTestConfigurator : AnalysisApiTestConfigurator
testServices: TestServices,
project: Project
): KtModuleProjectStructure {
return TestModuleStructureFactory.createProjectStructureByTestStructure(
moduleStructure,
testServices,
project
) { testModule: TestModule, _, _ ->
val (libraryJar, librarySourcesJar) = testServices.compiledLibraryProvider.compileToLibrary(testModule)
val libraryKtModule = KtLibraryModuleImpl(
testModule.name,
testModule.targetPlatform,
GlobalSearchScope.filesScope(project, LibraryUtils.getAllVirtualFilesFromJar(libraryJar)),
project,
binaryRoots = listOf(libraryJar),
librarySources = null,
)
val decompiledPsiFilesFromSourceJar = LibraryUtils.getAllPsiFilesFromTheJar(librarySourcesJar, project)
val librarySourceKtModule = KtLibrarySourceModuleImpl(
testModule.name,
testModule.targetPlatform,
GlobalSearchScope.filesScope(project, decompiledPsiFilesFromSourceJar.map { it.virtualFile }),
project,
binaryLibrary = libraryKtModule,
)
libraryKtModule.librarySources = librarySourceKtModule
KtModuleWithFiles(
librarySourceKtModule,
decompiledPsiFilesFromSourceJar
)
}
return TestModuleStructureFactory.createProjectStructureByTestStructure(moduleStructure, testServices, project)
}
override val serviceRegistrars: List<AnalysisApiTestServiceRegistrar> =
@@ -90,9 +60,31 @@ object AnalysisApiFirLibrarySourceTestConfigurator : AnalysisApiTestConfigurator
AnalysisApiFirTestServiceRegistrar,
AnalysisApiLibraryBaseTestServiceRegistrar,
)
}
private class KtLibrarySourceModuleFactory : KtModuleFactory {
override fun createModule(testModule: TestModule, testServices: TestServices, project: Project): KtModuleWithFiles {
val (libraryJar, librarySourcesJar) = testServices.compiledLibraryProvider.compileToLibrary(testModule)
override fun doOutOfBlockModification(file: KtFile) {
AnalysisApiFirSourceTestConfigurator(analyseInDependentSession = false).doOutOfBlockModification(file)
val libraryKtModule = KtLibraryModuleImpl(
testModule.name,
testModule.targetPlatform,
GlobalSearchScope.filesScope(project, LibraryUtils.getAllVirtualFilesFromJar(libraryJar)),
project,
binaryRoots = listOf(libraryJar),
librarySources = null,
)
val decompiledPsiFilesFromSourceJar = LibraryUtils.getAllPsiFilesFromTheJar(librarySourcesJar, project)
val librarySourceKtModule = KtLibrarySourceModuleImpl(
testModule.name,
testModule.targetPlatform,
GlobalSearchScope.filesScope(project, decompiledPsiFilesFromSourceJar.map { it.virtualFile }),
project,
binaryLibrary = libraryKtModule,
)
libraryKtModule.librarySources = librarySourceKtModule
return KtModuleWithFiles(librarySourceKtModule, decompiledPsiFilesFromSourceJar)
}
}
@@ -10,10 +10,11 @@ import com.intellij.openapi.project.Project
import org.jetbrains.kotlin.analysis.api.standalone.base.project.structure.KtModuleProjectStructure
import org.jetbrains.kotlin.analysis.low.level.api.fir.compiler.based.SealedClassesInheritorsCaclulatorPreAnalysisHandler
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.configurators.AnalysisApiFirSourceTestConfigurator
import org.jetbrains.kotlin.analysis.test.framework.project.structure.KtModuleFactory
import org.jetbrains.kotlin.analysis.test.framework.project.structure.KtSourceModuleFactory
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfigurator
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestServiceRegistrar
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.FrontendKind
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
import org.jetbrains.kotlin.test.services.TestModuleStructure
import org.jetbrains.kotlin.test.services.TestServices
@@ -24,24 +25,22 @@ object StandaloneModeConfigurator : AnalysisApiTestConfigurator() {
override fun configureTest(builder: TestConfigurationBuilder, disposable: Disposable) {
with(builder) {
useAdditionalService<KtModuleFactory> { KtSourceModuleFactory() }
useDirectives(SealedClassesInheritorsCaclulatorPreAnalysisHandler.Directives)
usePreAnalysisHandlers(::SealedClassesInheritorsCaclulatorPreAnalysisHandler)
}
}
private val sourceConfigurator = AnalysisApiFirSourceTestConfigurator(analyseInDependentSession = false)
override val serviceRegistrars: List<AnalysisApiTestServiceRegistrar>
get() = AnalysisApiFirSourceTestConfigurator(analyseInDependentSession = false).serviceRegistrars +
listOf(StandaloneModeTestServiceRegistrar)
get() = sourceConfigurator.serviceRegistrars + listOf(StandaloneModeTestServiceRegistrar)
override fun createModules(
moduleStructure: TestModuleStructure,
testServices: TestServices,
project: Project
): KtModuleProjectStructure {
return AnalysisApiFirSourceTestConfigurator(analyseInDependentSession = false).createModules(moduleStructure, testServices, project)
}
override fun doOutOfBlockModification(file: KtFile) {
AnalysisApiFirSourceTestConfigurator(analyseInDependentSession = false).doOutOfBlockModification(file)
return sourceConfigurator.createModules(moduleStructure, testServices, project)
}
}
@@ -21,8 +21,6 @@ abstract class AnalysisApiKtModuleProvider : TestService {
abstract fun registerProjectStructure(modules: KtModuleProjectStructure)
protected abstract fun getModuleName(ktModule: KtModule): String
abstract fun getModuleStructure(): KtModuleProjectStructure
}
@@ -43,20 +41,24 @@ class AnalysisApiKtModuleProviderImpl(
require(!this::modulesByName.isInitialized)
this.modulesStructure = modules
this.modulesByName = modulesStructure.mainModules.associateBy { getModuleName(it.ktModule) }
this.modulesByName = modulesStructure.mainModules.associateByName()
}
override fun getModuleName(ktModule: KtModule): String = when (ktModule) {
is KtLibraryModule -> ktModule.libraryName
is KtSdkModule -> ktModule.sdkName
is KtLibrarySourceModule -> ktModule.libraryName
is KtSourceModule -> ktModule.moduleName
is KtNotUnderContentRootModule -> TODO()
is KtBuiltinsModule -> "Builtins for ${ktModule.platform}"
}
override fun getModuleStructure(): KtModuleProjectStructure = modulesStructure
}
val TestServices.ktModuleProvider: AnalysisApiKtModuleProvider by TestServices.testServiceAccessor()
fun List<KtModuleWithFiles>.associateByName(): Map<String, KtModuleWithFiles> {
return associateBy { (ktModule, _) ->
when (ktModule) {
is KtSourceModule -> ktModule.moduleName
is KtLibraryModule -> ktModule.libraryName
is KtLibrarySourceModule -> ktModule.libraryName
is KtSdkModule -> ktModule.sdkName
is KtBuiltinsModule -> "Builtins for ${ktModule.platform}"
is KtNotUnderContentRootModuleForTest -> ktModule.moduleName
else -> error("Unsupported module type: " + ktModule.javaClass.name)
}
}
}
@@ -0,0 +1,18 @@
/*
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.analysis.test.framework.project.structure
import com.intellij.openapi.project.Project
import org.jetbrains.kotlin.analysis.api.standalone.base.project.structure.KtModuleWithFiles
import org.jetbrains.kotlin.test.model.TestModule
import org.jetbrains.kotlin.test.services.TestService
import org.jetbrains.kotlin.test.services.TestServices
fun interface KtModuleFactory : TestService {
fun createModule(testModule: TestModule, testServices: TestServices, project: Project): KtModuleWithFiles
}
val TestServices.ktModuleFactory: KtModuleFactory by TestServices.testServiceAccessor()
@@ -0,0 +1,53 @@
/*
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.analysis.test.framework.project.structure
import com.intellij.openapi.project.Project
import com.intellij.psi.PsiFile
import com.intellij.psi.search.GlobalSearchScope
import org.jetbrains.kotlin.analysis.api.standalone.base.project.structure.KtModuleWithFiles
import org.jetbrains.kotlin.analysis.project.structure.KtModule
import org.jetbrains.kotlin.analysis.project.structure.KtNotUnderContentRootModule
import org.jetbrains.kotlin.platform.TargetPlatform
import org.jetbrains.kotlin.resolve.PlatformDependentAnalyzerServices
import org.jetbrains.kotlin.test.getAnalyzerServices
import org.jetbrains.kotlin.test.model.TestModule
import org.jetbrains.kotlin.test.services.TestServices
class KtOutOfContentRootModuleFactory : KtModuleFactory {
override fun createModule(testModule: TestModule, testServices: TestServices, project: Project): KtModuleWithFiles {
val psiFiles = TestModuleStructureFactory.createSourcePsiFiles(testModule, testServices, project)
val module = KtNotUnderContentRootModuleForTest(testModule.name, psiFiles.single(), testModule.targetPlatform)
return KtModuleWithFiles(module, psiFiles)
}
}
internal class KtNotUnderContentRootModuleForTest(
val moduleName: String,
override val file: PsiFile,
override val platform: TargetPlatform
) : KtNotUnderContentRootModule {
override val directRegularDependencies: List<KtModule>
get() = emptyList()
override val directRefinementDependencies: List<KtModule>
get() = emptyList()
override val directFriendDependencies: List<KtModule>
get() = emptyList()
override val contentScope: GlobalSearchScope
get() = GlobalSearchScope.fileScope(file)
override val analyzerServices: PlatformDependentAnalyzerServices
get() = platform.getAnalyzerServices()
override val project: Project
get() = file.project
override val moduleDescription: String
get() = "Not under content root for ${file.virtualFile.path}"
}
@@ -0,0 +1,28 @@
/*
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.analysis.test.framework.project.structure
import com.intellij.openapi.project.Project
import com.intellij.psi.search.GlobalSearchScope
import org.jetbrains.kotlin.analysis.api.standalone.base.project.structure.KtModuleWithFiles
import org.jetbrains.kotlin.test.model.TestModule
import org.jetbrains.kotlin.test.services.TestServices
class KtSourceModuleFactory : KtModuleFactory {
override fun createModule(testModule: TestModule, testServices: TestServices, project: Project): KtModuleWithFiles {
val psiFiles = TestModuleStructureFactory.createSourcePsiFiles(testModule, testServices, project)
val module = KtSourceModuleImpl(
testModule.name,
testModule.targetPlatform,
testModule.languageVersionSettings,
project,
GlobalSearchScope.filesScope(project, psiFiles.mapTo(mutableSetOf()) { it.virtualFile }),
)
return KtModuleWithFiles(module, psiFiles)
}
}
@@ -16,9 +16,8 @@ import org.jetbrains.kotlin.analysis.api.standalone.base.project.structure.Stand
import org.jetbrains.kotlin.analysis.project.structure.KtBinaryModule
import org.jetbrains.kotlin.analysis.project.structure.KtLibraryModule
import org.jetbrains.kotlin.analysis.project.structure.KtModule
import org.jetbrains.kotlin.analysis.project.structure.allDirectDependenciesOfType
import org.jetbrains.kotlin.analysis.project.structure.KtNotUnderContentRootModule
import org.jetbrains.kotlin.analysis.test.framework.services.environmentManager
import org.jetbrains.kotlin.analysis.utils.errors.checkIsInstance
import org.jetbrains.kotlin.analysis.utils.errors.requireIsInstance
import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys
import org.jetbrains.kotlin.cli.jvm.config.JvmClasspathRoot
@@ -37,66 +36,42 @@ import kotlin.io.path.exists
import kotlin.io.path.extension
import kotlin.io.path.nameWithoutExtension
fun interface KtMainModuleFactory {
fun createMainModule(
testModule: TestModule,
testServices: TestServices,
project: Project,
): KtModuleWithFiles
}
object KtMainModuleFactoryForSourceModules : KtMainModuleFactory {
override fun createMainModule(
testModule: TestModule,
testServices: TestServices,
project: Project,
): KtModuleWithFiles {
val psiFiles = TestModuleStructureFactory.createSourcePsiFiles(testModule, testServices, project)
return KtModuleWithFiles(
KtSourceModuleImpl(
testModule.name,
testModule.targetPlatform,
testModule.languageVersionSettings,
project,
GlobalSearchScope.filesScope(project, psiFiles.mapTo(mutableSetOf()) { it.virtualFile }),
),
psiFiles
)
}
}
object TestModuleStructureFactory {
fun createProjectStructureByTestStructure(
moduleStructure: TestModuleStructure,
testServices: TestServices,
project: Project,
mainModuleFactory: KtMainModuleFactory
project: Project
): KtModuleProjectStructure {
val modulesFromTestServices = moduleStructure.modules.map { testModule ->
testModule.toKtModule(testServices, project, mainModuleFactory)
}
val moduleByName = modulesFromTestServices.associateBy { getModuleName(it.ktModule) }
val moduleEntries = moduleStructure.modules
.map { testModule -> testServices.ktModuleFactory.createModule(testModule, testServices, project) }
val moduleEntriesByName = moduleEntries.associateByName()
val binaryModulesBySourceRoots = mutableMapOf<Set<Path>, KtBinaryModule>()
moduleStructure.modules.forEach { testModule ->
val ktModule = moduleByName.getValue(testModule.name).ktModule
checkIsInstance<KtModuleWithModifiableDependencies>(ktModule)
for (testModule in moduleStructure.modules) {
when (val ktModule = moduleEntriesByName.getValue(testModule.name).ktModule) {
is KtNotUnderContentRootModule -> {
// Not-under-content-root modules have no external dependencies on purpose
}
is KtModuleWithModifiableDependencies -> {
addModuleDependencies(testModule, moduleEntriesByName, ktModule)
addModuleDependencies(testModule, moduleByName, ktModule)
buildList {
addIfNotNull(getJdkModule(testModule, project, testServices))
addAll(getStdlibModules(testModule, project, testServices))
addAll(getLibraryModules(testServices, testModule, project))
addAll(createLibrariesByCompilerConfigurators(testModule, testServices, project))
}.forEach { library ->
val cachedLibrary = binaryModulesBySourceRoots.getOrPut(library.getBinaryRoots().toSet()) { library }
ktModule.directRegularDependencies.add(cachedLibrary)
buildList {
addIfNotNull(getJdkModule(testModule, project, testServices))
addAll(getStdlibModules(testModule, project, testServices))
addAll(getLibraryModules(testServices, testModule, project))
addAll(createLibrariesByCompilerConfigurators(testModule, testServices, project))
}.forEach { library ->
val cachedLibrary = binaryModulesBySourceRoots.getOrPut(library.getBinaryRoots().toSet()) { library }
ktModule.directRegularDependencies.add(cachedLibrary)
}
}
else -> error("Unexpected module type: " + ktModule.javaClass.name)
}
}
return KtModuleProjectStructure(modulesFromTestServices, binaryModulesBySourceRoots.values)
return KtModuleProjectStructure(moduleEntries, binaryModulesBySourceRoots.values)
}
@OptIn(TestInfrastructureInternals::class)
@@ -112,19 +87,7 @@ object TestModuleStructureFactory {
.map { root -> createKtLibraryModuleByJar(root.file.toPath(), testServices, project) }
}
private fun getModuleName(ktModule: KtModule) = when (ktModule) {
is KtSourceModuleImpl -> ktModule.moduleName
is KtLibraryModuleImpl -> ktModule.libraryName
is KtLibrarySourceModuleImpl -> ktModule.libraryName
else -> error("Unknown module ${ktModule::class}")
}
private fun addModuleDependencies(
testModule: TestModule,
moduleByName: Map<String, KtModuleWithFiles>,
ktModule: KtModule
) {
private fun addModuleDependencies(testModule: TestModule, moduleByName: Map<String, KtModuleWithFiles>, ktModule: KtModule) {
requireIsInstance<KtModuleWithModifiableDependencies>(ktModule)
testModule.allDependencies.forEach { dependency ->
val dependencyKtModule = moduleByName.getValue(dependency.moduleName).ktModule
@@ -224,14 +187,6 @@ object TestModuleStructureFactory {
)
}
private fun TestModule.toKtModule(
testServices: TestServices,
project: Project,
mainModuleFactory: KtMainModuleFactory,
): KtModuleWithFiles {
return mainModuleFactory.createMainModule(this, testServices, project)
}
fun createSourcePsiFiles(
testModule: TestModule,
testServices: TestServices,
@@ -9,10 +9,12 @@ import com.intellij.mock.MockApplication
import com.intellij.mock.MockProject
import com.intellij.openapi.Disposable
import com.intellij.openapi.application.Application
import com.intellij.openapi.components.ServiceManager
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.Key
import com.intellij.psi.PsiFile
import org.jetbrains.kotlin.analysis.api.standalone.base.project.structure.KtModuleProjectStructure
import org.jetbrains.kotlin.analysis.providers.KotlinModificationTrackerFactory
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.psi.NotNullableUserDataProperty
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
@@ -38,7 +40,10 @@ abstract class AnalysisApiTestConfigurator {
open fun prepareFilesInModule(files: List<PsiFile>, module: TestModule, testServices: TestServices) {}
abstract fun doOutOfBlockModification(file: KtFile)
open fun doOutOfBlockModification(file: KtFile) {
ServiceManager.getService(file.project, KotlinModificationTrackerFactory::class.java)
.incrementModificationsCount()
}
open fun preprocessTestDataPath(path: Path): Path = path
@@ -40,6 +40,7 @@ internal class LLFirResolveSessionDepended(
override val project: Project get() = originalFirResolveSession.project
override val useSiteKtModule: KtModule get() = originalFirResolveSession.useSiteKtModule
override val useSiteFirSession get() = originalFirResolveSession.useSiteFirSession
override val isLibrarySession get() = false
private val scopeSessionProviderCache = SoftCachedMap.create<FirSession, LLFirScopeSessionProvider>(
project,
@@ -8,13 +8,12 @@ package org.jetbrains.kotlin.analysis.low.level.api.fir
import com.intellij.openapi.components.ServiceManager
import com.intellij.openapi.project.Project
import com.intellij.openapi.roots.ProjectRootModificationTracker
import com.intellij.psi.util.PsiModificationTracker
import org.jetbrains.annotations.TestOnly
import org.jetbrains.kotlin.analysis.low.level.api.fir.api.LLFirResolveSession
import org.jetbrains.kotlin.analysis.low.level.api.fir.sessions.LLFirSession
import org.jetbrains.kotlin.analysis.low.level.api.fir.sessions.LLFirSessionProviderStorage
import org.jetbrains.kotlin.analysis.low.level.api.fir.state.LLFirLibraryOrLibrarySourceResolvableResolveSession
import org.jetbrains.kotlin.analysis.low.level.api.fir.state.LLFirNotUnderContentRootResolvableResolveSession
import org.jetbrains.kotlin.analysis.low.level.api.fir.state.LLFirNotUnderContentRootResolveSession
import org.jetbrains.kotlin.analysis.low.level.api.fir.state.LLFirResolvableResolveSession
import org.jetbrains.kotlin.analysis.low.level.api.fir.state.LLFirSourceResolveSession
import org.jetbrains.kotlin.analysis.low.level.api.fir.util.errorWithFirSpecificEntries
@@ -71,7 +70,7 @@ internal class LLFirResolveSessionService(project: Project) {
}
is KtNotUnderContentRootModule -> {
LLFirNotUnderContentRootResolvableResolveSession(
LLFirNotUnderContentRootResolveSession(
useSiteSession.moduleComponents.globalResolveComponents,
sessionProviderStorage.project,
useSiteKtModule,
@@ -31,11 +31,12 @@ abstract class LLFirResolveSession {
abstract val useSiteKtModule: KtModule
abstract val isLibrarySession: Boolean
abstract fun getSessionFor(module: KtModule): LLFirSession
abstract fun getScopeSessionFor(firSession: FirSession): ScopeSession
/**
* Build fully resolved FIR node for requested element.
* This operation could be performance affective because it create FIleStructureElement and resolve non-local declaration into BODY phase, use
@@ -22,6 +22,9 @@ internal class LLFirLibraryOrLibrarySourceResolvableResolveSession(
override val useSiteKtModule: KtModule,
sessionProvider: LLFirSessionProvider,
) : LLFirResolvableResolveSession(sessionProvider) {
override val isLibrarySession: Boolean
get() = true
override fun getDiagnostics(element: KtElement, filter: DiagnosticCheckerFilter): List<KtPsiDiagnostic> =
emptyList()
@@ -9,19 +9,20 @@ import com.intellij.openapi.project.Project
import org.jetbrains.kotlin.analysis.low.level.api.fir.LLFirGlobalResolveComponents
import org.jetbrains.kotlin.analysis.low.level.api.fir.api.DiagnosticCheckerFilter
import org.jetbrains.kotlin.analysis.low.level.api.fir.sessions.LLFirSessionProvider
import org.jetbrains.kotlin.analysis.low.level.api.fir.sessions.LLFirLibraryOrLibrarySourceResolvableModuleSession
import org.jetbrains.kotlin.analysis.project.structure.KtModule
import org.jetbrains.kotlin.diagnostics.KtPsiDiagnostic
import org.jetbrains.kotlin.psi.KtElement
import org.jetbrains.kotlin.psi.KtFile
internal class LLFirNotUnderContentRootResolvableResolveSession(
internal class LLFirNotUnderContentRootResolveSession(
override val globalComponents: LLFirGlobalResolveComponents,
override val project: Project,
override val useSiteKtModule: KtModule,
sessionProvider: LLFirSessionProvider,
) : LLFirResolvableResolveSession(sessionProvider) {
override val isLibrarySession: Boolean
get() = false
override fun getDiagnostics(element: KtElement, filter: DiagnosticCheckerFilter): List<KtPsiDiagnostic> =
emptyList()
@@ -29,8 +30,8 @@ internal class LLFirNotUnderContentRootResolvableResolveSession(
emptyList()
override fun getModuleKind(module: KtModule): ModuleKind {
return when {
module == this.useSiteKtModule -> ModuleKind.RESOLVABLE_MODULE
return when (module) {
useSiteKtModule -> ModuleKind.RESOLVABLE_MODULE
else -> ModuleKind.BINARY_MODULE
}
}
@@ -24,6 +24,9 @@ internal class LLFirSourceResolveSession(
override val useSiteKtModule: KtModule,
sessionProvider: LLFirSessionProvider,
) : LLFirResolvableResolveSession(sessionProvider) {
override val isLibrarySession: Boolean
get() = false
override fun getDiagnostics(element: KtElement, filter: DiagnosticCheckerFilter): List<KtPsiDiagnostic> {
val moduleComponents = getModuleComponentsForElement(element)
return moduleComponents.diagnosticsCollector.getDiagnosticsFor(element, filter)
@@ -0,0 +1,6 @@
KT element: KtDestructuringDeclarationEntry
FIR element: FirPropertyImpl
FIR source kind: KtRealSourceElementKind
FIR element rendered:
lval a: <ERROR TYPE REF: Unresolved name: component1> = R|<local>/<destruct>|.<Unresolved name: component1>#()
@@ -0,0 +1,9 @@
KT element: KtPropertyDelegate
FIR element: FirFunctionCallImpl
FIR source kind: KtRealSourceElementKind
FIR element rendered:
<Unresolved name: lazy>#(<L> = lazy@fun <anonymous>(): R|kotlin/Int| <inline=Unknown> {
^ Int(1)
}
)
@@ -0,0 +1,9 @@
KT element: KtCallExpression
FIR element: FirFunctionCallImpl
FIR source kind: KtRealSourceElementKind
FIR element rendered:
<Unresolved name: lazy>#(<L> = lazy@fun <anonymous>(): R|kotlin/Int| <inline=Unknown> {
^ Int(1)
}
)
@@ -0,0 +1,6 @@
KT element: KtCallExpression
FIR element: FirFunctionCallImpl
FIR source kind: KtRealSourceElementKind
FIR element rendered:
<Unresolved name: mutableListOf>#<R|kotlin/String|>()
@@ -0,0 +1,8 @@
KT element: KtLambdaArgument
FIR element: FirAnonymousFunctionExpressionImpl
FIR source kind: KtRealSourceElementKind
FIR element rendered:
run@fun <anonymous>(): R|kotlin/Int| <inline=Unknown> {
^ Int(1)
}
@@ -0,0 +1,6 @@
KT element: KtThrowExpression
FIR element: FirThrowExpressionImpl
FIR source kind: KtRealSourceElementKind
FIR element rendered:
throw <Unresolved name: IllegalStateException>#()
@@ -0,0 +1,20 @@
FILE: class.kt
public final [BODY_RESOLVE] class B : R|kotlin/Any| {
public [BODY_RESOLVE] constructor(): R|B| {
super<R|kotlin/Any|>()
}
public final [BODY_RESOLVE] fun q(): <ERROR TYPE REF: Symbol not found for C> {
}
private final [BODY_RESOLVE] val y: <ERROR TYPE REF: Symbol not found for C> = this@R|/B|.R|/B.q|()
private [BODY_RESOLVE] get(): <ERROR TYPE REF: Symbol not found for C>
public final [BODY_RESOLVE] fun foo([BODY_RESOLVE] a: <ERROR TYPE REF: Symbol not found for A>): <ERROR TYPE REF: Unresolved name: with> {
^foo <Unresolved name: with>#(R|<local>/a|, <L> = [BODY_RESOLVE] with@fun <anonymous>(): <ERROR TYPE REF: Unresolved name: bar> <inline=Unknown> {
^ <Unresolved name: bar>#(String(a), this@R|/B|.R|/B.y|)
}
)
}
}
@@ -0,0 +1,6 @@
FILE: functionWithImplicitType.kt
public final [BODY_RESOLVE] fun <[BODY_RESOLVE] T> checkSubtype([BODY_RESOLVE] t: R|T|): R|T| {
^checkSubtype R|<local>/t|
}
public final [BODY_RESOLVE] val ab: R|kotlin/collections/List<kotlin/Int>?| = R|/checkSubtype|<R|kotlin/collections/List<kotlin/Int>?|>(<Unresolved name: Collections>#.<Unresolved name: emptyList>#<R|kotlin/Int|>())
public [BODY_RESOLVE] get(): R|kotlin/collections/List<kotlin/Int>?|
@@ -1,3 +1,5 @@
// SKIP_WHEN_OUT_OF_CONTENT_ROOT
@JvmInline
value class Value(val value: Int) {
fun resolveMe() {}
@@ -1,3 +1,5 @@
// SKIP_WHEN_OUT_OF_CONTENT_ROOT
import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty
@@ -1,2 +1,4 @@
// SKIP_WHEN_OUT_OF_CONTENT_ROOT
val <T : Int, K> T.resolveMe: K
get() = TODO()
@@ -8,6 +8,8 @@ package org.jetbrains.kotlin.analysis.low.level.api.fir
import junit.framework.TestCase
import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.FirLazyBodiesCalculator
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.base.AbstractLowLevelApiSingleFileTest
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.configurators.AnalysisApiFirOutOfContentRootTestConfigurator
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.configurators.AnalysisApiFirSourceTestConfigurator
import org.jetbrains.kotlin.fir.FirElement
import org.jetbrains.kotlin.fir.builder.BodyBuildingMode
import org.jetbrains.kotlin.fir.builder.RawFirBuilder
@@ -55,4 +57,12 @@ abstract class AbstractFirLazyBodiesCalculatorTest : AbstractLowLevelApiSingleFi
TestCase.assertEquals(laziedFirFileDump, fullFirFileDump)
}
}
}
abstract class AbstractFirSourceLazyBodiesCalculatorTest : AbstractFirLazyBodiesCalculatorTest() {
override val configurator = AnalysisApiFirSourceTestConfigurator(analyseInDependentSession = false)
}
abstract class AbstractFirOutOfContentRootLazyBodiesCalculatorTest : AbstractFirLazyBodiesCalculatorTest() {
override val configurator = AnalysisApiFirOutOfContentRootTestConfigurator
}
@@ -5,8 +5,9 @@
package org.jetbrains.kotlin.analysis.low.level.api.fir
import org.jetbrains.kotlin.analysis.low.level.api.fir.state.LLFirSourceResolveSession
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.base.AbstractLowLevelApiSingleFileTest
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.configurators.AnalysisApiFirOutOfContentRootTestConfigurator
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.configurators.AnalysisApiFirSourceTestConfigurator
import org.jetbrains.kotlin.fir.FirElement
import org.jetbrains.kotlin.fir.declarations.FirDeclaration
import org.jetbrains.kotlin.fir.declarations.FirFile
@@ -64,7 +65,7 @@ abstract class AbstractFirLazyDeclarationResolveTest : AbstractLowLevelApiSingle
errorExpressionRenderer = FirErrorExpressionExtendedRenderer(),
)
resolveWithClearCaches(ktFile) { firResolveSession ->
check(firResolveSession is LLFirSourceResolveSession)
check(!firResolveSession.isLibrarySession)
val declarationToResolve = firResolveSession
.getOrBuildFirFile(ktFile)
.findResolveMe()
@@ -77,9 +78,9 @@ abstract class AbstractFirLazyDeclarationResolveTest : AbstractLowLevelApiSingle
}
}
resolveWithClearCaches(ktFile) { firResolveSession ->
check(firResolveSession is LLFirSourceResolveSession)
val firFile = firResolveSession.getOrBuildFirFile(ktFile)
resolveWithClearCaches(ktFile) { llSession ->
check(!llSession.isLibrarySession)
val firFile = llSession.getOrBuildFirFile(ktFile)
firFile.lazyResolveToPhase(FirResolvePhase.BODY_RESOLVE)
resultBuilder.append("\nFILE RAW TO BODY:\n")
renderer.renderElementAsString(firFile)
@@ -97,3 +98,11 @@ abstract class AbstractFirLazyDeclarationResolveTest : AbstractLowLevelApiSingle
}
}
}
abstract class AbstractFirSourceLazyDeclarationResolveTest : AbstractFirLazyDeclarationResolveTest() {
override val configurator = AnalysisApiFirSourceTestConfigurator(analyseInDependentSession = false)
}
abstract class AbstractFirOutOfContentRootLazyDeclarationResolveTest : AbstractFirLazyDeclarationResolveTest() {
override val configurator = AnalysisApiFirOutOfContentRootTestConfigurator
}
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.analysis.low.level.api.fir
import org.jetbrains.kotlin.analysis.low.level.api.fir.api.LowLevelFirApiFacadeForResolveOnAir
import org.jetbrains.kotlin.analysis.low.level.api.fir.state.LLFirSourceResolveSession
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.base.AbstractLowLevelApiSingleFileTest
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.configurators.AnalysisApiFirSourceTestConfigurator
import org.jetbrains.kotlin.fir.renderer.FirRenderer
import org.jetbrains.kotlin.psi.KtAnnotated
import org.jetbrains.kotlin.psi.KtElement
@@ -19,6 +20,8 @@ import org.jetbrains.kotlin.test.services.assertions
import org.jetbrains.kotlin.test.util.findElementByCommentPrefix
abstract class AbstractFirOnAirResolveTest : AbstractLowLevelApiSingleFileTest() {
override val configurator = AnalysisApiFirSourceTestConfigurator(analyseInDependentSession = false)
override fun doTestByFileStructure(ktFile: KtFile, moduleStructure: TestModuleStructure, testServices: TestServices) {
fun fixUpAnnotations(element: KtElement): KtElement = when (element) {
is KtAnnotated -> element.annotationEntries.firstOrNull() ?: element
@@ -38,6 +41,4 @@ abstract class AbstractFirOnAirResolveTest : AbstractLowLevelApiSingleFileTest()
testServices.assertions.assertEqualsToTestDataFileSibling(rendered)
}
}
// override val enableTestInDependedMode: Boolean get() = false
}
@@ -9,10 +9,11 @@ import com.intellij.psi.PsiElement
import com.intellij.psi.util.PsiTreeUtil
import org.jetbrains.kotlin.analysis.low.level.api.fir.api.getOrBuildFir
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.base.AbstractLowLevelApiSingleFileTest
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.configurators.AnalysisApiFirOutOfContentRootTestConfigurator
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.configurators.AnalysisApiFirSourceTestConfigurator
import org.jetbrains.kotlin.analysis.test.framework.services.expressionMarkerProvider
import org.jetbrains.kotlin.fir.FirElement
import org.jetbrains.kotlin.fir.declarations.FirImport
import org.jetbrains.kotlin.fir.render
import org.jetbrains.kotlin.fir.renderer.FirPackageDirectiveRenderer
import org.jetbrains.kotlin.fir.renderer.FirRenderer
import org.jetbrains.kotlin.psi.KtElement
@@ -66,4 +67,12 @@ abstract class AbstractGetOrBuildFirTest : AbstractLowLevelApiSingleFileTest() {
private object Directives : SimpleDirectivesContainer() {
val LOOK_UP_FOR_ELEMENT_OF_TYPE by stringDirective("LOOK_UP_FOR_ELEMENT_OF_TYPE")
}
}
abstract class AbstractSourceGetOrBuildFirTest : AbstractGetOrBuildFirTest() {
override val configurator = AnalysisApiFirSourceTestConfigurator(analyseInDependentSession = false)
}
abstract class AbstractOutOfContentRootGetOrBuildFirTest : AbstractGetOrBuildFirTest() {
override val configurator = AnalysisApiFirOutOfContentRootTestConfigurator
}
@@ -9,6 +9,8 @@ import junit.framework.TestCase
import org.jetbrains.kotlin.analysis.low.level.api.fir.api.FirDesignation
import org.jetbrains.kotlin.analysis.low.level.api.fir.lazy.resolve.RawFirNonLocalDeclarationBuilder
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.base.AbstractLowLevelApiSingleFileTest
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.configurators.AnalysisApiFirOutOfContentRootTestConfigurator
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.configurators.AnalysisApiFirSourceTestConfigurator
import org.jetbrains.kotlin.fir.FirElement
import org.jetbrains.kotlin.fir.FirSession
import org.jetbrains.kotlin.fir.builder.RawFirBuilder
@@ -135,3 +137,11 @@ abstract class AbstractPartialRawFirBuilderTestCase : AbstractLowLevelApiSingleF
private const val PROPERTY_DIRECTIVE = "// PROPERTY: "
}
}
abstract class AbstractSourcePartialRawFirBuilderTestCase : AbstractPartialRawFirBuilderTestCase() {
override val configurator = AnalysisApiFirSourceTestConfigurator(analyseInDependentSession = false)
}
abstract class AbstractOutOfContentRootPartialRawFirBuilderTestCase : AbstractPartialRawFirBuilderTestCase() {
override val configurator = AnalysisApiFirOutOfContentRootTestConfigurator
}
@@ -0,0 +1,590 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.analysis.low.level.api.fir;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.util.KtTestUtil;
import org.jetbrains.kotlin.test.TestMetadata;
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.analysis.api.GenerateAnalysisApiTestsKt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder")
@TestDataPath("$PROJECT_ROOT")
public class FirOutOfContentRootLazyBodiesCalculatorTestGenerated extends AbstractFirOutOfContentRootLazyBodiesCalculatorTest {
@Test
public void testAllFilesPresentInRawBuilder() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Nested
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations")
@TestDataPath("$PROJECT_ROOT")
public class Declarations {
@Test
public void testAllFilesPresentInDeclarations() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("annotation.kt")
public void testAnnotation() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotation.kt");
}
@Test
@TestMetadata("annotationsOnNullableParenthesizedTypes.kt")
public void testAnnotationsOnNullableParenthesizedTypes() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationsOnNullableParenthesizedTypes.kt");
}
@Test
@TestMetadata("annotationsOnParenthesizedTypes.kt")
public void testAnnotationsOnParenthesizedTypes() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/annotationsOnParenthesizedTypes.kt");
}
@Test
@TestMetadata("complexTypes.kt")
public void testComplexTypes() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/complexTypes.kt");
}
@Test
@TestMetadata("constructorInObject.kt")
public void testConstructorInObject() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/constructorInObject.kt");
}
@Test
@TestMetadata("constructorOfAnonymousObject.kt")
public void testConstructorOfAnonymousObject() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/constructorOfAnonymousObject.kt");
}
@Test
@TestMetadata("contextReceivers.kt")
public void testContextReceivers() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contextReceivers.kt");
}
@Test
@TestMetadata("danglingAnnotationsClassLevel.kt")
public void testDanglingAnnotationsClassLevel() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/danglingAnnotationsClassLevel.kt");
}
@Test
@TestMetadata("danglingAnnotationsFileLevel.kt")
public void testDanglingAnnotationsFileLevel() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/danglingAnnotationsFileLevel.kt");
}
@Test
@TestMetadata("delegates.kt")
public void testDelegates() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/delegates.kt");
}
@Test
@TestMetadata("derivedClass.kt")
public void testDerivedClass() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/derivedClass.kt");
}
@Test
@TestMetadata("emptyAnonymousObject.kt")
public void testEmptyAnonymousObject() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/emptyAnonymousObject.kt");
}
@Test
@TestMetadata("enums.kt")
public void testEnums() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/enums.kt");
}
@Test
@TestMetadata("enums2.kt")
public void testEnums2() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/enums2.kt");
}
@Test
@TestMetadata("enums3.kt")
public void testEnums3() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/enums3.kt");
}
@Test
@TestMetadata("expectActual.kt")
public void testExpectActual() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/expectActual.kt");
}
@Test
@TestMetadata("external.kt")
public void testExternal() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/external.kt");
}
@Test
@TestMetadata("F.kt")
public void testF() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/F.kt");
}
@Test
@TestMetadata("functionTypes.kt")
public void testFunctionTypes() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/functionTypes.kt");
}
@Test
@TestMetadata("genericFunctions.kt")
public void testGenericFunctions() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/genericFunctions.kt");
}
@Test
@TestMetadata("genericProperty.kt")
public void testGenericProperty() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/genericProperty.kt");
}
@Test
@TestMetadata("initBlockWithDeclarations.kt")
public void testInitBlockWithDeclarations() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/initBlockWithDeclarations.kt");
}
@Test
@TestMetadata("nestedClass.kt")
public void testNestedClass() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/nestedClass.kt");
}
@Test
@TestMetadata("NestedOfAliasedType.kt")
public void testNestedOfAliasedType() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/NestedOfAliasedType.kt");
}
@Test
@TestMetadata("NestedSuperType.kt")
public void testNestedSuperType() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/NestedSuperType.kt");
}
@Test
@TestMetadata("noPrimaryConstructor.kt")
public void testNoPrimaryConstructor() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noPrimaryConstructor.kt");
}
@Test
@TestMetadata("propertyWithBackingField.kt")
public void testPropertyWithBackingField() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/propertyWithBackingField.kt");
}
@Test
@TestMetadata("propertyWithBackingFieldDifferentTypes.kt")
public void testPropertyWithBackingFieldDifferentTypes() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/propertyWithBackingFieldDifferentTypes.kt");
}
@Test
@TestMetadata("simpleClass.kt")
public void testSimpleClass() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/simpleClass.kt");
}
@Test
@TestMetadata("simpleFun.kt")
public void testSimpleFun() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/simpleFun.kt");
}
@Test
@TestMetadata("simpleTypeAlias.kt")
public void testSimpleTypeAlias() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/simpleTypeAlias.kt");
}
@Test
@TestMetadata("splitModifierList.kt")
public void testSplitModifierList() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/splitModifierList.kt");
}
@Test
@TestMetadata("suspendFunctionTypes.kt")
public void testSuspendFunctionTypes() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/suspendFunctionTypes.kt");
}
@Test
@TestMetadata("typeAliasWithGeneric.kt")
public void testTypeAliasWithGeneric() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/typeAliasWithGeneric.kt");
}
@Test
@TestMetadata("typeParameterVsNested.kt")
public void testTypeParameterVsNested() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/typeParameterVsNested.kt");
}
@Test
@TestMetadata("typeParameters.kt")
public void testTypeParameters() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/typeParameters.kt");
}
@Test
@TestMetadata("where.kt")
public void testWhere() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/where.kt");
}
@Nested
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts")
@TestDataPath("$PROJECT_ROOT")
public class Contracts {
@Test
public void testAllFilesPresentInContracts() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Nested
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax")
@TestDataPath("$PROJECT_ROOT")
public class NewSyntax {
@Test
public void testAllFilesPresentInNewSyntax() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("functionWithBothOldAndNewSyntaxContractDescription.kt")
public void testFunctionWithBothOldAndNewSyntaxContractDescription() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax/functionWithBothOldAndNewSyntaxContractDescription.kt");
}
@Test
@TestMetadata("propertyAccessorsContractDescription.kt")
public void testPropertyAccessorsContractDescription() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax/propertyAccessorsContractDescription.kt");
}
@Test
@TestMetadata("simpleFunctionsContractDescription.kt")
public void testSimpleFunctionsContractDescription() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/newSyntax/simpleFunctionsContractDescription.kt");
}
}
@Nested
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/oldSyntax")
@TestDataPath("$PROJECT_ROOT")
public class OldSyntax {
@Test
public void testAllFilesPresentInOldSyntax() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/oldSyntax"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("contractDescription.kt")
public void testContractDescription() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contracts/oldSyntax/contractDescription.kt");
}
}
}
@Nested
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType")
@TestDataPath("$PROJECT_ROOT")
public class NoParameterType {
@Test
public void testAllFilesPresentInNoParameterType() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("noParameterTypRefInCatch.kt")
public void testNoParameterTypRefInCatch() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInCatch.kt");
}
@Test
@TestMetadata("noParameterTypRefInFuncionalType.kt")
public void testNoParameterTypRefInFuncionalType() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInFuncionalType.kt");
}
@Test
@TestMetadata("noParameterTypRefInFunction.kt")
public void testNoParameterTypRefInFunction() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInFunction.kt");
}
@Test
@TestMetadata("noParameterTypRefInLambda.kt")
public void testNoParameterTypRefInLambda() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInLambda.kt");
}
@Test
@TestMetadata("noParameterTypRefInPrimaryConstructor.kt")
public void testNoParameterTypRefInPrimaryConstructor() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInPrimaryConstructor.kt");
}
@Test
@TestMetadata("noParameterTypRefInPrimaryConsturctorVal.kt")
public void testNoParameterTypRefInPrimaryConsturctorVal() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInPrimaryConsturctorVal.kt");
}
@Test
@TestMetadata("noParameterTypRefInSecondaryConstructor.kt")
public void testNoParameterTypRefInSecondaryConstructor() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInSecondaryConstructor.kt");
}
@Test
@TestMetadata("noParameterTypRefInSetter.kt")
public void testNoParameterTypRefInSetter() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/noParameterType/noParameterTypRefInSetter.kt");
}
}
}
@Nested
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions")
@TestDataPath("$PROJECT_ROOT")
public class Expressions {
@Test
public void testAllFilesPresentInExpressions() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("annotated.kt")
public void testAnnotated() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/annotated.kt");
}
@Test
@TestMetadata("arrayAccess.kt")
public void testArrayAccess() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/arrayAccess.kt");
}
@Test
@TestMetadata("arrayAssignment.kt")
public void testArrayAssignment() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/arrayAssignment.kt");
}
@Test
@TestMetadata("branches.kt")
public void testBranches() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/branches.kt");
}
@Test
@TestMetadata("callableReferences.kt")
public void testCallableReferences() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/callableReferences.kt");
}
@Test
@TestMetadata("calls.kt")
public void testCalls() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/calls.kt");
}
@Test
@TestMetadata("cascadeIf.kt")
public void testCascadeIf() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/cascadeIf.kt");
}
@Test
@TestMetadata("classReference.kt")
public void testClassReference() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/classReference.kt");
}
@Test
@TestMetadata("collectionLiterals.kt")
public void testCollectionLiterals() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/collectionLiterals.kt");
}
@Test
@TestMetadata("destructuring.kt")
public void testDestructuring() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/destructuring.kt");
}
@Test
@TestMetadata("for.kt")
public void testFor() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/for.kt");
}
@Test
@TestMetadata("genericCalls.kt")
public void testGenericCalls() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/genericCalls.kt");
}
@Test
@TestMetadata("in.kt")
public void testIn() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/in.kt");
}
@Test
@TestMetadata("inBrackets.kt")
public void testInBrackets() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/inBrackets.kt");
}
@Test
@TestMetadata("init.kt")
public void testInit() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/init.kt");
}
@Test
@TestMetadata("labelForInfix.kt")
public void testLabelForInfix() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/labelForInfix.kt");
}
@Test
@TestMetadata("lambda.kt")
public void testLambda() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/lambda.kt");
}
@Test
@TestMetadata("lambdaAndAnonymousFunction.kt")
public void testLambdaAndAnonymousFunction() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/lambdaAndAnonymousFunction.kt");
}
@Test
@TestMetadata("localDeclarationWithExpression.kt")
public void testLocalDeclarationWithExpression() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/localDeclarationWithExpression.kt");
}
@Test
@TestMetadata("locals.kt")
public void testLocals() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/locals.kt");
}
@Test
@TestMetadata("modifications.kt")
public void testModifications() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/modifications.kt");
}
@Test
@TestMetadata("namedArgument.kt")
public void testNamedArgument() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/namedArgument.kt");
}
@Test
@TestMetadata("nullability.kt")
public void testNullability() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/nullability.kt");
}
@Test
@TestMetadata("qualifierWithTypeArguments.kt")
public void testQualifierWithTypeArguments() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/qualifierWithTypeArguments.kt");
}
@Test
@TestMetadata("safeCallsWithAssignment.kt")
public void testSafeCallsWithAssignment() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/safeCallsWithAssignment.kt");
}
@Test
@TestMetadata("safeCallsWithAugmentedAssignment.kt")
public void testSafeCallsWithAugmentedAssignment() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/safeCallsWithAugmentedAssignment.kt");
}
@Test
@TestMetadata("safeCallsWithUnaryOperators.kt")
public void testSafeCallsWithUnaryOperators() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/safeCallsWithUnaryOperators.kt");
}
@Test
@TestMetadata("simpleReturns.kt")
public void testSimpleReturns() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/simpleReturns.kt");
}
@Test
@TestMetadata("super.kt")
public void testSuper() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/super.kt");
}
@Test
@TestMetadata("these.kt")
public void testThese() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/these.kt");
}
@Test
@TestMetadata("try.kt")
public void testTry() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/try.kt");
}
@Test
@TestMetadata("typeOperators.kt")
public void testTypeOperators() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/typeOperators.kt");
}
@Test
@TestMetadata("unary.kt")
public void testUnary() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/unary.kt");
}
@Test
@TestMetadata("variables.kt")
public void testVariables() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/variables.kt");
}
@Test
@TestMetadata("while.kt")
public void testWhile() throws Exception {
runTest("compiler/fir/raw-fir/psi2fir/testData/rawBuilder/expressions/while.kt");
}
}
}
@@ -0,0 +1,250 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.analysis.low.level.api.fir;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.util.KtTestUtil;
import org.jetbrains.kotlin.test.TestMetadata;
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.analysis.api.GenerateAnalysisApiTestsKt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("analysis/low-level-api-fir/testdata/lazyResolve")
@TestDataPath("$PROJECT_ROOT")
public class FirOutOfContentRootLazyDeclarationResolveTestGenerated extends AbstractFirOutOfContentRootLazyDeclarationResolveTest {
@Test
public void testAllFilesPresentInLazyResolve() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/lazyResolve"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("annotationParameters.kt")
public void testAnnotationParameters() throws Exception {
runTest("analysis/low-level-api-fir/testdata/lazyResolve/annotationParameters.kt");
}
@Test
@TestMetadata("annotations.kt")
public void testAnnotations() throws Exception {
runTest("analysis/low-level-api-fir/testdata/lazyResolve/annotations.kt");
}
@Test
@TestMetadata("classMembers.kt")
public void testClassMembers() throws Exception {
runTest("analysis/low-level-api-fir/testdata/lazyResolve/classMembers.kt");
}
@Test
@TestMetadata("delegates.kt")
public void testDelegates() throws Exception {
runTest("analysis/low-level-api-fir/testdata/lazyResolve/delegates.kt");
}
@Test
@TestMetadata("enumEntry.kt")
public void testEnumEntry() throws Exception {
runTest("analysis/low-level-api-fir/testdata/lazyResolve/enumEntry.kt");
}
@Test
@TestMetadata("functionWithParameter.kt")
public void testFunctionWithParameter() throws Exception {
runTest("analysis/low-level-api-fir/testdata/lazyResolve/functionWithParameter.kt");
}
@Test
@TestMetadata("lambdaAsSAMInterface.kt")
public void testLambdaAsSAMInterface() throws Exception {
runTest("analysis/low-level-api-fir/testdata/lazyResolve/lambdaAsSAMInterface.kt");
}
@Test
@TestMetadata("parameterOfNonLocalSetter.kt")
public void testParameterOfNonLocalSetter() throws Exception {
runTest("analysis/low-level-api-fir/testdata/lazyResolve/parameterOfNonLocalSetter.kt");
}
@Test
@TestMetadata("propertyWithGetter.kt")
public void testPropertyWithGetter() throws Exception {
runTest("analysis/low-level-api-fir/testdata/lazyResolve/propertyWithGetter.kt");
}
@Test
@TestMetadata("propertyWithGetterAndSetter.kt")
public void testPropertyWithGetterAndSetter() throws Exception {
runTest("analysis/low-level-api-fir/testdata/lazyResolve/propertyWithGetterAndSetter.kt");
}
@Test
@TestMetadata("propertyWithInitializer.kt")
public void testPropertyWithInitializer() throws Exception {
runTest("analysis/low-level-api-fir/testdata/lazyResolve/propertyWithInitializer.kt");
}
@Test
@TestMetadata("secondaryConstructor.kt")
public void testSecondaryConstructor() throws Exception {
runTest("analysis/low-level-api-fir/testdata/lazyResolve/secondaryConstructor.kt");
}
@Test
@TestMetadata("superTypes.kt")
public void testSuperTypes() throws Exception {
runTest("analysis/low-level-api-fir/testdata/lazyResolve/superTypes.kt");
}
@Test
@TestMetadata("superTypesLoop.kt")
public void testSuperTypesLoop() throws Exception {
runTest("analysis/low-level-api-fir/testdata/lazyResolve/superTypesLoop.kt");
}
@Test
@TestMetadata("topLevelFunctions.kt")
public void testTopLevelFunctions() throws Exception {
runTest("analysis/low-level-api-fir/testdata/lazyResolve/topLevelFunctions.kt");
}
@Test
@TestMetadata("topLevelFunctionsWithExpressionBodyAndExplicitType.kt")
public void testTopLevelFunctionsWithExpressionBodyAndExplicitType() throws Exception {
runTest("analysis/low-level-api-fir/testdata/lazyResolve/topLevelFunctionsWithExpressionBodyAndExplicitType.kt");
}
@Test
@TestMetadata("topLevelFunctionsWithImplicitType.kt")
public void testTopLevelFunctionsWithImplicitType() throws Exception {
runTest("analysis/low-level-api-fir/testdata/lazyResolve/topLevelFunctionsWithImplicitType.kt");
}
@Test
@TestMetadata("typeParameterOfNonLocalFunction.kt")
public void testTypeParameterOfNonLocalFunction() throws Exception {
runTest("analysis/low-level-api-fir/testdata/lazyResolve/typeParameterOfNonLocalFunction.kt");
}
@Test
@TestMetadata("typeParameterOfTopFunction.kt")
public void testTypeParameterOfTopFunction() throws Exception {
runTest("analysis/low-level-api-fir/testdata/lazyResolve/typeParameterOfTopFunction.kt");
}
@Test
@TestMetadata("typeParameterOfTopSetter.kt")
public void testTypeParameterOfTopSetter() throws Exception {
runTest("analysis/low-level-api-fir/testdata/lazyResolve/typeParameterOfTopSetter.kt");
}
@Nested
@TestMetadata("analysis/low-level-api-fir/testdata/lazyResolve/classes")
@TestDataPath("$PROJECT_ROOT")
public class Classes {
@Test
public void testAllFilesPresentInClasses() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/lazyResolve/classes"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("classWithTypeParameters.kt")
public void testClassWithTypeParameters() throws Exception {
runTest("analysis/low-level-api-fir/testdata/lazyResolve/classes/classWithTypeParameters.kt");
}
@Test
@TestMetadata("functionInValueClass.kt")
public void testFunctionInValueClass() throws Exception {
runTest("analysis/low-level-api-fir/testdata/lazyResolve/classes/functionInValueClass.kt");
}
@Test
@TestMetadata("nestedClassWithPropertiesOverrides.kt")
public void testNestedClassWithPropertiesOverrides() throws Exception {
runTest("analysis/low-level-api-fir/testdata/lazyResolve/classes/nestedClassWithPropertiesOverrides.kt");
}
}
@Nested
@TestMetadata("analysis/low-level-api-fir/testdata/lazyResolve/errors")
@TestDataPath("$PROJECT_ROOT")
public class Errors {
@Test
public void testAllFilesPresentInErrors() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/lazyResolve/errors"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("anonymousObjectInInvalidPosition.kt")
public void testAnonymousObjectInInvalidPosition() throws Exception {
runTest("analysis/low-level-api-fir/testdata/lazyResolve/errors/anonymousObjectInInvalidPosition.kt");
}
}
@Nested
@TestMetadata("analysis/low-level-api-fir/testdata/lazyResolve/functions")
@TestDataPath("$PROJECT_ROOT")
public class Functions {
@Test
public void testAllFilesPresentInFunctions() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/lazyResolve/functions"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("functionCallWithGenericResult.kt")
public void testFunctionCallWithGenericResult() throws Exception {
runTest("analysis/low-level-api-fir/testdata/lazyResolve/functions/functionCallWithGenericResult.kt");
}
@Test
@TestMetadata("functionWithGenericExpectedTypeInside.kt")
public void testFunctionWithGenericExpectedTypeInside() throws Exception {
runTest("analysis/low-level-api-fir/testdata/lazyResolve/functions/functionWithGenericExpectedTypeInside.kt");
}
@Test
@TestMetadata("functionWithTypeParameters.kt")
public void testFunctionWithTypeParameters() throws Exception {
runTest("analysis/low-level-api-fir/testdata/lazyResolve/functions/functionWithTypeParameters.kt");
}
}
@Nested
@TestMetadata("analysis/low-level-api-fir/testdata/lazyResolve/properties")
@TestDataPath("$PROJECT_ROOT")
public class Properties {
@Test
public void testAllFilesPresentInProperties() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/lazyResolve/properties"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("propertyWithTypeParameters.kt")
public void testPropertyWithTypeParameters() throws Exception {
runTest("analysis/low-level-api-fir/testdata/lazyResolve/properties/propertyWithTypeParameters.kt");
}
}
@Nested
@TestMetadata("analysis/low-level-api-fir/testdata/lazyResolve/typeAliases")
@TestDataPath("$PROJECT_ROOT")
public class TypeAliases {
@Test
public void testAllFilesPresentInTypeAliases() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/lazyResolve/typeAliases"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("typeAliasWithTypeParameters.kt")
public void testTypeAliasWithTypeParameters() throws Exception {
runTest("analysis/low-level-api-fir/testdata/lazyResolve/typeAliases/typeAliasWithTypeParameters.kt");
}
}
}
@@ -18,7 +18,7 @@ import java.util.regex.Pattern;
@SuppressWarnings("all")
@TestMetadata("compiler/fir/raw-fir/psi2fir/testData/rawBuilder")
@TestDataPath("$PROJECT_ROOT")
public class FirLazyBodiesCalculatorTestGenerated extends AbstractFirLazyBodiesCalculatorTest {
public class FirSourceLazyBodiesCalculatorTestGenerated extends AbstractFirSourceLazyBodiesCalculatorTest {
@Test
public void testAllFilesPresentInRawBuilder() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/fir/raw-fir/psi2fir/testData/rawBuilder"), Pattern.compile("^(.+)\\.kt$"), null, true);
@@ -18,7 +18,7 @@ import java.util.regex.Pattern;
@SuppressWarnings("all")
@TestMetadata("analysis/low-level-api-fir/testdata/lazyResolve")
@TestDataPath("$PROJECT_ROOT")
public class FirLazyDeclarationResolveTestGenerated extends AbstractFirLazyDeclarationResolveTest {
public class FirSourceLazyDeclarationResolveTestGenerated extends AbstractFirSourceLazyDeclarationResolveTest {
@Test
public void testAllFilesPresentInLazyResolve() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/lazyResolve"), Pattern.compile("^(.+)\\.kt$"), null, true);
@@ -0,0 +1,852 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.analysis.low.level.api.fir;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.util.KtTestUtil;
import org.jetbrains.kotlin.test.TestMetadata;
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.analysis.api.GenerateAnalysisApiTestsKt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("analysis/low-level-api-fir/testdata/getOrBuildFir")
@TestDataPath("$PROJECT_ROOT")
public class OutOfContentRootGetOrBuildFirTestGenerated extends AbstractOutOfContentRootGetOrBuildFirTest {
@Test
public void testAllFilesPresentInGetOrBuildFir() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/getOrBuildFir"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Nested
@TestMetadata("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations")
@TestDataPath("$PROJECT_ROOT")
public class Annotations {
@Test
public void testAllFilesPresentInAnnotations() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("annotationApplicationArgument.kt")
public void testAnnotationApplicationArgument() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/annotationApplicationArgument.kt");
}
@Test
@TestMetadata("annotationApplicationArgumentList.kt")
public void testAnnotationApplicationArgumentList() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/annotationApplicationArgumentList.kt");
}
@Test
@TestMetadata("annotationApplicationCallExpression.kt")
public void testAnnotationApplicationCallExpression() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/annotationApplicationCallExpression.kt");
}
@Test
@TestMetadata("annotationApplicationVarargArgument.kt")
public void testAnnotationApplicationVarargArgument() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/annotationApplicationVarargArgument.kt");
}
@Test
@TestMetadata("annotationApplicationWithArguments.kt")
public void testAnnotationApplicationWithArguments() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/annotationApplicationWithArguments.kt");
}
@Test
@TestMetadata("annotationApplicationWithArgumentsOnCallSite.kt")
public void testAnnotationApplicationWithArgumentsOnCallSite() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/annotationApplicationWithArgumentsOnCallSite.kt");
}
@Test
@TestMetadata("danglingAnnotation.kt")
public void testDanglingAnnotation() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/danglingAnnotation.kt");
}
@Test
@TestMetadata("danglingAnnotationInClass.kt")
public void testDanglingAnnotationInClass() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/danglingAnnotationInClass.kt");
}
@Test
@TestMetadata("fileAnnotation.kt")
public void testFileAnnotation() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/fileAnnotation.kt");
}
@Test
@TestMetadata("retentionValue.kt")
public void testRetentionValue() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/annotations/retentionValue.kt");
}
}
@Nested
@TestMetadata("analysis/low-level-api-fir/testdata/getOrBuildFir/calls")
@TestDataPath("$PROJECT_ROOT")
public class Calls {
@Test
public void testAllFilesPresentInCalls() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/getOrBuildFir/calls"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("callArgument.kt")
public void testCallArgument() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/callArgument.kt");
}
@Test
@TestMetadata("calllTypeArguments.kt")
public void testCalllTypeArguments() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/calllTypeArguments.kt");
}
@Test
@TestMetadata("compoundAssignOnVal.kt")
public void testCompoundAssignOnVal() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/compoundAssignOnVal.kt");
}
@Test
@TestMetadata("compoundAssignOnVal_lhs.kt")
public void testCompoundAssignOnVal_lhs() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/compoundAssignOnVal_lhs.kt");
}
@Test
@TestMetadata("compoundAssignOnVar.kt")
public void testCompoundAssignOnVar() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/compoundAssignOnVar.kt");
}
@Test
@TestMetadata("compoundAssignOnVar_lhs.kt")
public void testCompoundAssignOnVar_lhs() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/compoundAssignOnVar_lhs.kt");
}
@Test
@TestMetadata("compoundAssignWithArrayAccessConvention.kt")
public void testCompoundAssignWithArrayAccessConvention() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/compoundAssignWithArrayAccessConvention.kt");
}
@Test
@TestMetadata("compoundAssignWithArrayAccessConvention_lhs.kt")
public void testCompoundAssignWithArrayAccessConvention_lhs() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/compoundAssignWithArrayAccessConvention_lhs.kt");
}
@Test
@TestMetadata("compoundAssignWithArrayAccessConvention_propertyAccess.kt")
public void testCompoundAssignWithArrayAccessConvention_propertyAccess() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/compoundAssignWithArrayAccessConvention_propertyAccess.kt");
}
@Test
@TestMetadata("compoundAssignWithArrayGetConvention.kt")
public void testCompoundAssignWithArrayGetConvention() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/compoundAssignWithArrayGetConvention.kt");
}
@Test
@TestMetadata("compoundAssignWithArrayGetConvention_lhs.kt")
public void testCompoundAssignWithArrayGetConvention_lhs() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/compoundAssignWithArrayGetConvention_lhs.kt");
}
@Test
@TestMetadata("constructorDelegationSuperCall.kt")
public void testConstructorDelegationSuperCall() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/constructorDelegationSuperCall.kt");
}
@Test
@TestMetadata("constructorDelegationThisCall.kt")
public void testConstructorDelegationThisCall() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/constructorDelegationThisCall.kt");
}
@Test
@TestMetadata("functionCallArgumentList.kt")
public void testFunctionCallArgumentList() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/functionCallArgumentList.kt");
}
@Test
@TestMetadata("incWithArrayAccessConvention.kt")
public void testIncWithArrayAccessConvention() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/incWithArrayAccessConvention.kt");
}
@Test
@TestMetadata("incWithArrayAccessConvention_propertyAccess.kt")
public void testIncWithArrayAccessConvention_propertyAccess() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/incWithArrayAccessConvention_propertyAccess.kt");
}
@Test
@TestMetadata("incWithArrayAccessConvention_set.kt")
public void testIncWithArrayAccessConvention_set() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/incWithArrayAccessConvention_set.kt");
}
@Test
@TestMetadata("invokeCallArgumentList.kt")
public void testInvokeCallArgumentList() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/invokeCallArgumentList.kt");
}
@Test
@TestMetadata("qualifiedCallSelector.kt")
public void testQualifiedCallSelector() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/qualifiedCallSelector.kt");
}
@Test
@TestMetadata("qualifiedWholeCall.kt")
public void testQualifiedWholeCall() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/qualifiedWholeCall.kt");
}
@Test
@TestMetadata("setOperator.kt")
public void testSetOperator() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/calls/setOperator.kt");
}
}
@Nested
@TestMetadata("analysis/low-level-api-fir/testdata/getOrBuildFir/declarations")
@TestDataPath("$PROJECT_ROOT")
public class Declarations {
@Test
public void testAllFilesPresentInDeclarations() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/getOrBuildFir/declarations"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("destructuring.kt")
public void testDestructuring() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/destructuring.kt");
}
@Test
@TestMetadata("destructuringEntry.kt")
public void testDestructuringEntry() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/destructuringEntry.kt");
}
@Test
@TestMetadata("objectLiteral.kt")
public void testObjectLiteral() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/objectLiteral.kt");
}
@Test
@TestMetadata("objectLiteralExpression.kt")
public void testObjectLiteralExpression() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/objectLiteralExpression.kt");
}
@Test
@TestMetadata("propertyDelegate.kt")
public void testPropertyDelegate() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegate.kt");
}
@Test
@TestMetadata("propertyDelegateExpression.kt")
public void testPropertyDelegateExpression() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/declarations/propertyDelegateExpression.kt");
}
}
@Nested
@TestMetadata("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions")
@TestDataPath("$PROJECT_ROOT")
public class Expressions {
@Test
public void testAllFilesPresentInExpressions() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("arrayAccessExpression.kt")
public void testArrayAccessExpression() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions/arrayAccessExpression.kt");
}
@Test
@TestMetadata("arrayIndexExpressionWithInc.kt")
public void testArrayIndexExpressionWithInc() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions/arrayIndexExpressionWithInc.kt");
}
@Test
@TestMetadata("asExpression.kt")
public void testAsExpression() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions/asExpression.kt");
}
@Test
@TestMetadata("binaryExpression.kt")
public void testBinaryExpression() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions/binaryExpression.kt");
}
@Test
@TestMetadata("binaryExpressionOperator.kt")
public void testBinaryExpressionOperator() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions/binaryExpressionOperator.kt");
}
@Test
@TestMetadata("blockExpression.kt")
public void testBlockExpression() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions/blockExpression.kt");
}
@Test
@TestMetadata("boolLiteral.kt")
public void testBoolLiteral() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions/boolLiteral.kt");
}
@Test
@TestMetadata("classAccessExpression.kt")
public void testClassAccessExpression() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions/classAccessExpression.kt");
}
@Test
@TestMetadata("forExpression.kt")
public void testForExpression() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions/forExpression.kt");
}
@Test
@TestMetadata("forExpressionRange.kt")
public void testForExpressionRange() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions/forExpressionRange.kt");
}
@Test
@TestMetadata("forExpressionVariable.kt")
public void testForExpressionVariable() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions/forExpressionVariable.kt");
}
@Test
@TestMetadata("ifExpression.kt")
public void testIfExpression() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions/ifExpression.kt");
}
@Test
@TestMetadata("incExpression.kt")
public void testIncExpression() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions/incExpression.kt");
}
@Test
@TestMetadata("insidePlusAssignTarget.kt")
public void testInsidePlusAssignTarget() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions/insidePlusAssignTarget.kt");
}
@Test
@TestMetadata("intLiteral.kt")
public void testIntLiteral() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions/intLiteral.kt");
}
@Test
@TestMetadata("intLiteral_minusOne_entire.kt")
public void testIntLiteral_minusOne_entire() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions/intLiteral_minusOne_entire.kt");
}
@Test
@TestMetadata("intLiteral_minusOne_justOne.kt")
public void testIntLiteral_minusOne_justOne() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions/intLiteral_minusOne_justOne.kt");
}
@Test
@TestMetadata("intLiteral_plusOne_entire.kt")
public void testIntLiteral_plusOne_entire() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions/intLiteral_plusOne_entire.kt");
}
@Test
@TestMetadata("intLiteral_plusOne_justOne.kt")
public void testIntLiteral_plusOne_justOne() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions/intLiteral_plusOne_justOne.kt");
}
@Test
@TestMetadata("isExpression.kt")
public void testIsExpression() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions/isExpression.kt");
}
@Test
@TestMetadata("lambdaExpression.kt")
public void testLambdaExpression() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions/lambdaExpression.kt");
}
@Test
@TestMetadata("objectLiteralExpression.kt")
public void testObjectLiteralExpression() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions/objectLiteralExpression.kt");
}
@Test
@TestMetadata("parenthesizedExpression.kt")
public void testParenthesizedExpression() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions/parenthesizedExpression.kt");
}
@Test
@TestMetadata("propertyReferenceExpression.kt")
public void testPropertyReferenceExpression() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions/propertyReferenceExpression.kt");
}
@Test
@TestMetadata("stringLiteral.kt")
public void testStringLiteral() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions/stringLiteral.kt");
}
@Test
@TestMetadata("stringTemplateExpressionEntry.kt")
public void testStringTemplateExpressionEntry() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions/stringTemplateExpressionEntry.kt");
}
@Test
@TestMetadata("throwExpression.kt")
public void testThrowExpression() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions/throwExpression.kt");
}
@Test
@TestMetadata("tryExpression.kt")
public void testTryExpression() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions/tryExpression.kt");
}
@Test
@TestMetadata("unraryExpression.kt")
public void testUnraryExpression() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions/unraryExpression.kt");
}
@Test
@TestMetadata("unraryExpressionOperator.kt")
public void testUnraryExpressionOperator() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions/unraryExpressionOperator.kt");
}
@Test
@TestMetadata("whenExpression.kt")
public void testWhenExpression() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions/whenExpression.kt");
}
@Test
@TestMetadata("whileExpression.kt")
public void testWhileExpression() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions/whileExpression.kt");
}
@Test
@TestMetadata("wholeStringTemplate.kt")
public void testWholeStringTemplate() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/expressions/wholeStringTemplate.kt");
}
}
@Nested
@TestMetadata("analysis/low-level-api-fir/testdata/getOrBuildFir/inImport")
@TestDataPath("$PROJECT_ROOT")
public class InImport {
@Test
public void testAllFilesPresentInInImport() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/getOrBuildFir/inImport"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("firstImportNamePart.kt")
public void testFirstImportNamePart() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/inImport/firstImportNamePart.kt");
}
@Test
@TestMetadata("importList.kt")
public void testImportList() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/inImport/importList.kt");
}
@Test
@TestMetadata("middleImportNamePart.kt")
public void testMiddleImportNamePart() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/inImport/middleImportNamePart.kt");
}
@Test
@TestMetadata("qualifiedImportNamePart.kt")
public void testQualifiedImportNamePart() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/inImport/qualifiedImportNamePart.kt");
}
@Test
@TestMetadata("wholeImportDirective.kt")
public void testWholeImportDirective() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/inImport/wholeImportDirective.kt");
}
@Test
@TestMetadata("wholeImportName.kt")
public void testWholeImportName() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/inImport/wholeImportName.kt");
}
}
@Nested
@TestMetadata("analysis/low-level-api-fir/testdata/getOrBuildFir/inPackage")
@TestDataPath("$PROJECT_ROOT")
public class InPackage {
@Test
public void testAllFilesPresentInInPackage() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/getOrBuildFir/inPackage"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("firstPackageNamePart.kt")
public void testFirstPackageNamePart() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/inPackage/firstPackageNamePart.kt");
}
@Test
@TestMetadata("middlePackageNamePart.kt")
public void testMiddlePackageNamePart() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/inPackage/middlePackageNamePart.kt");
}
@Test
@TestMetadata("qualifiedPackageNamePart.kt")
public void testQualifiedPackageNamePart() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/inPackage/qualifiedPackageNamePart.kt");
}
@Test
@TestMetadata("wholePackageDirective.kt")
public void testWholePackageDirective() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/inPackage/wholePackageDirective.kt");
}
@Test
@TestMetadata("wholePackageName.kt")
public void testWholePackageName() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/inPackage/wholePackageName.kt");
}
}
@Nested
@TestMetadata("analysis/low-level-api-fir/testdata/getOrBuildFir/invalidCode")
@TestDataPath("$PROJECT_ROOT")
public class InvalidCode {
@Test
public void testAllFilesPresentInInvalidCode() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/getOrBuildFir/invalidCode"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("javaClassLiteral.kt")
public void testJavaClassLiteral() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/invalidCode/javaClassLiteral.kt");
}
@Test
@TestMetadata("secondaryConstructor.kt")
public void testSecondaryConstructor() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/invalidCode/secondaryConstructor.kt");
}
}
@Nested
@TestMetadata("analysis/low-level-api-fir/testdata/getOrBuildFir/qualifiedExpressions")
@TestDataPath("$PROJECT_ROOT")
public class QualifiedExpressions {
@Test
public void testAllFilesPresentInQualifiedExpressions() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/getOrBuildFir/qualifiedExpressions"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("firstPartOfQualifiedCallWithNestedClasses.kt")
public void testFirstPartOfQualifiedCallWithNestedClasses() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/qualifiedExpressions/firstPartOfQualifiedCallWithNestedClasses.kt");
}
@Test
@TestMetadata("lastPartOfQualifiedCallWithNestedClasses.kt")
public void testLastPartOfQualifiedCallWithNestedClasses() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/qualifiedExpressions/lastPartOfQualifiedCallWithNestedClasses.kt");
}
@Test
@TestMetadata("middlePartOfQualifiedCallWithNestedClasses.kt")
public void testMiddlePartOfQualifiedCallWithNestedClasses() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/qualifiedExpressions/middlePartOfQualifiedCallWithNestedClasses.kt");
}
@Test
@TestMetadata("qualifiedPartOfQualifiedCallWithNestedClasses.kt")
public void testQualifiedPartOfQualifiedCallWithNestedClasses() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/qualifiedExpressions/qualifiedPartOfQualifiedCallWithNestedClasses.kt");
}
}
@Nested
@TestMetadata("analysis/low-level-api-fir/testdata/getOrBuildFir/types")
@TestDataPath("$PROJECT_ROOT")
public class Types {
@Test
public void testAllFilesPresentInTypes() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/getOrBuildFir/types"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("functionalType.kt")
public void testFunctionalType() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/types/functionalType.kt");
}
@Test
@TestMetadata("functionalTypeArgument.kt")
public void testFunctionalTypeArgument() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/types/functionalTypeArgument.kt");
}
@Test
@TestMetadata("invalidTypeArgumentsCount.kt")
public void testInvalidTypeArgumentsCount() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/types/invalidTypeArgumentsCount.kt");
}
@Test
@TestMetadata("invalidTypeArgumentsCountArgument.kt")
public void testInvalidTypeArgumentsCountArgument() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/types/invalidTypeArgumentsCountArgument.kt");
}
@Test
@TestMetadata("invalidTypeArgumentsCountFirstArgument.kt")
public void testInvalidTypeArgumentsCountFirstArgument() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/types/invalidTypeArgumentsCountFirstArgument.kt");
}
@Test
@TestMetadata("invalidTypeArgumentsCountLastArgument.kt")
public void testInvalidTypeArgumentsCountLastArgument() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/types/invalidTypeArgumentsCountLastArgument.kt");
}
@Test
@TestMetadata("nestedTypeArgument.kt")
public void testNestedTypeArgument() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/types/nestedTypeArgument.kt");
}
@Test
@TestMetadata("nullableType.kt")
public void testNullableType() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/types/nullableType.kt");
}
@Test
@TestMetadata("nullableTypeWithooutQuestionMark.kt")
public void testNullableTypeWithooutQuestionMark() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/types/nullableTypeWithooutQuestionMark.kt");
}
@Test
@TestMetadata("typeArgument.kt")
public void testTypeArgument() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/types/typeArgument.kt");
}
@Test
@TestMetadata("unresolvedTypeArgumentResolvedTypeConsturctor.kt")
public void testUnresolvedTypeArgumentResolvedTypeConsturctor() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/types/unresolvedTypeArgumentResolvedTypeConsturctor.kt");
}
@Test
@TestMetadata("unresolvedTypeConsturctorResolvedNestedTypeArgument.kt")
public void testUnresolvedTypeConsturctorResolvedNestedTypeArgument() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/types/unresolvedTypeConsturctorResolvedNestedTypeArgument.kt");
}
@Test
@TestMetadata("unresolvedTypeConsturctorResolvedTypeArgument.kt")
public void testUnresolvedTypeConsturctorResolvedTypeArgument() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/types/unresolvedTypeConsturctorResolvedTypeArgument.kt");
}
@Test
@TestMetadata("wholeType.kt")
public void testWholeType() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/types/wholeType.kt");
}
}
@Nested
@TestMetadata("analysis/low-level-api-fir/testdata/getOrBuildFir/wholeDeclaration")
@TestDataPath("$PROJECT_ROOT")
public class WholeDeclaration {
@Test
public void testAllFilesPresentInWholeDeclaration() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/getOrBuildFir/wholeDeclaration"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("classTypeParemeter.kt")
public void testClassTypeParemeter() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/wholeDeclaration/classTypeParemeter.kt");
}
@Test
@TestMetadata("enumEntry.kt")
public void testEnumEntry() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/wholeDeclaration/enumEntry.kt");
}
@Test
@TestMetadata("functionTypeParemeter.kt")
public void testFunctionTypeParemeter() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/wholeDeclaration/functionTypeParemeter.kt");
}
@Test
@TestMetadata("functionValueParameter.kt")
public void testFunctionValueParameter() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/wholeDeclaration/functionValueParameter.kt");
}
@Test
@TestMetadata("getter.kt")
public void testGetter() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/wholeDeclaration/getter.kt");
}
@Test
@TestMetadata("localClass.kt")
public void testLocalClass() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/wholeDeclaration/localClass.kt");
}
@Test
@TestMetadata("localFunction.kt")
public void testLocalFunction() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/wholeDeclaration/localFunction.kt");
}
@Test
@TestMetadata("localProperty.kt")
public void testLocalProperty() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/wholeDeclaration/localProperty.kt");
}
@Test
@TestMetadata("memberFunction.kt")
public void testMemberFunction() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/wholeDeclaration/memberFunction.kt");
}
@Test
@TestMetadata("memberProperty.kt")
public void testMemberProperty() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/wholeDeclaration/memberProperty.kt");
}
@Test
@TestMetadata("memberTypeAlias.kt")
public void testMemberTypeAlias() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/wholeDeclaration/memberTypeAlias.kt");
}
@Test
@TestMetadata("nestedClass.kt")
public void testNestedClass() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/wholeDeclaration/nestedClass.kt");
}
@Test
@TestMetadata("primaryConstructorValValueParameter.kt")
public void testPrimaryConstructorValValueParameter() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/wholeDeclaration/primaryConstructorValValueParameter.kt");
}
@Test
@TestMetadata("primaryConstructorValueParameter.kt")
public void testPrimaryConstructorValueParameter() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/wholeDeclaration/primaryConstructorValueParameter.kt");
}
@Test
@TestMetadata("secondaryConstructorValueParameter.kt")
public void testSecondaryConstructorValueParameter() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/wholeDeclaration/secondaryConstructorValueParameter.kt");
}
@Test
@TestMetadata("setter.kt")
public void testSetter() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/wholeDeclaration/setter.kt");
}
@Test
@TestMetadata("topLevelClass.kt")
public void testTopLevelClass() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/wholeDeclaration/topLevelClass.kt");
}
@Test
@TestMetadata("topLevelFunction.kt")
public void testTopLevelFunction() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/wholeDeclaration/topLevelFunction.kt");
}
@Test
@TestMetadata("topLevelProperty.kt")
public void testTopLevelProperty() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/wholeDeclaration/topLevelProperty.kt");
}
@Test
@TestMetadata("topLevelTypelTypeAlias.kt")
public void testTopLevelTypelTypeAlias() throws Exception {
runTest("analysis/low-level-api-fir/testdata/getOrBuildFir/wholeDeclaration/topLevelTypelTypeAlias.kt");
}
}
}
@@ -0,0 +1,68 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.analysis.low.level.api.fir;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.util.KtTestUtil;
import org.jetbrains.kotlin.test.TestMetadata;
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.analysis.api.GenerateAnalysisApiTestsKt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("analysis/low-level-api-fir/testdata/partialRawBuilder")
@TestDataPath("$PROJECT_ROOT")
public class OutOfContentRootPartialRawFirBuilderTestCaseGenerated extends AbstractOutOfContentRootPartialRawFirBuilderTestCase {
@Test
public void testAllFilesPresentInPartialRawBuilder() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/partialRawBuilder"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("localFunction.kt")
public void testLocalFunction() throws Exception {
runTest("analysis/low-level-api-fir/testdata/partialRawBuilder/localFunction.kt");
}
@Test
@TestMetadata("memberFunction.kt")
public void testMemberFunction() throws Exception {
runTest("analysis/low-level-api-fir/testdata/partialRawBuilder/memberFunction.kt");
}
@Test
@TestMetadata("memberProperty.kt")
public void testMemberProperty() throws Exception {
runTest("analysis/low-level-api-fir/testdata/partialRawBuilder/memberProperty.kt");
}
@Test
@TestMetadata("paramemtersCatching.kt")
public void testParamemtersCatching() throws Exception {
runTest("analysis/low-level-api-fir/testdata/partialRawBuilder/paramemtersCatching.kt");
}
@Test
@TestMetadata("simpleFunction.kt")
public void testSimpleFunction() throws Exception {
runTest("analysis/low-level-api-fir/testdata/partialRawBuilder/simpleFunction.kt");
}
@Test
@TestMetadata("simpleVal.kt")
public void testSimpleVal() throws Exception {
runTest("analysis/low-level-api-fir/testdata/partialRawBuilder/simpleVal.kt");
}
@Test
@TestMetadata("simpleVar.kt")
public void testSimpleVar() throws Exception {
runTest("analysis/low-level-api-fir/testdata/partialRawBuilder/simpleVar.kt");
}
}
@@ -18,7 +18,7 @@ import java.util.regex.Pattern;
@SuppressWarnings("all")
@TestMetadata("analysis/low-level-api-fir/testdata/getOrBuildFir")
@TestDataPath("$PROJECT_ROOT")
public class GetOrBuildFirTestGenerated extends AbstractGetOrBuildFirTest {
public class SourceGetOrBuildFirTestGenerated extends AbstractSourceGetOrBuildFirTest {
@Test
public void testAllFilesPresentInGetOrBuildFir() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/getOrBuildFir"), Pattern.compile("^(.+)\\.kt$"), null, true);
@@ -18,7 +18,7 @@ import java.util.regex.Pattern;
@SuppressWarnings("all")
@TestMetadata("analysis/low-level-api-fir/testdata/partialRawBuilder")
@TestDataPath("$PROJECT_ROOT")
public class PartialRawFirBuilderTestCaseGenerated extends AbstractPartialRawFirBuilderTestCase {
public class SourcePartialRawFirBuilderTestCaseGenerated extends AbstractSourcePartialRawFirBuilderTestCase {
@Test
public void testAllFilesPresentInPartialRawBuilder() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/partialRawBuilder"), Pattern.compile("^(.+)\\.kt$"), null, true);
@@ -15,6 +15,7 @@ import org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostics.fir.Persisten
import org.jetbrains.kotlin.analysis.low.level.api.fir.renderWithClassName
import org.jetbrains.kotlin.analysis.low.level.api.fir.resolveWithClearCaches
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.base.AbstractLowLevelApiSingleFileTest
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.configurators.AnalysisApiFirSourceTestConfigurator
import org.jetbrains.kotlin.fir.FirElement
import org.jetbrains.kotlin.fir.SessionConfiguration
import org.jetbrains.kotlin.fir.analysis.collectors.AbstractDiagnosticCollectorVisitor
@@ -32,7 +33,9 @@ import org.jetbrains.kotlin.test.services.assertions
/**
* Check that every declaration is visited exactly one time during diagnostic collection
*/
abstract class AbstractDiagnosticTraversalCounterTest : AbstractLowLevelApiSingleFileTest() {
abstract class AbstractDiagnosticTraversalCounterTest : AbstractLowLevelApiSingleFileTest() {
override val configurator = AnalysisApiFirSourceTestConfigurator(analyseInDependentSession = false)
override fun doTestByFileStructure(ktFile: KtFile, moduleStructure: TestModuleStructure, testServices: TestServices) {
val handler = BeforeElementTestDiagnosticCollectionHandler()
resolveWithClearCaches(
@@ -27,6 +27,8 @@ import org.jetbrains.kotlin.analysis.low.level.api.fir.name
import org.jetbrains.kotlin.analysis.low.level.api.fir.resolveWithClearCaches
import org.jetbrains.kotlin.analysis.low.level.api.fir.sessions.LLFirResolvableModuleSession
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.base.AbstractLowLevelApiSingleFileTest
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.configurators.AnalysisApiFirOutOfContentRootTestConfigurator
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.configurators.AnalysisApiFirSourceTestConfigurator
import org.jetbrains.kotlin.analysis.project.structure.getKtModule
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.test.services.AssertionsService
@@ -34,7 +36,6 @@ import org.jetbrains.kotlin.test.services.TestModuleStructure
import org.jetbrains.kotlin.test.services.TestServices
import org.jetbrains.kotlin.test.services.assertions
abstract class AbstractFirContextCollectionTest : AbstractLowLevelApiSingleFileTest() {
override fun doTestByFileStructure(ktFile: KtFile, moduleStructure: TestModuleStructure, testServices: TestServices) {
val handler = BeforeElementTestDiagnosticCollectionHandler(testServices.assertions)
@@ -45,7 +46,7 @@ abstract class AbstractFirContextCollectionTest : AbstractLowLevelApiSingleFileT
register(BeforeElementDiagnosticCollectionHandler::class, handler)
}
) { firResolveSession ->
check(firResolveSession is LLFirSourceResolveSession)
check(!firResolveSession.isLibrarySession)
val session = firResolveSession.getSessionFor(ktFile.getKtModule()) as LLFirResolvableModuleSession
val fileStructureCache = session.moduleComponents.fileStructureCache
@@ -102,3 +103,10 @@ abstract class AbstractFirContextCollectionTest : AbstractLowLevelApiSingleFileT
}
}
abstract class AbstractFirSourceContextCollectionTest : AbstractFirContextCollectionTest() {
override val configurator = AnalysisApiFirSourceTestConfigurator(analyseInDependentSession = false)
}
abstract class AbstractFirOutOfContentRootContextCollectionTest : AbstractFirContextCollectionTest() {
override val configurator = AnalysisApiFirOutOfContentRootTestConfigurator
}
@@ -0,0 +1,146 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostic;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.util.KtTestUtil;
import org.jetbrains.kotlin.test.TestMetadata;
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.analysis.api.GenerateAnalysisApiTestsKt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("analysis/low-level-api-fir/testdata/fileStructure")
@TestDataPath("$PROJECT_ROOT")
public class FirOutOfContentRootContextCollectionTestGenerated extends AbstractFirOutOfContentRootContextCollectionTest {
@Test
public void testAllFilesPresentInFileStructure() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/fileStructure"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("class.kt")
public void testClass() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/class.kt");
}
@Test
@TestMetadata("classMemberProperty.kt")
public void testClassMemberProperty() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/classMemberProperty.kt");
}
@Test
@TestMetadata("danglingAnnotationClassLevel.kt")
public void testDanglingAnnotationClassLevel() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/danglingAnnotationClassLevel.kt");
}
@Test
@TestMetadata("danglingAnnotationTopLevel.kt")
public void testDanglingAnnotationTopLevel() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/danglingAnnotationTopLevel.kt");
}
@Test
@TestMetadata("declarationsInPropertyInit.kt")
public void testDeclarationsInPropertyInit() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/declarationsInPropertyInit.kt");
}
@Test
@TestMetadata("enumClass.kt")
public void testEnumClass() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/enumClass.kt");
}
@Test
@TestMetadata("enumClassWithBody.kt")
public void testEnumClassWithBody() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/enumClassWithBody.kt");
}
@Test
@TestMetadata("initBlock.kt")
public void testInitBlock() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/initBlock.kt");
}
@Test
@TestMetadata("localClass.kt")
public void testLocalClass() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/localClass.kt");
}
@Test
@TestMetadata("localFun.kt")
public void testLocalFun() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/localFun.kt");
}
@Test
@TestMetadata("localProperty.kt")
public void testLocalProperty() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/localProperty.kt");
}
@Test
@TestMetadata("memberTypeAlias.kt")
public void testMemberTypeAlias() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/memberTypeAlias.kt");
}
@Test
@TestMetadata("nestedClasses.kt")
public void testNestedClasses() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/nestedClasses.kt");
}
@Test
@TestMetadata("propertyAccessors.kt")
public void testPropertyAccessors() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/propertyAccessors.kt");
}
@Test
@TestMetadata("topLevelExpressionBodyFunWithType.kt")
public void testTopLevelExpressionBodyFunWithType() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/topLevelExpressionBodyFunWithType.kt");
}
@Test
@TestMetadata("topLevelExpressionBodyFunWithoutType.kt")
public void testTopLevelExpressionBodyFunWithoutType() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/topLevelExpressionBodyFunWithoutType.kt");
}
@Test
@TestMetadata("topLevelFunWithType.kt")
public void testTopLevelFunWithType() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/topLevelFunWithType.kt");
}
@Test
@TestMetadata("topLevelProperty.kt")
public void testTopLevelProperty() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/topLevelProperty.kt");
}
@Test
@TestMetadata("topLevelUnitFun.kt")
public void testTopLevelUnitFun() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/topLevelUnitFun.kt");
}
@Test
@TestMetadata("typeAlias.kt")
public void testTypeAlias() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/typeAlias.kt");
}
}
@@ -18,7 +18,7 @@ import java.util.regex.Pattern;
@SuppressWarnings("all")
@TestMetadata("analysis/low-level-api-fir/testdata/fileStructure")
@TestDataPath("$PROJECT_ROOT")
public class FirContextCollectionTestGenerated extends AbstractFirContextCollectionTest {
public class FirSourceContextCollectionTestGenerated extends AbstractFirSourceContextCollectionTest {
@Test
public void testAllFilesPresentInFileStructure() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/fileStructure"), Pattern.compile("^(.+)\\.kt$"), null, true);
@@ -15,6 +15,8 @@ import org.jetbrains.kotlin.analysis.low.level.api.fir.state.LLFirSourceResolveS
import org.jetbrains.kotlin.analysis.low.level.api.fir.api.getFirResolveSession
import org.jetbrains.kotlin.analysis.low.level.api.fir.sessions.LLFirResolvableModuleSession
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.base.AbstractLowLevelApiSingleFileTest
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.configurators.AnalysisApiFirOutOfContentRootTestConfigurator
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.configurators.AnalysisApiFirSourceTestConfigurator
import org.jetbrains.kotlin.analysis.project.structure.getKtModule
import org.jetbrains.kotlin.psi.*
import org.jetbrains.kotlin.psi.psiUtil.forEachDescendantOfType
@@ -97,7 +99,8 @@ abstract class AbstractFileStructureTest : AbstractLowLevelApiSingleFileTest() {
}
private fun KtFile.getFileStructure(): FileStructure {
val moduleFirResolveSession = getFirResolveSession() as LLFirSourceResolveSession
val moduleFirResolveSession = getFirResolveSession()
check(!moduleFirResolveSession.isLibrarySession)
val session = moduleFirResolveSession.getSessionFor(getKtModule()) as LLFirResolvableModuleSession
return session.moduleComponents.fileStructureCache.getFileStructure(this)
}
@@ -107,5 +110,12 @@ abstract class AbstractFileStructureTest : AbstractLowLevelApiSingleFileTest() {
add(getStructureElementFor(ktElement))
}
}
}
abstract class AbstractSourceFileStructureTest : AbstractFileStructureTest() {
override val configurator = AnalysisApiFirSourceTestConfigurator(analyseInDependentSession = false)
}
abstract class AbstractOutOfContentRootFileStructureTest : AbstractFileStructureTest() {
override val configurator = AnalysisApiFirOutOfContentRootTestConfigurator
}
@@ -0,0 +1,146 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.analysis.low.level.api.fir.file.structure;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.util.KtTestUtil;
import org.jetbrains.kotlin.test.TestMetadata;
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.analysis.api.GenerateAnalysisApiTestsKt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("analysis/low-level-api-fir/testdata/fileStructure")
@TestDataPath("$PROJECT_ROOT")
public class OutOfContentRootFileStructureTestGenerated extends AbstractOutOfContentRootFileStructureTest {
@Test
public void testAllFilesPresentInFileStructure() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/fileStructure"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("class.kt")
public void testClass() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/class.kt");
}
@Test
@TestMetadata("classMemberProperty.kt")
public void testClassMemberProperty() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/classMemberProperty.kt");
}
@Test
@TestMetadata("danglingAnnotationClassLevel.kt")
public void testDanglingAnnotationClassLevel() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/danglingAnnotationClassLevel.kt");
}
@Test
@TestMetadata("danglingAnnotationTopLevel.kt")
public void testDanglingAnnotationTopLevel() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/danglingAnnotationTopLevel.kt");
}
@Test
@TestMetadata("declarationsInPropertyInit.kt")
public void testDeclarationsInPropertyInit() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/declarationsInPropertyInit.kt");
}
@Test
@TestMetadata("enumClass.kt")
public void testEnumClass() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/enumClass.kt");
}
@Test
@TestMetadata("enumClassWithBody.kt")
public void testEnumClassWithBody() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/enumClassWithBody.kt");
}
@Test
@TestMetadata("initBlock.kt")
public void testInitBlock() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/initBlock.kt");
}
@Test
@TestMetadata("localClass.kt")
public void testLocalClass() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/localClass.kt");
}
@Test
@TestMetadata("localFun.kt")
public void testLocalFun() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/localFun.kt");
}
@Test
@TestMetadata("localProperty.kt")
public void testLocalProperty() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/localProperty.kt");
}
@Test
@TestMetadata("memberTypeAlias.kt")
public void testMemberTypeAlias() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/memberTypeAlias.kt");
}
@Test
@TestMetadata("nestedClasses.kt")
public void testNestedClasses() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/nestedClasses.kt");
}
@Test
@TestMetadata("propertyAccessors.kt")
public void testPropertyAccessors() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/propertyAccessors.kt");
}
@Test
@TestMetadata("topLevelExpressionBodyFunWithType.kt")
public void testTopLevelExpressionBodyFunWithType() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/topLevelExpressionBodyFunWithType.kt");
}
@Test
@TestMetadata("topLevelExpressionBodyFunWithoutType.kt")
public void testTopLevelExpressionBodyFunWithoutType() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/topLevelExpressionBodyFunWithoutType.kt");
}
@Test
@TestMetadata("topLevelFunWithType.kt")
public void testTopLevelFunWithType() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/topLevelFunWithType.kt");
}
@Test
@TestMetadata("topLevelProperty.kt")
public void testTopLevelProperty() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/topLevelProperty.kt");
}
@Test
@TestMetadata("topLevelUnitFun.kt")
public void testTopLevelUnitFun() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/topLevelUnitFun.kt");
}
@Test
@TestMetadata("typeAlias.kt")
public void testTypeAlias() throws Exception {
runTest("analysis/low-level-api-fir/testdata/fileStructure/typeAlias.kt");
}
}
@@ -18,7 +18,7 @@ import java.util.regex.Pattern;
@SuppressWarnings("all")
@TestMetadata("analysis/low-level-api-fir/testdata/fileStructure")
@TestDataPath("$PROJECT_ROOT")
public class FileStructureTestGenerated extends AbstractFileStructureTest {
public class SourceFileStructureTestGenerated extends AbstractSourceFileStructureTest {
@Test
public void testAllFilesPresentInFileStructure() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/fileStructure"), Pattern.compile("^(.+)\\.kt$"), null, true);
@@ -8,6 +8,8 @@ package org.jetbrains.kotlin.analysis.low.level.api.fir.resolve
import org.jetbrains.kotlin.analysis.low.level.api.fir.api.getOrBuildFirOfType
import org.jetbrains.kotlin.analysis.low.level.api.fir.resolveWithClearCaches
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.base.AbstractLowLevelApiSingleFileTest
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.configurators.AnalysisApiFirOutOfContentRootTestConfigurator
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.configurators.AnalysisApiFirSourceTestConfigurator
import org.jetbrains.kotlin.fir.declarations.FirFile
import org.jetbrains.kotlin.fir.renderer.FirRenderer
import org.jetbrains.kotlin.psi.KtFile
@@ -24,3 +26,11 @@ abstract class AbstractInnerDeclarationsResolvePhaseTest : AbstractLowLevelApiSi
}
}
}
abstract class AbstractSourceInnerDeclarationsResolvePhaseTest : AbstractInnerDeclarationsResolvePhaseTest() {
override val configurator = AnalysisApiFirSourceTestConfigurator(analyseInDependentSession = false)
}
abstract class AbstractOutOfContentRootInnerDeclarationsResolvePhaseTest : AbstractInnerDeclarationsResolvePhaseTest() {
override val configurator = AnalysisApiFirOutOfContentRootTestConfigurator
}
@@ -0,0 +1,104 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.analysis.low.level.api.fir.resolve;
import com.intellij.testFramework.TestDataPath;
import org.jetbrains.kotlin.test.util.KtTestUtil;
import org.jetbrains.kotlin.test.TestMetadata;
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.analysis.api.GenerateAnalysisApiTestsKt}. DO NOT MODIFY MANUALLY */
@SuppressWarnings("all")
@TestMetadata("analysis/low-level-api-fir/testdata/innerDeclarationsResolve")
@TestDataPath("$PROJECT_ROOT")
public class OutOfContentRootInnerDeclarationsResolvePhaseTestGenerated extends AbstractOutOfContentRootInnerDeclarationsResolvePhaseTest {
@Test
public void testAllFilesPresentInInnerDeclarationsResolve() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/innerDeclarationsResolve"), Pattern.compile("^(.+)\\.kt$"), null, true);
}
@Test
@TestMetadata("annonymousClass.kt")
public void testAnnonymousClass() throws Exception {
runTest("analysis/low-level-api-fir/testdata/innerDeclarationsResolve/annonymousClass.kt");
}
@Test
@TestMetadata("class.kt")
public void testClass() throws Exception {
runTest("analysis/low-level-api-fir/testdata/innerDeclarationsResolve/class.kt");
}
@Test
@TestMetadata("constructorParameter.kt")
public void testConstructorParameter() throws Exception {
runTest("analysis/low-level-api-fir/testdata/innerDeclarationsResolve/constructorParameter.kt");
}
@Test
@TestMetadata("enum.kt")
public void testEnum() throws Exception {
runTest("analysis/low-level-api-fir/testdata/innerDeclarationsResolve/enum.kt");
}
@Test
@TestMetadata("funWithoutTypes.kt")
public void testFunWithoutTypes() throws Exception {
runTest("analysis/low-level-api-fir/testdata/innerDeclarationsResolve/funWithoutTypes.kt");
}
@Test
@TestMetadata("functionValueParameter.kt")
public void testFunctionValueParameter() throws Exception {
runTest("analysis/low-level-api-fir/testdata/innerDeclarationsResolve/functionValueParameter.kt");
}
@Test
@TestMetadata("functionWithImplicitType.kt")
public void testFunctionWithImplicitType() throws Exception {
runTest("analysis/low-level-api-fir/testdata/innerDeclarationsResolve/functionWithImplicitType.kt");
}
@Test
@TestMetadata("lambdaInImplicitFunBody.kt")
public void testLambdaInImplicitFunBody() throws Exception {
runTest("analysis/low-level-api-fir/testdata/innerDeclarationsResolve/lambdaInImplicitFunBody.kt");
}
@Test
@TestMetadata("lambdaInImplicitPropertyBody.kt")
public void testLambdaInImplicitPropertyBody() throws Exception {
runTest("analysis/low-level-api-fir/testdata/innerDeclarationsResolve/lambdaInImplicitPropertyBody.kt");
}
@Test
@TestMetadata("lambdasInWithBodyFunction.kt")
public void testLambdasInWithBodyFunction() throws Exception {
runTest("analysis/low-level-api-fir/testdata/innerDeclarationsResolve/lambdasInWithBodyFunction.kt");
}
@Test
@TestMetadata("localClass.kt")
public void testLocalClass() throws Exception {
runTest("analysis/low-level-api-fir/testdata/innerDeclarationsResolve/localClass.kt");
}
@Test
@TestMetadata("propertyWithGetterAndSetter.kt")
public void testPropertyWithGetterAndSetter() throws Exception {
runTest("analysis/low-level-api-fir/testdata/innerDeclarationsResolve/propertyWithGetterAndSetter.kt");
}
@Test
@TestMetadata("propertyWithSetter.kt")
public void testPropertyWithSetter() throws Exception {
runTest("analysis/low-level-api-fir/testdata/innerDeclarationsResolve/propertyWithSetter.kt");
}
}
@@ -18,7 +18,7 @@ import java.util.regex.Pattern;
@SuppressWarnings("all")
@TestMetadata("analysis/low-level-api-fir/testdata/innerDeclarationsResolve")
@TestDataPath("$PROJECT_ROOT")
public class InnerDeclarationsResolvePhaseTestGenerated extends AbstractInnerDeclarationsResolvePhaseTest {
public class SourceInnerDeclarationsResolvePhaseTestGenerated extends AbstractSourceInnerDeclarationsResolvePhaseTest {
@Test
public void testAllFilesPresentInInnerDeclarationsResolve() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("analysis/low-level-api-fir/testdata/innerDeclarationsResolve"), Pattern.compile("^(.+)\\.kt$"), null, true);
@@ -5,12 +5,13 @@
package org.jetbrains.kotlin.analysis.low.level.api.fir.test.base
import org.jetbrains.kotlin.analysis.test.framework.base.AbstractAnalysisApiBasedTest
import org.jetbrains.kotlin.analysis.test.framework.project.structure.ktModuleProvider
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.test.services.TestModuleStructure
import org.jetbrains.kotlin.test.services.TestServices
abstract class AbstractLowLevelApiSingleFileTest : AbstractLowLevelApiSingleModuleTest() {
abstract class AbstractLowLevelApiSingleFileTest : AbstractAnalysisApiBasedTest() {
final override fun doTestByModuleStructure(moduleStructure: TestModuleStructure, testServices: TestServices) {
val singleModule = moduleStructure.modules.single()
val singleFile = testServices.ktModuleProvider.getModuleFiles(singleModule).filterIsInstance<KtFile>().single()
@@ -1,15 +0,0 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.analysis.low.level.api.fir.test.base
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.configurators.AnalysisApiFirSourceTestConfigurator
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfigurator
import org.jetbrains.kotlin.analysis.test.framework.base.AbstractAnalysisApiBasedTest
abstract class AbstractLowLevelApiSingleModuleTest : AbstractAnalysisApiBasedTest() {
override val configurator: AnalysisApiTestConfigurator = AnalysisApiFirSourceTestConfigurator(analyseInDependentSession = false)
}
@@ -17,6 +17,7 @@ import org.jetbrains.kotlin.analysis.low.level.api.fir.LLFirResolveSessionServic
import org.jetbrains.kotlin.analysis.low.level.api.fir.api.services.FirSealedClassInheritorsProcessorFactory
import org.jetbrains.kotlin.analysis.low.level.api.fir.project.structure.LLFirBuiltinsSessionFactory
import org.jetbrains.kotlin.analysis.low.level.api.fir.project.structure.LLFirLibrarySessionFactory
import org.jetbrains.kotlin.analysis.low.level.api.fir.project.structure.LLFirNonUnderContentRootSessionFactory
import org.jetbrains.kotlin.analysis.low.level.api.fir.services.KtCompilerPluginsProviderForTests
import org.jetbrains.kotlin.analysis.low.level.api.fir.services.LLFirSealedClassInheritorsProcessorFactoryForTests
import org.jetbrains.kotlin.analysis.low.level.api.fir.services.PackagePartProviderTestImpl
@@ -49,6 +50,7 @@ object AnalysisApiFirTestServiceRegistrar : AnalysisApiTestServiceRegistrar() {
registerService(LLFirResolveSessionService::class.java)
registerService(LLFirLibrarySessionFactory::class.java)
registerService(LLFirBuiltinsSessionFactory::class.java)
registerService(LLFirNonUnderContentRootSessionFactory::class.java)
registerService(PackagePartProviderFactory::class.java, PackagePartProviderTestImpl(testServices))
registerService(KotlinAsJavaSupport::class.java, SymbolKotlinAsJavaSupport(project))
@@ -0,0 +1,48 @@
/*
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.analysis.low.level.api.fir.test.configurators
import com.intellij.openapi.Disposable
import com.intellij.psi.PsiFile
import org.jetbrains.kotlin.analysis.test.framework.project.structure.KtModuleFactory
import org.jetbrains.kotlin.analysis.test.framework.project.structure.KtOutOfContentRootModuleFactory
import org.jetbrains.kotlin.analysis.test.framework.utils.SkipTestException
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
import org.jetbrains.kotlin.test.directives.model.DirectiveApplicability
import org.jetbrains.kotlin.test.directives.model.SimpleDirectivesContainer
import org.jetbrains.kotlin.test.model.TestModule
import org.jetbrains.kotlin.test.services.TestServices
object AnalysisApiFirOutOfContentRootTestConfigurator : AnalysisApiFirSourceLikeTestConfigurator(false) {
override val testPrefix: String
get() = "outside"
override fun configureTest(builder: TestConfigurationBuilder, disposable: Disposable) {
super.configureTest(builder, disposable)
builder.apply {
useDirectives(Directives)
useAdditionalService<KtModuleFactory> { KtOutOfContentRootModuleFactory() }
}
}
override fun prepareFilesInModule(files: List<PsiFile>, module: TestModule, testServices: TestServices) {
if (Directives.SKIP_WHEN_OUT_OF_CONTENT_ROOT in module.directives) {
throw SkipWhenOutOfContentRootException()
}
super.prepareFilesInModule(files, module, testServices)
}
object Directives : SimpleDirectivesContainer() {
val SKIP_WHEN_OUT_OF_CONTENT_ROOT by directive(
description = "Skip the test in out-of-content-root mode",
applicability = DirectiveApplicability.Global
)
}
}
private class SkipWhenOutOfContentRootException : SkipTestException()
@@ -0,0 +1,48 @@
/*
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.analysis.low.level.api.fir.test.configurators
import com.intellij.openapi.Disposable
import com.intellij.openapi.project.Project
import org.jetbrains.kotlin.analysis.api.impl.base.test.configurators.AnalysisApiBaseTestServiceRegistrar
import org.jetbrains.kotlin.analysis.api.standalone.base.project.structure.KtModuleProjectStructure
import org.jetbrains.kotlin.analysis.low.level.api.fir.compiler.based.SealedClassesInheritorsCaclulatorPreAnalysisHandler
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.base.AnalysisApiFirTestServiceRegistrar
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.base.configureOptionalTestCompilerPlugin
import org.jetbrains.kotlin.analysis.test.framework.project.structure.TestModuleStructureFactory
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfigurator
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestServiceRegistrar
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.FrontendKind
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
import org.jetbrains.kotlin.test.services.TestModuleStructure
import org.jetbrains.kotlin.test.services.TestServices
import org.jetbrains.kotlin.test.services.configuration.JvmEnvironmentConfigurator
abstract class AnalysisApiFirSourceLikeTestConfigurator(override val analyseInDependentSession: Boolean) : AnalysisApiTestConfigurator() {
override val frontendKind: FrontendKind get() = FrontendKind.Fir
override fun configureTest(builder: TestConfigurationBuilder, disposable: Disposable) {
builder.apply {
useDirectives(SealedClassesInheritorsCaclulatorPreAnalysisHandler.Directives)
usePreAnalysisHandlers(::SealedClassesInheritorsCaclulatorPreAnalysisHandler)
configureOptionalTestCompilerPlugin()
useConfigurators(::JvmEnvironmentConfigurator)
}
}
override val serviceRegistrars: List<AnalysisApiTestServiceRegistrar> = listOf(
AnalysisApiBaseTestServiceRegistrar,
AnalysisApiFirTestServiceRegistrar,
)
override fun createModules(
moduleStructure: TestModuleStructure,
testServices: TestServices,
project: Project
): KtModuleProjectStructure {
return TestModuleStructureFactory.createProjectStructureByTestStructure(moduleStructure, testServices, project)
}
}
@@ -6,57 +6,18 @@
package org.jetbrains.kotlin.analysis.low.level.api.fir.test.configurators
import com.intellij.openapi.Disposable
import com.intellij.openapi.components.ServiceManager
import com.intellij.openapi.project.Project
import org.jetbrains.kotlin.analysis.api.impl.base.test.configurators.AnalysisApiBaseTestServiceRegistrar
import org.jetbrains.kotlin.analysis.api.standalone.base.project.structure.KtModuleProjectStructure
import org.jetbrains.kotlin.analysis.low.level.api.fir.compiler.based.SealedClassesInheritorsCaclulatorPreAnalysisHandler
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.base.AnalysisApiFirTestServiceRegistrar
import org.jetbrains.kotlin.analysis.low.level.api.fir.test.base.configureOptionalTestCompilerPlugin
import org.jetbrains.kotlin.analysis.providers.KotlinModificationTrackerFactory
import org.jetbrains.kotlin.analysis.test.framework.project.structure.KtMainModuleFactoryForSourceModules
import org.jetbrains.kotlin.analysis.test.framework.project.structure.TestModuleStructureFactory
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfigurator
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestServiceRegistrar
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.FrontendKind
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.analysis.test.framework.project.structure.KtModuleFactory
import org.jetbrains.kotlin.analysis.test.framework.project.structure.KtSourceModuleFactory
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
import org.jetbrains.kotlin.test.services.TestModuleStructure
import org.jetbrains.kotlin.test.services.TestServices
import org.jetbrains.kotlin.test.services.configuration.JvmEnvironmentConfigurator
class AnalysisApiFirSourceTestConfigurator(override val analyseInDependentSession: Boolean) : AnalysisApiTestConfigurator() {
override val frontendKind: FrontendKind get() = FrontendKind.Fir
class AnalysisApiFirSourceTestConfigurator(
analyseInDependentSession: Boolean
) : AnalysisApiFirSourceLikeTestConfigurator(analyseInDependentSession) {
override fun configureTest(builder: TestConfigurationBuilder, disposable: Disposable) {
super.configureTest(builder, disposable)
builder.apply {
useDirectives(SealedClassesInheritorsCaclulatorPreAnalysisHandler.Directives)
usePreAnalysisHandlers(::SealedClassesInheritorsCaclulatorPreAnalysisHandler)
configureOptionalTestCompilerPlugin()
useConfigurators(::JvmEnvironmentConfigurator)
useAdditionalService<KtModuleFactory> { KtSourceModuleFactory() }
}
}
override val serviceRegistrars: List<AnalysisApiTestServiceRegistrar> = listOf(
AnalysisApiBaseTestServiceRegistrar,
AnalysisApiFirTestServiceRegistrar,
)
override fun createModules(
moduleStructure: TestModuleStructure,
testServices: TestServices,
project: Project
): KtModuleProjectStructure {
return TestModuleStructureFactory.createProjectStructureByTestStructure(
moduleStructure,
testServices,
project,
KtMainModuleFactoryForSourceModules,
)
}
override fun doOutOfBlockModification(file: KtFile) {
ServiceManager.getService(file.project, KotlinModificationTrackerFactory::class.java)
.incrementModificationsCount()
}
}
@@ -12,7 +12,6 @@ import org.jetbrains.kotlin.analysis.api.standalone.base.project.structure.KtMod
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestConfigurator
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.AnalysisApiTestServiceRegistrar
import org.jetbrains.kotlin.analysis.test.framework.test.configurators.FrontendKind
import org.jetbrains.kotlin.psi.KtFile
import org.jetbrains.kotlin.test.builders.TestConfigurationBuilder
import org.jetbrains.kotlin.test.services.TestModuleStructure
import org.jetbrains.kotlin.test.services.TestServices
@@ -29,10 +28,6 @@ object AnalysisApiSymbolLightClassesDecompiledTestConfigurator : AnalysisApiTest
get() = AnalysisApiFirLibraryBinaryTestConfigurator.serviceRegistrars +
AnalysisApiSymbolLightClassesDecompiledTestServiceRegistrar
override fun doOutOfBlockModification(file: KtFile) {
AnalysisApiFirLibraryBinaryTestConfigurator.doOutOfBlockModification(file)
}
override fun createModules(
moduleStructure: TestModuleStructure,
testServices: TestServices,
@@ -6,12 +6,13 @@
package org.jetbrains.kotlin.generators.tests.analysis.api
import org.jetbrains.kotlin.analysis.low.level.api.fir.*
import org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostic.AbstractDiagnosticTraversalCounterTest
import org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostic.AbstractFirContextCollectionTest
import org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostic.*
import org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostic.compiler.based.AbstractDiagnosisCompilerTestDataSpecTest
import org.jetbrains.kotlin.analysis.low.level.api.fir.diagnostic.compiler.based.AbstractDiagnosisCompilerTestDataTest
import org.jetbrains.kotlin.analysis.low.level.api.fir.file.structure.AbstractFileStructureTest
import org.jetbrains.kotlin.analysis.low.level.api.fir.resolve.AbstractInnerDeclarationsResolvePhaseTest
import org.jetbrains.kotlin.analysis.low.level.api.fir.file.structure.AbstractOutOfContentRootFileStructureTest
import org.jetbrains.kotlin.analysis.low.level.api.fir.file.structure.AbstractSourceFileStructureTest
import org.jetbrains.kotlin.analysis.low.level.api.fir.resolve.AbstractOutOfContentRootInnerDeclarationsResolvePhaseTest
import org.jetbrains.kotlin.analysis.low.level.api.fir.resolve.AbstractSourceInnerDeclarationsResolvePhaseTest
import org.jetbrains.kotlin.generators.TestGroupSuite
import org.jetbrains.kotlin.generators.util.TestGeneratorUtil
import org.jetbrains.kotlin.spec.utils.GeneralConfiguration
@@ -20,7 +21,11 @@ import org.jetbrains.kotlin.test.utils.CUSTOM_TEST_DATA_EXTENSION_PATTERN
internal fun TestGroupSuite.generateFirLowLevelApiTests() {
testGroup("analysis/low-level-api-fir/tests", "compiler/fir/raw-fir/psi2fir/testData") {
testClass<AbstractFirLazyBodiesCalculatorTest> {
testClass<AbstractFirSourceLazyBodiesCalculatorTest> {
model("rawBuilder", testMethod = "doTest")
}
testClass<AbstractFirOutOfContentRootLazyBodiesCalculatorTest> {
model("rawBuilder", testMethod = "doTest")
}
}
@@ -30,15 +35,27 @@ internal fun TestGroupSuite.generateFirLowLevelApiTests() {
model("onAirResolve")
}
testClass<AbstractFirLazyDeclarationResolveTest> {
testClass<AbstractFirSourceLazyDeclarationResolveTest> {
model("lazyResolve")
}
testClass<AbstractFileStructureTest> {
testClass<AbstractFirOutOfContentRootLazyDeclarationResolveTest> {
model("lazyResolve")
}
testClass<AbstractSourceFileStructureTest> {
model("fileStructure")
}
testClass<AbstractFirContextCollectionTest> {
testClass<AbstractOutOfContentRootFileStructureTest> {
model("fileStructure")
}
testClass<AbstractFirSourceContextCollectionTest> {
model("fileStructure")
}
testClass<AbstractFirOutOfContentRootContextCollectionTest> {
model("fileStructure")
}
@@ -46,15 +63,27 @@ internal fun TestGroupSuite.generateFirLowLevelApiTests() {
model("diagnosticTraversalCounter")
}
testClass<AbstractInnerDeclarationsResolvePhaseTest> {
testClass<AbstractSourceInnerDeclarationsResolvePhaseTest> {
model("innerDeclarationsResolve")
}
testClass<AbstractPartialRawFirBuilderTestCase> {
testClass<AbstractOutOfContentRootInnerDeclarationsResolvePhaseTest> {
model("innerDeclarationsResolve")
}
testClass<AbstractSourcePartialRawFirBuilderTestCase> {
model("partialRawBuilder", testMethod = "doRawFirTest")
}
testClass<AbstractGetOrBuildFirTest> {
testClass<AbstractOutOfContentRootPartialRawFirBuilderTestCase> {
model("partialRawBuilder", testMethod = "doRawFirTest")
}
testClass<AbstractSourceGetOrBuildFirTest> {
model("getOrBuildFir")
}
testClass<AbstractOutOfContentRootGetOrBuildFirTest> {
model("getOrBuildFir")
}
}