[FIR] Properly handle declarations from other source sessions in FirPredicateBasedProvider
^KT-57083 Fixed
This commit is contained in:
committed by
Space Team
parent
644391a8e0
commit
507ef3e951
+8
@@ -90,6 +90,14 @@ class FirPredicateBasedProviderImpl(private val session: FirSession) : FirPredic
|
||||
// ---------------------------------- Matching ----------------------------------
|
||||
|
||||
override fun matches(predicate: AbstractPredicate<*>, declaration: FirDeclaration): Boolean {
|
||||
/*
|
||||
* If declaration came from the other source session we should delegate to provider from
|
||||
* that session, because it stores all caches about its own declarations
|
||||
*/
|
||||
val declarationSession = declaration.moduleData.session
|
||||
if (declarationSession.kind == FirSession.Kind.Source && declarationSession !== session) {
|
||||
return declarationSession.predicateBasedProvider.matches(predicate, declaration)
|
||||
}
|
||||
return when (predicate) {
|
||||
is DeclarationPredicate -> predicate.accept(declarationPredicateMatcher, declaration)
|
||||
is LookupPredicate -> predicate.accept(lookupPredicateMatcher, declaration)
|
||||
|
||||
Reference in New Issue
Block a user