diff options
author | Felix Mulder <felix.mulder@gmail.com> | 2016-11-16 15:45:03 +0100 |
---|---|---|
committer | Felix Mulder <felix.mulder@gmail.com> | 2016-11-17 10:04:24 +0100 |
commit | 17ef1d85a55f049fa1f21dd279e47d61fe3eaa8c (patch) | |
tree | 83768dcb39c77640c612ab1024a3713c2a8be7c1 /src/dotty/tools/dotc/typer/Namer.scala | |
parent | 6a398a2d551534157f14c4bba103c3dff9b85c18 (diff) | |
download | dotty-17ef1d85a55f049fa1f21dd279e47d61fe3eaa8c.tar.gz dotty-17ef1d85a55f049fa1f21dd279e47d61fe3eaa8c.tar.bz2 dotty-17ef1d85a55f049fa1f21dd279e47d61fe3eaa8c.zip |
Only issue error, no unlinking
Unlinking proved to cause other problems in the typer, specifically if
typechecking members of non-existing package or things referring to the
unlinked package
Diffstat (limited to 'src/dotty/tools/dotc/typer/Namer.scala')
-rw-r--r-- | src/dotty/tools/dotc/typer/Namer.scala | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/dotty/tools/dotc/typer/Namer.scala b/src/dotty/tools/dotc/typer/Namer.scala index 22b5517dd..9343597a4 100644 --- a/src/dotty/tools/dotc/typer/Namer.scala +++ b/src/dotty/tools/dotc/typer/Namer.scala @@ -347,14 +347,13 @@ class Namer { typer: Typer => if ((existing is Package) && (pkgOwner eq existing.owner)) existing else { - // If the name exists as type we should unlink the existing name from the - // scope, issue an error and continue, as usual: + /** If there's already an existing type, then the package is a dup of this type */ val existingTpe = pkgOwner.info.decls.lookup(pid.name.toTypeName) if (existingTpe != NoSymbol) { ctx.error(PkgDuplicateSymbol(existingTpe), pid.pos) - pkgOwner.info.decls.openForMutations.unlink(existingTpe) + ctx.newCompletePackageSymbol(pkgOwner, (pid.name.asTermName.show + "$$package").toTermName).entered } - ctx.newCompletePackageSymbol(pkgOwner, pid.name.asTermName).entered + else ctx.newCompletePackageSymbol(pkgOwner, pid.name.asTermName).entered } } @@ -388,9 +387,10 @@ class Namer { typer: Typer => localCtx } - /** For all class definitions `stat` in `xstats`: If the companion class if not also defined - * in `xstats`, invalidate it by setting its info to NoType. - */ + /** For all class definitions `stat` in `xstats`: If the companion class if + * not also defined in `xstats`, invalidate it by setting its info to + * NoType. + */ def invalidateCompanions(pkg: Symbol, xstats: List[untpd.Tree])(implicit ctx: Context): Unit = { val definedNames = xstats collect { case stat: NameTree => stat.name } def invalidate(name: TypeName) = |