Skip to content

Commit e491c87

Browse files
committed
Fix ranking logic
1 parent 6b1f49f commit e491c87

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

compiler/src/dotty/tools/dotc/typer/Implicits.scala

+3-3
Original file line numberDiff line numberDiff line change
@@ -1368,9 +1368,9 @@ trait Implicits:
13681368
|Previous choice : ${choice(prev)}
13691369
|New choice from Scala 3.7: ${choice(cmp)}""")
13701370
cmp
1371-
else cmp max prev
1372-
// When ranking, we keep the better of cmp and prev, which ends up retaining a candidate
1373-
// if it is retained in either version.
1371+
else if cmp != prev then
1372+
0 // When ranking, we retain a candidate if it is retained in either version.
1373+
else cmp
13741374
else cmp
13751375
end compareAlternatives
13761376

tests/pos/i15264.scala

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import language.`3.7`
12
object priority:
23
// lower number = higher priority
34
class Prio0 extends Prio1

0 commit comments

Comments
 (0)