diff options
author | Martin Odersky <odersky@gmail.com> | 2015-03-08 11:03:29 +0100 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-03-18 11:15:47 +0100 |
commit | 5a43cb120f33328fdc755488684240dbd517283f (patch) | |
tree | 4247fb76e5b85e75e33d925949fc6d3deb35b2a7 /src/dotty/tools/dotc/core/pickling/TreePickler.scala | |
parent | f1ffa4c0a0a32057795c4395aecd990c6ae057e2 (diff) | |
download | dotty-5a43cb120f33328fdc755488684240dbd517283f.tar.gz dotty-5a43cb120f33328fdc755488684240dbd517283f.tar.bz2 dotty-5a43cb120f33328fdc755488684240dbd517283f.zip |
Pickle shadowed names
Shadowed names in types need to be pickled and treated on
unpickling.
We choose to make Shadowed a separate TastyName class, to avoid
the ad-hoc name-mangling in current dotc. When names are redone
Shadowed will also become a special class in the compiler proper.
Diffstat (limited to 'src/dotty/tools/dotc/core/pickling/TreePickler.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/pickling/TreePickler.scala | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/dotty/tools/dotc/core/pickling/TreePickler.scala b/src/dotty/tools/dotc/core/pickling/TreePickler.scala index 3004043d5..7ffcaec6e 100644 --- a/src/dotty/tools/dotc/core/pickling/TreePickler.scala +++ b/src/dotty/tools/dotc/core/pickling/TreePickler.scala @@ -6,7 +6,7 @@ package pickling import ast.Trees._ import PickleFormat._ import core._ -import Contexts._, Symbols._, Types._, Names._, Constants._, Decorators._, Annotations._, StdNames.tpnme +import Contexts._, Symbols._, Types._, Names._, Constants._, Decorators._, Annotations._, StdNames.tpnme, NameOps._ import collection.mutable import TastyBuffer._ @@ -296,9 +296,13 @@ class TreePickler(pickler: TastyPickler) { pickleType(tree.tpe) case Select(qual, name) => writeByte(SELECT) + val realName = tree.tpe match { + case tp: NamedType if tp.name.isShadowedName => tp.name + case _ => name + } val sig = tree.tpe.signature - if (sig == Signature.NotAMethod) pickleName(name) - else pickleNameAndSig(name, sig) + if (sig == Signature.NotAMethod) pickleName(realName) + else pickleNameAndSig(realName, sig) pickleTree(qual) case Apply(fun, args) => writeByte(APPLY) |