KT-59801 [FIR] scripting: explicit import breaks reference shortening
FIR-tree for scripts is built either for KtScript or KtFile depending on the file structure. The presence of import statements results in KtFile. There are lazy trees (some nodes are stubs) that are not yet supported for scripts. We build such ones for KtFile case. This commit prevents lazy tree construction for scripts at references shortening. ^KT-59801 fixed
This commit is contained in:
+7
-6
@@ -94,14 +94,15 @@ internal class KtFirReferenceShortener(
|
||||
kDocQualifiersToShorten = emptyList(),
|
||||
)
|
||||
|
||||
val towerContext = when (declarationToVisit) {
|
||||
is KtFile -> {
|
||||
LowLevelFirApiFacadeForResolveOnAir.getOnAirTowerDataContextProviderForTheWholeFile(firResolveSession, declarationToVisit)
|
||||
}
|
||||
else -> {
|
||||
val towerContext =
|
||||
if (declarationToVisit !is KtFile || declarationToVisit.isScript()) {
|
||||
LowLevelFirApiFacadeForResolveOnAir.getOnAirGetTowerContextProvider(firResolveSession, declarationToVisit)
|
||||
} else {
|
||||
LowLevelFirApiFacadeForResolveOnAir.getOnAirTowerDataContextProviderForTheWholeFile(
|
||||
firResolveSession,
|
||||
declarationToVisit
|
||||
)
|
||||
}
|
||||
}
|
||||
//TODO: collect all usages of available symbols in the file and prevent importing symbols that could introduce name clashes, which
|
||||
// may alter the meaning of existing code.
|
||||
val collector = ElementsToShortenCollector(
|
||||
|
||||
Reference in New Issue
Block a user