Analysis API: use FirSession from star importing scope for resolving classifiers

Resolve should happen from the use-site of the file to which importing scope belongs to
This commit is contained in:
Ilya Kirillov
2021-09-29 13:27:40 +02:00
parent 43257f7688
commit 8d15e0e824
2 changed files with 2 additions and 3 deletions
@@ -182,7 +182,7 @@ internal class KtFirScopeProvider(
private fun convertToKtScope(firScope: FirScope): KtScope {
return when (firScope) {
is FirAbstractSimpleImportingScope -> KtFirNonStarImportingScope(firScope, builder, token, analysisSession.rootModuleSession)
is FirAbstractSimpleImportingScope -> KtFirNonStarImportingScope(firScope, builder, token)
is FirAbstractStarImportingScope -> KtFirStarImportingScope(firScope, builder, project, token)
is FirPackageMemberScope -> KtFirPackageScope(
firScope.fqName,
@@ -27,7 +27,6 @@ internal class KtFirNonStarImportingScope(
private val firScope: FirAbstractSimpleImportingScope,
private val builder: KtSymbolByFirBuilder,
override val token: ValidityToken,
private val firSession: FirSession
) : KtNonStarImportingScope, ValidityTokenOwner {
@OptIn(ExperimentalStdlibApi::class)
@@ -38,7 +37,7 @@ internal class KtFirNonStarImportingScope(
val importedClassId = import.importedName?.let { importedName ->
val importedClassId =
import.resolvedParentClassId?.createNestedClassId(importedName) ?: ClassId(import.packageFqName, importedName)
importedClassId.takeIf { firSession.symbolProvider.getClassLikeSymbolByClassId(it) != null }
importedClassId.takeIf { firScope.session.symbolProvider.getClassLikeSymbolByClassId(it) != null }
}
NonStarImport(
import.packageFqName,