@@ -386,25 +386,28 @@ object Denotations {
386
386
/** Establish a partial order "preference" order between symbols.
387
387
* Give preference to `sym1` over `sym2` if one of the following
388
388
* conditions holds, in decreasing order of weight:
389
- * 1. sym1 is concrete and sym2 is abstract
390
- * 2. The owner of sym1 comes before the owner of sym2 in the linearization
389
+ * 1. sym2 doesn't exist
390
+ * 2. sym1 is concrete and sym2 is abstract
391
+ * 3. The owner of sym1 comes before the owner of sym2 in the linearization
391
392
* of the type of the prefix `pre`.
392
- * 3 . The access boundary of sym2 is properly contained in the access
393
+ * 4 . The access boundary of sym2 is properly contained in the access
393
394
* boundary of sym1. For protected access, we count the enclosing
394
395
* package as access boundary.
395
- * 4 . sym1 a method but sym2 is not.
396
+ * 5 . sym1 a method but sym2 is not.
396
397
* The aim of these criteria is to give some disambiguation on access which
397
398
* - does not depend on textual order or other arbitrary choices
398
399
* - minimizes raising of doubleDef errors
399
400
*/
400
401
def preferSym (sym1 : Symbol , sym2 : Symbol ) =
401
402
sym1.eq(sym2) ||
402
- sym1.isAsConcrete(sym2) &&
403
- (! sym2.isAsConcrete(sym1) ||
404
- precedes(sym1.owner, sym2.owner) ||
405
- accessBoundary(sym2).isProperlyContainedIn(accessBoundary(sym1)) ||
406
- sym1.is(Method ) && ! sym2.is(Method )) ||
407
- sym1.info.isErroneous
403
+ sym1.exists &&
404
+ (! sym2.exists ||
405
+ sym1.isAsConcrete(sym2) &&
406
+ (! sym2.isAsConcrete(sym1) ||
407
+ precedes(sym1.owner, sym2.owner) ||
408
+ accessBoundary(sym2).isProperlyContainedIn(accessBoundary(sym1)) ||
409
+ sym1.is(Method ) && ! sym2.is(Method )) ||
410
+ sym1.info.isErroneous)
408
411
409
412
/** Sym preference provided types also override */
410
413
def prefer (sym1 : Symbol , sym2 : Symbol , info1 : Type , info2 : Type ) =
@@ -425,9 +428,7 @@ object Denotations {
425
428
else if (isDoubleDef(sym1, sym2)) handleDoubleDef
426
429
else {
427
430
val sym =
428
- if (! sym1.exists) sym2
429
- else if (! sym2.exists) sym1
430
- else if (preferSym(sym2, sym1)) sym2
431
+ if (preferSym(sym2, sym1)) sym2
431
432
else sym1
432
433
val jointInfo =
433
434
try infoMeet(info1, info2)
@@ -1243,4 +1244,4 @@ object Denotations {
1243
1244
util.Stats .record(" stale symbol" )
1244
1245
override def getMessage () = msg
1245
1246
}
1246
- }
1247
+ }
0 commit comments