Skip to content

Commit dd517c5

Browse files
authored
Merge pull request #2839 from dotty-staging/change-implsearch-spec
Make nesting/owner a real ordering for implicit search
2 parents d8b3e8e + b1dc039 commit dd517c5

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

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

+4-2
Original file line numberDiff line numberDiff line change
@@ -1145,9 +1145,11 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
11451145
val tp1 = stripImplicit(alt1.widen)
11461146
val tp2 = stripImplicit(alt2.widen)
11471147

1148-
def winsOwner1 = nesting1 > nesting2 || isDerived(owner1, owner2)
1148+
def winsOwner1 =
1149+
nesting1 > nesting2 || nesting1 == nesting2 && isDerived(owner1, owner2)
11491150
def winsType1 = isAsSpecific(alt1, tp1, alt2, tp2)
1150-
def winsOwner2 = nesting2 > nesting1 || isDerived(owner2, owner1)
1151+
def winsOwner2 =
1152+
nesting2 > nesting1 || nesting1 == nesting2 && isDerived(owner2, owner1)
11511153
def winsType2 = isAsSpecific(alt2, tp2, alt1, tp1)
11521154

11531155
overload.println(i"isAsGood($alt1, $alt2)? $tp1 $tp2 $winsOwner1 $winsType1 $winsOwner2 $winsType2")

0 commit comments

Comments
 (0)