Skip to content

Commit 51ebf70

Browse files
committed
Use first symbol as tie breaker
1 parent 64e0790 commit 51ebf70

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

compiler/src/dotty/tools/dotc/core/Denotations.scala

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ object Denotations {
374374
* pick the associated denotation.
375375
* 3. Otherwise, if the two infos can be combined with `infoMeet`, pick that as
376376
* result info, and pick the symbol that scores higher as result symbol,
377-
* or pick `sym2` as a tie breaker. The picked info and symbol are combined
377+
* or pick `sym1` as a tie breaker. The picked info and symbol are combined
378378
* in a JointDenotation.
379379
* 4. Otherwise, if one of the two symbols scores strongly higher than the
380380
* other one, pick the associated denotation.
@@ -469,16 +469,14 @@ object Denotations {
469469

470470
val matchLoosely = sym1.matchNullaryLoosely || sym2.matchNullaryLoosely
471471

472-
if info2.overrides(info1, matchLoosely, checkClassInfo = false)
473-
&& symScore <= 0
474-
then denot2
475-
else if info1.overrides(info2, matchLoosely, checkClassInfo = false)
476-
&& symScore >= 0
477-
then denot1
472+
if symScore <= 0 && info2.overrides(info1, matchLoosely, checkClassInfo = false) then
473+
denot2
474+
else if symScore >= 0 && info1.overrides(info2, matchLoosely, checkClassInfo = false) then
475+
denot1
478476
else
479477
val jointInfo = infoMeet(info1, info2, safeIntersection)
480478
if jointInfo.exists then
481-
val sym = if symScore > 0 then sym1 else sym2
479+
val sym = if symScore >= 0 then sym1 else sym2
482480
JointRefDenotation(sym, jointInfo, denot1.validFor & denot2.validFor, pre)
483481
else if symScore == 2 then denot1
484482
else if symScore == -2 then denot2

0 commit comments

Comments
 (0)