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