diff options
author | Martin Odersky <odersky@gmail.com> | 2011-09-23 14:45:04 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2011-09-23 14:45:04 +0000 |
commit | 7bfdac0b73c28109b5d3130783feaca4a7c06100 (patch) | |
tree | 8f0ed4055d0b2d0bfc8e75fabee1d49f282c8ee4 /src | |
parent | 1111b27d0eb95d69d7507291d242817a2dbe7e64 (diff) | |
download | scala-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.scala | 8 | ||||
-rw-r--r-- | src/compiler/scala/reflect/runtime/ToolBoxes.scala | 4 |
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) |