From 719588d17415f4958571be1774948a4d4fd3fadf Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Thu, 9 Mar 2006 15:26:18 +0000 Subject: --- src/compiler/scala/tools/nsc/symtab/Definitions.scala | 3 +-- .../tools/nsc/symtab/classfile/ClassfileParser.scala | 5 ++++- src/compiler/scala/tools/nsc/transform/Erasure.scala | 3 ++- src/compiler/scala/tools/nsc/typechecker/Typers.scala | 15 +++++++++------ 4 files changed, 16 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/compiler/scala/tools/nsc/symtab/Definitions.scala b/src/compiler/scala/tools/nsc/symtab/Definitions.scala index bbcc6cc776..7c1adb0ade 100644 --- a/src/compiler/scala/tools/nsc/symtab/Definitions.scala +++ b/src/compiler/scala/tools/nsc/symtab/Definitions.scala @@ -201,8 +201,7 @@ mixin class Definitions requires SymbolTable { if (module) sym.info.member(fullname.subName(i, j)).suchThat(.hasFlag(MODULE)); else sym.info.member(fullname.subName(i, j).toTypeName); if (result == NoSymbol) { - System.out.println(sym.info); - System.out.println(sym.info.members); + if (settings.debug.value) { System.out.println(sym.info); System.out.println(sym.info.members); }//debug throw new FatalError((if (module) "object " else "class ") + fullname + " not found."); } result diff --git a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala index 4519d2fcd6..29360f3ab1 100644 --- a/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala +++ b/src/compiler/scala/tools/nsc/symtab/classfile/ClassfileParser.scala @@ -154,7 +154,10 @@ abstract class ClassfileParser { val start = starts(index); if (in.buf(start) != CONSTANT_CLASS) errorBadTag(start); val name = getExternalName(in.getChar(start + 1)); - c = definitions.getClass(name); + if (name.pos('.') == name.length) + c = definitions.getMember(definitions.EmptyPackageClass, name.toTypeName) + else + c = definitions.getClass(name); values(index) = c; } c diff --git a/src/compiler/scala/tools/nsc/transform/Erasure.scala b/src/compiler/scala/tools/nsc/transform/Erasure.scala index d49e76693b..68dfc794f4 100644 --- a/src/compiler/scala/tools/nsc/transform/Erasure.scala +++ b/src/compiler/scala/tools/nsc/transform/Erasure.scala @@ -58,7 +58,8 @@ abstract class Erasure extends AddInterfaces with typechecker.Analyzer { } else if (sym == AnyClass || sym == AnyValClass) erasedTypeRef(ObjectClass) else if (sym == UnitClass) erasedTypeRef(BoxedUnitClass) - else if (sym.isClass) typeRef(apply(pre), sym, List()) + else if (sym.isClass) + typeRef(apply(if (sym.owner.isClass) sym.owner.tpe else pre), sym, List()) else apply(sym.info) case PolyType(tparams, restpe) => apply(restpe) diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 1722b0ce1c..10c96ac749 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -372,7 +372,7 @@ mixin class Typers requires Analyzer { if (settings.migrate.value && !tree.symbol.isConstructor && isCompatible(mt, pt)) error(tree.pos, migrateMsg + " method can be converted to function only if an expected function type is given"); else - error(tree.pos, "missing arguments for "+tree.symbol) + error(tree.pos, "missing arguments for "+tree.symbol+tree.symbol.locationString) } setError(tree) } @@ -930,11 +930,14 @@ mixin class Typers requires Analyzer { val scope = if (inBlock) context.scope else context.owner.info.decls; var e = scope.elems; while (e != null && e.owner == scope) { - var e1 = scope.lookupNextEntry(e); - while (e1 != null && e1.owner == scope) { - if (e.sym.isType || inBlock || (e.sym.tpe matches e1.sym.tpe)) - error(e.sym.pos, ""+e1.sym+" is defined twice"); - e1 = scope.lookupNextEntry(e1); + if (!e.sym.hasFlag(LOCAL)) { + var e1 = scope.lookupNextEntry(e); + while (e1 != null && e1.owner == scope) { + if (!e1.sym.hasFlag(LOCAL) && + (e.sym.isType || inBlock || (e.sym.tpe matches e1.sym.tpe))) + error(e.sym.pos, ""+e1.sym+" is defined twice"); + e1 = scope.lookupNextEntry(e1); + } } e = e.next } -- cgit v1.2.3