KT-63096 [LL] Use full module resolution scope to create KotlinAnnotationsResolver
`KotlinAnnotationsResolver` must see everything that is resolvable from the current module; otherwise it will not work properly. The previous scope was the module itself + its binary dependencies (jars). Now the scope will contain the module itself and ALL its dependencies, including other modules. ^KT-63096 Fixed
This commit is contained in:
+2
-3
@@ -21,7 +21,7 @@ import org.jetbrains.kotlin.analysis.low.level.api.fir.sessions.LLFirSourcesSess
|
||||
import org.jetbrains.kotlin.analysis.low.level.api.fir.util.LLFirExceptionHandler
|
||||
import org.jetbrains.kotlin.analysis.project.structure.KtCompilerPluginsProvider
|
||||
import org.jetbrains.kotlin.analysis.project.structure.KtSourceModule
|
||||
import org.jetbrains.kotlin.analysis.project.structure.moduleScopeProvider
|
||||
import org.jetbrains.kotlin.analysis.providers.KotlinResolutionScopeProvider
|
||||
import org.jetbrains.kotlin.analysis.providers.createAnnotationResolver
|
||||
import org.jetbrains.kotlin.analysis.providers.createDeclarationProvider
|
||||
import org.jetbrains.kotlin.fir.FirExceptionHandler
|
||||
@@ -76,11 +76,10 @@ internal fun FirSession.registerCompilerPluginExtensions(project: Project, modul
|
||||
|
||||
@SessionConfiguration
|
||||
internal fun LLFirSourcesSession.registerCompilerPluginServices(
|
||||
contentScope: GlobalSearchScope,
|
||||
project: Project,
|
||||
module: KtSourceModule
|
||||
) {
|
||||
val projectWithDependenciesScope = contentScope.uniteWith(project.moduleScopeProvider.getModuleLibrariesScope(module))
|
||||
val projectWithDependenciesScope = KotlinResolutionScopeProvider.getInstance(project).getResolutionScope(module)
|
||||
val annotationsResolver = project.createAnnotationResolver(projectWithDependenciesScope)
|
||||
|
||||
// We need FirRegisteredPluginAnnotations and FirPredicateBasedProvider during extensions' registration process
|
||||
|
||||
+1
-1
@@ -281,7 +281,7 @@ internal abstract class LLFirAbstractSessionFactory(protected val project: Proje
|
||||
register(FirProvider::class, firProvider)
|
||||
register(FirLazyDeclarationResolver::class, LLFirLazyDeclarationResolver())
|
||||
|
||||
registerCompilerPluginServices(firProvider.searchScope, project, module)
|
||||
registerCompilerPluginServices(project, module)
|
||||
registerCompilerPluginExtensions(project, module)
|
||||
registerCommonComponentsAfterExtensionsAreConfigured()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user