aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/core/tasty
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2017-04-01 17:21:39 +0200
committerMartin Odersky <odersky@gmail.com>2017-04-11 09:33:12 +0200
commite4780e574f9613346e6908f7947f40a58327e376 (patch)
tree86272adfb176be109d35ceac9573f314598ee702 /compiler/src/dotty/tools/dotc/core/tasty
parente2fb134fd3a49848ea49a6db42a298276c08b110 (diff)
downloaddotty-e4780e574f9613346e6908f7947f40a58327e376.tar.gz
dotty-e4780e574f9613346e6908f7947f40a58327e376.tar.bz2
dotty-e4780e574f9613346e6908f7947f40a58327e376.zip
Keep package member names mangled
Once we start using unencoded operators internally, we will face the problem that one cannot decode realiably a class file filename. We therefore turn things around, keeping members of package scopes in mangled and encoded form. This is compensated by (1) mangling names for lookup of such members and (2) when unpickling from Scala 2 info or Tasty, comparing mangled names when matching a read class or module object against a root.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/core/tasty')
-rw-r--r--compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala b/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
index 96bf29a70..81519727c 100644
--- a/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
+++ b/compiler/src/dotty/tools/dotc/core/tasty/TreeUnpickler.scala
@@ -416,6 +416,7 @@ class TreeUnpickler(reader: TastyReader, nameAtRef: NameRef => TermName, posUnpi
val tag = readByte()
val end = readEnd()
var name: Name = readName()
+ val sname = name.toSimpleName
if (tag == TYPEDEF || tag == TYPEPARAM) name = name.toTypeName
skipParams()
val ttag = nextUnsharedTag
@@ -432,9 +433,10 @@ class TreeUnpickler(reader: TastyReader, nameAtRef: NameRef => TermName, posUnpi
def adjustIfModule(completer: LazyType) =
if (flags is Module) ctx.adjustModuleCompleter(completer, name) else completer
val sym =
- roots.find(root => (root.owner eq ctx.owner) && root.name == name) match {
+ roots.find(root => (root.owner eq ctx.owner) && root.name.toSimpleName == sname && root.isType == name.isTypeName) match {
case Some(rootd) =>
pickling.println(i"overwriting ${rootd.symbol} # ${rootd.hashCode}")
+ rootd.name = name
rootd.info = adjustIfModule(
new Completer(ctx.owner, subReader(start, end)) with SymbolLoaders.SecondCompleter)
rootd.flags = flags &~ Touched // allow one more completion