diff options
author | Martin Odersky <odersky@gmail.com> | 2014-01-18 16:58:44 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-01-18 16:58:44 +0100 |
commit | ed6dacc5cc241aa0e15963db5a9eeb093b6a9293 (patch) | |
tree | 8b46565f82e0a09f4a37acdb80eed0817125da62 /src | |
parent | 559d25c88b39b7f2cac4a6c5b8431f8e0a62b56b (diff) | |
download | dotty-ed6dacc5cc241aa0e15963db5a9eeb093b6a9293.tar.gz dotty-ed6dacc5cc241aa0e15963db5a9eeb093b6a9293.tar.bz2 dotty-ed6dacc5cc241aa0e15963db5a9eeb093b6a9293.zip |
Fix openPackageModule wrt overloaded definitions
When opening overloaded definitions we need to avoid replacing existing symbols.
Diffstat (limited to 'src')
-rw-r--r-- | src/dotty/tools/dotc/core/SymDenotations.scala | 9 | ||||
-rw-r--r-- | src/dotty/tools/dotc/core/SymbolLoaders.scala | 2 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala index e94643f8a..9da918867 100644 --- a/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/src/dotty/tools/dotc/core/SymDenotations.scala @@ -911,7 +911,6 @@ object SymDenotations { * someone does a findMember on a subclass. */ def enter(sym: Symbol, scope: Scope = EmptyScope)(implicit ctx: Context): Unit = { - require(!(this is Frozen)) val mscope = scope match { case scope: MutableScope => scope case _ => decls.asInstanceOf[MutableScope] @@ -923,7 +922,13 @@ object SymDenotations { entry.sym.denot = sym.denot // to avoid stale symbols } } - mscope.enter(sym) + enterNoReplace(sym, mscope) + } + + /** Enter a symbol in current scope without potentially replacing the old copy. */ + def enterNoReplace(sym: Symbol, scope: MutableScope)(implicit ctx: Context): Unit = { + require(!(this is Frozen)) + scope.enter(sym) if (myMemberFingerPrint != FingerPrint.unknown) myMemberFingerPrint.include(sym.name) diff --git a/src/dotty/tools/dotc/core/SymbolLoaders.scala b/src/dotty/tools/dotc/core/SymbolLoaders.scala index 60717bb82..543b7cc1d 100644 --- a/src/dotty/tools/dotc/core/SymbolLoaders.scala +++ b/src/dotty/tools/dotc/core/SymbolLoaders.scala @@ -197,7 +197,7 @@ class SymbolLoaders { // enter non-private decls in the class for (member <- container.info.decls.iterator) { if (isImportable(member)) { - dest.enter(member) + dest.enterNoReplace(member, dest.decls.asInstanceOf[MutableScope]) } } // !!! TODO info.decls -> decls |