@@ -408,16 +408,11 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
408408 // Does reference `tp` refer only to inherited symbols?
409409 def isInherited (denot : Denotation ) =
410410 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
412412 denot match
413413 case denot : SingleDenotation => ! isCurrent(denot)
414414 case denot => ! denot.hasAltWith(isCurrent)
415415
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- */
421416 def checkNoOuterDefs (denot : Denotation , last : Context , prevCtx : Context ): Unit =
422417 def sameTermOrType (d1 : SingleDenotation , d2 : Denotation ) =
423418 d2.containsSym(d1.symbol) || d2.hasUniqueSym && {
@@ -434,15 +429,9 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
434429 val owner = outer.owner
435430 if (owner eq last.owner) && (outer.scope eq last.scope) then
436431 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)
446435 if competing.exists then
447436 val symsMatch = competing
448437 .filterWithPredicate(sd => sameTermOrType(sd, denot))
0 commit comments