File tree 1 file changed +4
-4
lines changed
compiler/src/dotty/tools/dotc/typer
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -1330,13 +1330,13 @@ trait Implicits:
1330
1330
if alt1.ref eq alt2.ref then 0
1331
1331
else if alt1.level != alt2.level then alt1.level - alt2.level
1332
1332
else
1333
- var cmp = comp(using searchContext())
1334
- if cmp == 0 && alt1.ref.symbol.is( Implicit ) && alt2.ref.symbol.is( Implicit ) then
1333
+ lazy val prev = comp(using searchContext().addMode( Mode . OldImplicitResolution ))
1334
+ val cmp = comp( using searchContext()) match
1335
1335
// if we get an ambiguity with new rules for a pair of old-style implicits, fall back to old rules
1336
- cmp = comp(using searchContext().addMode(Mode .OldImplicitResolution ))
1336
+ case 0 if alt1.ref.symbol.is(Implicit ) && alt2.ref.symbol.is(Implicit ) => prev
1337
+ case cmp => cmp
1337
1338
val sv = Feature .sourceVersion
1338
1339
if isWarnPriorityChangeVersion(sv) then
1339
- val prev = comp(using searchContext().addMode(Mode .OldImplicitResolution ))
1340
1340
if disambiguate && cmp != prev then
1341
1341
def warn (msg : Message ) =
1342
1342
val critical = alt1.ref :: alt2.ref :: Nil
You can’t perform that action at this time.
0 commit comments