[LL] take originalDeclaration when exists to detect module kind

Fixes KTIJ-24609.
When completion happens outside the content root,
module kind should be detected by the original file.
Otherwise, module would not be the same because outside the content root,
each file has its own module.
Actual #findSourceFirSymbol also does search over originalDeclaration when present.
Added FirCompletionOutsideSourceRootTest in IJ monorepo
This commit is contained in:
Anna Kozlova
2023-06-14 15:13:18 +02:00
committed by teamcity
parent b06ec464d9
commit 8c2f1acc7e
@@ -101,7 +101,7 @@ internal abstract class LLFirResolvableResolveSession(
ktDeclaration: KtDeclaration,
phase: FirResolvePhase
): FirBasedSymbol<*> {
val module = getModule(ktDeclaration)
val module = getModule(ktDeclaration.originalDeclaration ?: ktDeclaration)
retryOnInvalidSession {
return when (getModuleKind(module)) {
ModuleKind.RESOLVABLE_MODULE -> findSourceFirSymbol(ktDeclaration, module).also { resolveFirToPhase(it.fir, phase) }