[kotlin] find usages: fix expect/actual referencing

KTIJ-24383

GitOrigin-RevId: 51e429f82295387dc60edf5e75d85b1e1e5733f0
This commit is contained in:
Anna Kozlova
2024-01-18 15:06:09 +00:00
committed by intellij-monorepo-bot
parent 34b32e743f
commit 0de06e551b
2 changed files with 6 additions and 1 deletions
@@ -1 +1 @@
// IGNORE_K2
// FIR_COMPARISON
@@ -107,6 +107,11 @@ internal class KotlinK2SearchUsagesSupport : KotlinSearchUsagesSupport {
}
override fun isCallableOverrideUsage(reference: PsiReference, declaration: KtNamedDeclaration): Boolean {
if (declaration.isExpectDeclaration() &&
reference.unwrappedTargets.any { target -> target is KtDeclaration && expectedDeclarationIfAny(target) == declaration }) {
return true
}
fun KtDeclaration.isTopLevelCallable() = when (this) {
is KtNamedFunction -> isTopLevel
is KtProperty -> isTopLevel