Skip to content

Commit

Permalink
[Analysis API] KotlinByModulesResolutionScopeProvider: add workaround…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
dimonchik0036 authored and qodana-bot committed Nov 22, 2024
1 parent 65f6232 commit 3d2d953
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
}
}

0 comments on commit 3d2d953

Please sign in to comment.