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/dotty/tools/dotc/core/SymDenotations.scala | |
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/dotty/tools/dotc/core/SymDenotations.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/SymDenotations.scala | 9 |
1 files changed, 7 insertions, 2 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) |