[SLC] fix multifile-classes in multiplatform case

Multifile-class can contain not only files from the same
module, but also files from the common part.
This commit also fixes KotlinByModulesResolutionScopeProvider as
it should provide all transitive dependencies

^KT-64714 Fixed
This commit is contained in:
Dmitrii Gridin
2024-01-04 23:40:36 +01:00
committed by Space Team
parent fc519b2339
commit c14c12479c
5 changed files with 103 additions and 20 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -7,15 +7,19 @@ package org.jetbrains.kotlin.analysis.providers.impl
import com.intellij.psi.search.GlobalSearchScope
import org.jetbrains.kotlin.analysis.project.structure.KtModule
import org.jetbrains.kotlin.analysis.project.structure.allDirectDependencies
import org.jetbrains.kotlin.analysis.providers.KotlinResolutionScopeProvider
import org.jetbrains.kotlin.utils.topologicalSort
public class KotlinByModulesResolutionScopeProvider : KotlinResolutionScopeProvider() {
override fun getResolutionScope(module: KtModule): GlobalSearchScope {
val allModules = buildList {
add(module)
addAll(module.allDirectDependencies())
val allModules = topologicalSort(listOf(module)) {
buildList {
addAll(directDependsOnDependencies)
addAll(directFriendDependencies)
addAll(directRegularDependencies)
}
}
return GlobalSearchScope.union(allModules.map { it.contentScope })
}
}
}