[FIR] Improve condition for sorting equivalent calls by source first

This accommodates for declarations generated by plugins that don't have
a source.
This commit is contained in:
Kirill Rakhman
2023-09-04 15:36:06 +02:00
committed by Space Team
parent 9ab6a5ff56
commit f08d4b8bb1
@@ -44,7 +44,7 @@ class ConeEquivalentCallConflictResolver(
// Since we can consider a declaration from source and one from binary equivalent, we need to make sure we favor the one from
// source, otherwise we might get a behavior change to K1.
// See org.jetbrains.kotlin.resolve.calls.results.OverloadingConflictResolver.filterOutEquivalentCalls.
val fromSourceFirst = candidates.sortedBy { it.symbol.fir.source == null }
val fromSourceFirst = candidates.sortedBy { it.symbol.fir.moduleData.session.kind != FirSession.Kind.Source }
val result = mutableSetOf<Candidate>()
outerLoop@ for (myCandidate in fromSourceFirst) {