Skip to content

Commit

Permalink
Check only existing conflicting def with source
Browse files Browse the repository at this point in the history
  • Loading branch information
som-snytt committed May 9, 2023
1 parent 830230f commit a581414
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions compiler/src/dotty/tools/dotc/typer/Typer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,9 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
val found =
if owner.is(Package) then
owner.denot.asClass.membersNamed(name)
.filterWithPredicate(d => !d.symbol.is(Package) && d.symbol.source == denot.symbol.source)
.filterWithPredicate(d => !d.symbol.is(Package)
&& denot.symbol.source.ne(util.NoSource)
&& d.symbol.source == denot.symbol.source)
else
val scope = if owner.isClass then owner.info.decls else outer.scope
scope.denotsNamed(name)
Expand Down Expand Up @@ -479,7 +481,7 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
result = checkNewOrShadowed(found, Definition) // no need to go further out, we found highest prec entry
found match
case found: NamedType
if curOwner.isClass && isInherited(found.denot) && !ctx.compilationUnit.isJava =>
if curOwner.isClass && found.denot.exists && isInherited(found.denot) && !ctx.compilationUnit.isJava =>
checkNoOuterDefs(found.denot, ctx, ctx)
case _ =>
else
Expand Down

0 comments on commit a581414

Please sign in to comment.