K2: Support dependency symbol providers for binary libraries

When a symbol X from a binary library A uses another symbol Y from
another binary library B, `LLFirDependenciesSymbolProvider` cannot
resolve Y for X. This is because the existing
LLFirAbstractSessionFactory passes symbol providers for only builtin
libraries to `LLFirDependenciesSymbolProvider` even when the session has
dependencies. As a result, when `LLFirDependenciesSymbolProvider`
searches a symbol, it can find only symbols from the builtin libraries,
but it cannot find a symbol from libraries other than builtin libraries.
This happens only for the binary libraries.

^KT-65240 Fixed
This commit is contained in:
Jaebaek Seo
2024-01-25 15:38:36 +09:00
committed by Space Team
parent 42c2e7d503
commit 2f64a878e4
5 changed files with 100 additions and 1 deletions
@@ -85,7 +85,12 @@ internal abstract class LLFirAbstractSessionFactory(protected val project: Proje
builtinTypes,
scope
),
LLFirDependenciesSymbolProvider(session) { listOf(builtinSymbolProvider) },
LLFirDependenciesSymbolProvider(session) {
buildList {
addAll(collectDependencySymbolProviders(moduleData.ktModule))
add(builtinSymbolProvider)
}
},
)
}