aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/pickling
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-04-05 16:54:10 +0200
committerMartin Odersky <odersky@gmail.com>2013-04-05 16:54:40 +0200
commit4ce196d8152f75163edb362fcd21fb37631b7fde (patch)
treeb1bfe19ab22935474b0be5939d61e93c8e86719a /src/dotty/tools/dotc/core/pickling
parent859840dd0662a12fbc1ba470438eca779b08ed89 (diff)
downloaddotty-4ce196d8152f75163edb362fcd21fb37631b7fde.tar.gz
dotty-4ce196d8152f75163edb362fcd21fb37631b7fde.tar.bz2
dotty-4ce196d8152f75163edb362fcd21fb37631b7fde.zip
Made module class names end in '$'.
If module classes have the same names as their companion classes there is the latent trap that TypeRefs refer to one or the other. To avoid cross-talk, module classes need to have a different name. Also, some fixes to baseType, isSubClass in SymDenotations.
Diffstat (limited to 'src/dotty/tools/dotc/core/pickling')
-rw-r--r--src/dotty/tools/dotc/core/pickling/ClassfileParser.scala4
-rw-r--r--src/dotty/tools/dotc/core/pickling/UnPickler.scala5
2 files changed, 5 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala b/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala
index 4981a6f4e..ac0e86110 100644
--- a/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala
+++ b/src/dotty/tools/dotc/core/pickling/ClassfileParser.scala
@@ -684,7 +684,7 @@ class ClassfileParser(
innerClasses.get(externalName) match {
case Some(entry) =>
- val outerName = entry.outerName.stripModuleSuffix
+ val outerName = entry.outerName.stripModuleClassSuffix
val owner = classSymbol(outerName)
val result = cctx.atPhaseNotLaterThanTyper { implicit ctx =>
getMember(owner, innerName.toTypeName)
@@ -808,7 +808,7 @@ class ClassfileParser(
val start = starts(index)
if (in.buf(start).toInt != CONSTANT_CLASS) errorBadTag(start)
val name = getExternalName(in.getChar(start + 1))
- if (name.isModuleName) c = cctx.requiredModule(name.stripModuleSuffix.asTermName)
+ if (name.isModuleClassName) c = cctx.requiredModule(name.stripModuleClassSuffix.asTermName)
else c = classNameToSymbol(name)
values(index) = c
}
diff --git a/src/dotty/tools/dotc/core/pickling/UnPickler.scala b/src/dotty/tools/dotc/core/pickling/UnPickler.scala
index c47b3b2d4..bed88e1dd 100644
--- a/src/dotty/tools/dotc/core/pickling/UnPickler.scala
+++ b/src/dotty/tools/dotc/core/pickling/UnPickler.scala
@@ -412,9 +412,10 @@ class UnPickler(bytes: Array[Byte], classRoot: ClassDenotation, moduleClassRoot:
// symbols that were pickled with Pickler.writeSymInfo
val nameref = readNat()
- val name = at(nameref, readName)
+ val name0 = at(nameref, readName)
val owner = readSymbolRef()
- val flags = unpickleScalaFlags(readLongNat(), name.isTypeName)
+ val flags = unpickleScalaFlags(readLongNat(), name0.isTypeName)
+ val name = name0.adjustIfModuleClass(flags)
def isClassRoot = (name == classRoot.name) && (owner == classRoot.owner) && !(flags is ModuleClass)
def isModuleClassRoot = (name == moduleClassRoot.name) && (owner == moduleClassRoot.owner) && (flags is Module)