From 8d1cfe0017cb5603cf59575e3661d22f8cec5ce0 Mon Sep 17 00:00:00 2001 From: Yan Zhulanow Date: Wed, 1 Mar 2023 00:23:33 +0900 Subject: [PATCH] [LL API] Allow multiple candidates for non-local callables (KTIJ-21108) In a combined classpath, such as scripting classpath for the whole project, there might be several versions of the same library. --- .../api/fir/util/FirDeclarationForCompiledElementSearcher.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/util/FirDeclarationForCompiledElementSearcher.kt b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/util/FirDeclarationForCompiledElementSearcher.kt index 8c49e4d2297..719186a3c98 100644 --- a/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/util/FirDeclarationForCompiledElementSearcher.kt +++ b/analysis/low-level-api-fir/src/org/jetbrains/kotlin/analysis/low/level/api/fir/util/FirDeclarationForCompiledElementSearcher.kt @@ -97,7 +97,7 @@ internal class FirDeclarationForCompiledElementSearcher(private val symbolProvid val candidates = symbolProvider.findFunctionCandidates(declaration) val functionCandidate = candidates - .singleOrNull { KtDeclarationAndFirDeclarationEqualityChecker.representsTheSameDeclaration(declaration, it.fir) } + .firstOrNull { KtDeclarationAndFirDeclarationEqualityChecker.representsTheSameDeclaration(declaration, it.fir) } ?: errorWithFirSpecificEntries("We should be able to find a symbol for function", psi = declaration) { withCandidates(candidates) } @@ -111,7 +111,7 @@ internal class FirDeclarationForCompiledElementSearcher(private val symbolProvid val candidates = symbolProvider.findPropertyCandidates(declaration) val propertyCandidate = - candidates.singleOrNull { KtDeclarationAndFirDeclarationEqualityChecker.representsTheSameDeclaration(declaration, it.fir) } + candidates.firstOrNull { KtDeclarationAndFirDeclarationEqualityChecker.representsTheSameDeclaration(declaration, it.fir) } ?: errorWithFirSpecificEntries("We should be able to find a symbol for property", psi = declaration) { withCandidates(candidates) }