@@ -408,16 +408,11 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
408
408
// Does reference `tp` refer only to inherited symbols?
409
409
def isInherited (denot : Denotation ) =
410
410
def isCurrent (mbr : SingleDenotation ): Boolean =
411
- ! mbr.symbol.exists || mbr.symbol.owner == ctx.owner || ctx.owner.is( Package )
411
+ ! mbr.symbol.exists || mbr.symbol.owner == ctx.owner
412
412
denot match
413
413
case denot : SingleDenotation => ! isCurrent(denot)
414
414
case denot => ! denot.hasAltWith(isCurrent)
415
415
416
- /* It is an error if an identifier x is available as an inherited member in an inner scope
417
- * and the same name x is defined in an outer scope in the same source file, unless
418
- * the inherited member (has an overloaded alternative that) coincides with
419
- * (an overloaded alternative of) the definition x.
420
- */
421
416
def checkNoOuterDefs (denot : Denotation , last : Context , prevCtx : Context ): Unit =
422
417
def sameTermOrType (d1 : SingleDenotation , d2 : Denotation ) =
423
418
d2.containsSym(d1.symbol) || d2.hasUniqueSym && {
@@ -434,15 +429,9 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
434
429
val owner = outer.owner
435
430
if (owner eq last.owner) && (outer.scope eq last.scope) then
436
431
checkNoOuterDefs(denot, outer, prevCtx)
437
- else if ! owner.isRoot then
438
- val found =
439
- if owner.is(Package ) then
440
- owner.denot.asClass.membersNamed(name)
441
- .filterWithPredicate(d => ! d.symbol.is(Package ) && d.symbol.source == denot.symbol.source)
442
- else
443
- val scope = if owner.isClass then owner.info.decls else outer.scope
444
- scope.denotsNamed(name)
445
- val competing = found.filterWithFlags(required, excluded | Synthetic )
432
+ else if ! owner.is(Package ) then
433
+ val scope = if owner.isClass then owner.info.decls else outer.scope
434
+ val competing = scope.denotsNamed(name).filterWithFlags(required, excluded)
446
435
if competing.exists then
447
436
val symsMatch = competing
448
437
.filterWithPredicate(sd => sameTermOrType(sd, denot))
0 commit comments