Skip to content

Commit 64e0790

Browse files
committed
Experiment with different symbol preference scheme
1 parent d8c980f commit 64e0790

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

compiler/src/dotty/tools/dotc/core/Denotations.scala

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -385,11 +385,11 @@ object Denotations {
385385
* give a strong score advantage, the others a weak one.
386386
*
387387
* 1. The symbol exists, and the other one does not. (*)
388-
* 2. The symbol is concrete, and the other one is deferred
389-
* 3. The symbol appears before the other in the linearization of `pre`
390-
* 4. The symbol's visibility is strictly greater than the other one's.
391-
* 5. The symbol is not a bridge, but the other one is. (*)
392-
* 6. The symbol is a method, but the other one is not. (*)
388+
* 2. The symbol is not a bridge, but the other one is. (*)
389+
* 3. The symbol is concrete, and the other one is deferred
390+
* 4. The symbol appears before the other in the linearization of `pre`
391+
* 5. The symbol's visibility is strictly greater than the other one's.
392+
* 6. The symbol is a method, but the other one is not.
393393
*/
394394
def meet(that: Denotation, pre: Type, safeIntersection: Boolean = false)(implicit ctx: Context): Denotation = {
395395
/** Try to merge denot1 and denot2 without adding a new signature. */
@@ -451,6 +451,8 @@ object Denotations {
451451
val symScore: Int =
452452
if !sym1.exists then -2
453453
else if !sym2.exists then 2
454+
else if sym1.is(Bridge) && !sym2.is(Bridge) then -2
455+
else if sym2.is(Bridge) && !sym1.is(Bridge) then 2
454456
else if !sym1.isAsConcrete(sym2) then -1
455457
else if !sym2.isAsConcrete(sym1) then 1
456458
else
@@ -461,10 +463,8 @@ object Denotations {
461463
val boundary2 = accessBoundary(sym2)
462464
if boundary1.isProperlyContainedIn(boundary2) then -1
463465
else if boundary2.isProperlyContainedIn(boundary1) then 1
464-
else if sym1.is(Bridge) && !sym2.is(Bridge) then -2
465-
else if sym2.is(Bridge) && !sym1.is(Bridge) then 2
466-
else if sym2.is(Method) && !sym1.is(Method) then -2
467-
else if sym1.is(Method) && !sym2.is(Method) then 2
466+
else if sym2.is(Method) && !sym1.is(Method) then -1
467+
else if sym1.is(Method) && !sym2.is(Method) then 1
468468
else 0
469469

470470
val matchLoosely = sym1.matchNullaryLoosely || sym2.matchNullaryLoosely

0 commit comments

Comments
 (0)