@@ -1965,29 +1965,29 @@ trait Applications extends Compatibility {
19651965
19661966 def compareWithTypes (tp1 : Type , tp2 : Type ) =
19671967 val ownerScore = compareOwner(alt1.symbol.maybeOwner, alt2.symbol.maybeOwner)
1968- if preferGeneral && ownerScore != 0 then
1969- // For implicit resolution, take ownerscre as more significat than type resoltion
1970- // Reason: People use owner hierarchies to explicitly prioritize, we should not
1971- // break that by changing implicit priority of types.
1972- ownerScore
1973- else
1974- val winsType1 = isAsGood(alt1, tp1, alt2, tp2)
1975- val winsType2 = isAsGood(alt2, tp2, alt1, tp1)
1976-
1977- overload.println( i " compare( $ alt1, $ alt2)? $tp1 $tp2 $ownerScore $winsType1 $winsType2 " )
1978- if winsType1 && winsType2
1979- && alt1.widenExpr.isStable && (alt1.widenExpr frozen_ =:= alt2.widenExpr)
1980- then
1981- // alternatives are the same after following ExprTypes, pick one of them
1982- // (prefer the one that is not a method, but that's arbitrary).
1983- if alt1.widenExpr =: = alt2 then - 1 else 1
1984- else ownerScore match
1985- case 1 => if winsType1 || ! winsType2 then 1 else 0
1986- case - 1 => if winsType2 || ! winsType1 then - 1 else 0
1987- case 0 =>
1988- if winsType1 != winsType2 then if winsType1 then 1 else - 1
1989- else if alt1.symbol == alt2.symbol then comparePrefixes
1990- else 0
1968+ val winsType1 = isAsGood(alt1, tp1, alt2, tp2)
1969+ val winsType2 = isAsGood(alt2, tp2, alt1, tp1)
1970+
1971+ overload.println( i " compare( $alt1 , $alt2 )? $tp1 $tp2 $ownerScore $winsType1 $winsType2 " )
1972+ if winsType1 && winsType2
1973+ && alt1.widenExpr.isStable && (alt1.widenExpr frozen_ =:= alt2.widenExpr)
1974+ then
1975+ // alternatives are the same after following ExprTypes, pick one of them
1976+ // (prefer the one that is not a method, but that's arbitrary).
1977+ if alt1.widenExpr =:= alt2 then - 1 else 1
1978+ else ownerScore match
1979+ case 1 => if winsType1 || ! winsType2 then 1 else 0
1980+ case - 1 => if winsType2 || ! winsType1 then - 1 else 0
1981+ case 0 =>
1982+ if winsType1 != winsType2 then if winsType1 then 1 else - 1
1983+ else if alt1.symbol = = alt2.symbol then comparePrefixes
1984+ else if preferGeneral then
1985+ // For implicit resolution, take ownerscore as more significat than type resoltion
1986+ // Reason: People use owner hierarchies to explicitly prioritize, we should not
1987+ // break that by changing implicit priority of types. On the other hand we do want
1988+ // to comparePrefixes if there is a draw; StringFormaterTest breaks if we don't do that.
1989+ ownerScore
1990+ else 0
19911991 end compareWithTypes
19921992
19931993 if alt1.symbol.is(ConstructorProxy ) && ! alt2.symbol.is(ConstructorProxy ) then - 1
0 commit comments