aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/core/SymbolLoaders.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-03-24 15:02:27 +0100
committerMartin Odersky <odersky@gmail.com>2013-03-24 15:02:27 +0100
commit4a17f0d1e17adecbdc4755bf719feff18d115318 (patch)
tree1d373cd855f9631fd567bbbba2f0e9dd633ecc3d /src/dotty/tools/dotc/core/SymbolLoaders.scala
parentb791ef8e586d86af68f1212c9abecc22bb2d4de1 (diff)
downloaddotty-4a17f0d1e17adecbdc4755bf719feff18d115318.tar.gz
dotty-4a17f0d1e17adecbdc4755bf719feff18d115318.tar.bz2
dotty-4a17f0d1e17adecbdc4755bf719feff18d115318.zip
More fixes to classfile loading.
Diffstat (limited to 'src/dotty/tools/dotc/core/SymbolLoaders.scala')
-rw-r--r--src/dotty/tools/dotc/core/SymbolLoaders.scala22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/core/SymbolLoaders.scala b/src/dotty/tools/dotc/core/SymbolLoaders.scala
index cb20b894a..f5c8bf999 100644
--- a/src/dotty/tools/dotc/core/SymbolLoaders.scala
+++ b/src/dotty/tools/dotc/core/SymbolLoaders.scala
@@ -259,7 +259,27 @@ class ClassfileLoader(val classfile: AbstractFile)(implicit val cctx: CondensedC
def rootDenots(rootDenot: ClassDenotation): (ClassDenotation, ClassDenotation) = {
val linkedDenot = rootDenot.linkedClass.denot match {
case d: ClassDenotation => d
- case d => throw new FatalError(s"linked class denot $d of $rootDenot is expected to be a ClassDenotation, but is a ${d.getClass}")
+ case d =>
+ // this can happen if the companion if shadowed by a val or type
+ // in a package object; in this case, we make up some dummy denotation
+ // as a stand in for loading.
+ // An example for this situation is scala.reflect.Manifest, which exists
+ // as a class in scala.reflect and as a val in scala.reflect.package.
+ if (rootDenot is ModuleClass)
+ cctx.newClassSymbol(
+ rootDenot.owner, rootDenot.name.asTypeName, Synthetic,
+ _ => NoType).classDenot
+ else {
+ def modClassCompleter(modul: TermSymbol, modcls: ClassSymbol) =
+ new LazyModuleClassInfo {
+ val decls = newScope
+ def module = modul
+ def complete(denot: SymDenotation) = unsupported("complete")
+ }
+ cctx.newModuleSymbol(
+ rootDenot.owner, rootDenot.name.toTermName, Synthetic, Synthetic,
+ modClassCompleter).moduleClass.denot.asClass
+ }
}
if (rootDenot is ModuleClass) (linkedDenot, rootDenot)
else (rootDenot, linkedDenot)