summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2011-09-23 14:45:04 +0000
committerMartin Odersky <odersky@gmail.com>2011-09-23 14:45:04 +0000
commit7bfdac0b73c28109b5d3130783feaca4a7c06100 (patch)
tree8f0ed4055d0b2d0bfc8e75fabee1d49f282c8ee4 /src
parent1111b27d0eb95d69d7507291d242817a2dbe7e64 (diff)
downloadscala-7bfdac0b73c28109b5d3130783feaca4a7c06100.tar.gz
scala-7bfdac0b73c28109b5d3130783feaca4a7c06100.tar.bz2
scala-7bfdac0b73c28109b5d3130783feaca4a7c06100.zip
Now correctly handles moduleclasses in Importers
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/reflect/internal/Importers.scala8
-rw-r--r--src/compiler/scala/reflect/runtime/ToolBoxes.scala4
2 files changed, 8 insertions, 4 deletions
diff --git a/src/compiler/scala/reflect/internal/Importers.scala b/src/compiler/scala/reflect/internal/Importers.scala
index 47a9a8f8a6..440b5aa509 100644
--- a/src/compiler/scala/reflect/internal/Importers.scala
+++ b/src/compiler/scala/reflect/internal/Importers.scala
@@ -80,7 +80,9 @@ trait Importers { self: SymbolTable =>
mysym resetFlag Flags.LOCKED
} // end doImport
- if (myowner.isClass && !myowner.isRefinementClass && !(myowner hasFlag Flags.LOCKED) && sym.owner.info.decl(sym.name).exists) {
+ if (sym.isModuleClass) {
+ importSymbol(sym.sourceModule).moduleClass
+ } else if (myowner.isClass && !myowner.isRefinementClass && !(myowner hasFlag Flags.LOCKED) && sym.owner.info.decl(sym.name).exists) {
// symbol is in class scope, try to find equivalent one in local scope
if (sym.isOverloaded)
myowner.newOverloaded(myowner.thisType, sym.alternatives map importSymbol)
@@ -98,10 +100,10 @@ trait Importers { self: SymbolTable =>
"import failure: cannot determine unique overloaded method alternative from\n "+
(existing.alternatives map (_.defString) mkString "\n")+"\n that matches "+sym+":"+sym.tpe)
}
- if (existing.exists) existing
+ if (existing != NoSymbol) existing
else {
val mysym = doImport
- assert(myowner.info.decls.lookup(myname) == NoSymbol, myname+" "+myowner.info.decl(myname).exists)
+ assert(myowner.info.decls.lookup(myname) == NoSymbol, myname+" "+myowner.info.decl(myname)+" "+existing)
myowner.info.decls enter mysym
mysym
}
diff --git a/src/compiler/scala/reflect/runtime/ToolBoxes.scala b/src/compiler/scala/reflect/runtime/ToolBoxes.scala
index 8b7242e6b4..90b5aba27d 100644
--- a/src/compiler/scala/reflect/runtime/ToolBoxes.scala
+++ b/src/compiler/scala/reflect/runtime/ToolBoxes.scala
@@ -24,7 +24,9 @@ trait ToolBoxes extends { self: Universe =>
lazy val exporter = importer.reverse
def typeCheck(tree: Tree, expectedType: Type = WildcardType): Tree = {
- new compiler.Run
+ println("typing "+tree+", pt = "+expectedType)
+ val run = new compiler.Run
+ compiler.phase = run.refchecksPhase
val ctree: compiler.Tree = importer.importTree(tree)
val pt: compiler.Type = importer.importType(expectedType)
val ttree: compiler.Tree = compiler.typer.typed(ctree, compiler.analyzer.EXPRmode, pt)