From 3d2d9539f8f151827938414a6ab788239cc7207a Mon Sep 17 00:00:00 2001 From: Dmitrii Gridin Date: Mon, 4 Nov 2024 16:45:23 +0100 Subject: [PATCH] [Analysis API] KotlinByModulesResolutionScopeProvider: add workaround for builtins We may have a few builtins at the same time from different libraries, but due to KT-72988 we will be able to find only the first one ^KT-66783 ^KT-72988 --- .../KotlinByModulesResolutionScopeProvider.kt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/analysis/analysis-api-platform-interface/src/org/jetbrains/kotlin/analysis/api/platform/projectStructure/KotlinByModulesResolutionScopeProvider.kt b/analysis/analysis-api-platform-interface/src/org/jetbrains/kotlin/analysis/api/platform/projectStructure/KotlinByModulesResolutionScopeProvider.kt index fca0206ced61e..79c065421792c 100644 --- a/analysis/analysis-api-platform-interface/src/org/jetbrains/kotlin/analysis/api/platform/projectStructure/KotlinByModulesResolutionScopeProvider.kt +++ b/analysis/analysis-api-platform-interface/src/org/jetbrains/kotlin/analysis/api/platform/projectStructure/KotlinByModulesResolutionScopeProvider.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.analysis.api.platform.projectStructure import com.intellij.psi.search.GlobalSearchScope import org.jetbrains.kotlin.analysis.api.projectStructure.KaModule +import org.jetbrains.kotlin.analysis.decompiler.psi.BuiltinsVirtualFileProvider import org.jetbrains.kotlin.utils.topologicalSort public class KotlinByModulesResolutionScopeProvider : KotlinResolutionScopeProvider { @@ -19,6 +20,10 @@ public class KotlinByModulesResolutionScopeProvider : KotlinResolutionScopeProvi } } - return GlobalSearchScope.union(allModules.map { it.contentScope }) + val scope = GlobalSearchScope.union(allModules.map { it.contentScope }) + + // workaround for KT-72988 + val builtinsScope = BuiltinsVirtualFileProvider.getInstance().createBuiltinsScope(module.project) + return scope.uniteWith(builtinsScope) } }