Extend import resolution for library-to-source analysis
Use composite importing scope for references when resolution anchors are enabled. Composite scope provides additional descriptors from scope of resolution anchor module. Overriding old importing scope with a new one is not possible as it breaks library dependencies on other libraries, which are inaccessible in anchor scope (scope for sources). KT-24309 In Progress
This commit is contained in:
+4
-1
@@ -79,8 +79,11 @@ class KotlinIdeResolutionAnchorService(
|
||||
|
||||
override fun getResolutionAnchor(moduleDescriptor: ModuleDescriptor): ModuleDescriptor? {
|
||||
if (!project.libraryToSourceAnalysisEnabled) return null
|
||||
|
||||
val moduleInfo = moduleDescriptor.moduleInfo ?: return null
|
||||
val mapped = moduleToAnchor[moduleInfo] ?: return null
|
||||
val keyModuleInfo = if (moduleInfo is SourceForBinaryModuleInfo) moduleInfo.binariesModuleInfo else moduleInfo
|
||||
val mapped = moduleToAnchor[keyModuleInfo] ?: return null
|
||||
|
||||
return KotlinCacheService.getInstance(project)
|
||||
.getResolutionFacadeByModuleInfo(mapped, mapped.platform)
|
||||
?.moduleDescriptor
|
||||
|
||||
@@ -250,6 +250,9 @@ private fun MutableMap<AnalysisFlag<*>, Any>.initIDESpecificAnalysisSettings(pro
|
||||
if (KotlinMultiplatformAnalysisModeComponent.getMode(project) == KotlinMultiplatformAnalysisModeComponent.Mode.COMPOSITE) {
|
||||
put(AnalysisFlags.useTypeRefinement, true)
|
||||
}
|
||||
if (KotlinLibraryToSourceAnalysisComponent.isEnabled(project)) {
|
||||
put(AnalysisFlags.libraryToSourceAnalysis, true)
|
||||
}
|
||||
put(AnalysisFlags.ideMode, true)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user