diff options
author | Martin Odersky <odersky@gmail.com> | 2006-07-04 11:57:47 +0000 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2006-07-04 11:57:47 +0000 |
commit | 2568aebb5aac69629c77c49651815ae8b993cffc (patch) | |
tree | dd15288b32f39e2bdcf2d881d9b7a1cb9f112b73 /src/compiler | |
parent | fe0436c6f94b8f113e710f183ccc39d9d6030e89 (diff) | |
download | scala-2568aebb5aac69629c77c49651815ae8b993cffc.tar.gz scala-2568aebb5aac69629c77c49651815ae8b993cffc.tar.bz2 scala-2568aebb5aac69629c77c49651815ae8b993cffc.zip |
Fixed bug648
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 5ecda5069f..92e87f85cf 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -578,6 +578,7 @@ trait Typers requires Analyzer { } } catch { case ex: TypeError => + templ.tpe = null reportTypeError(templ.pos, ex) List(TypeTree(AnyRefClass.tpe)) } @@ -886,6 +887,11 @@ trait Typers requires Analyzer { } def typedBlock(block: Block, mode: int, pt: Type): Block = { + if (context.retyping) { + for (val stat <- block.stats) { + if (stat.isDef) context.scope.enter(stat.symbol) + } + } namer.enterSyms(block.stats) block.stats foreach enterLabelDef val stats1 = typedStats(block.stats, context.owner) @@ -957,6 +963,7 @@ trait Typers requires Analyzer { } else argpt namer.enterSym(vparam) + if (context.retyping) context.scope enter vparam.symbol vparam.symbol } val vparams = List.mapConserve(fun.vparams)(typedValDef) @@ -1474,8 +1481,9 @@ trait Typers requires Analyzer { /* newTyper(context.makeNewScope(tree, context.owner)).typedFunction(fun, mode, pt) */ - tree.symbol = context.owner.newValue(tree.pos, nme.ANON_FUN_NAME) - .setFlag(SYNTHETIC).setInfo(NoType) + if (tree.symbol == NoSymbol) + tree.symbol = context.owner.newValue(tree.pos, nme.ANON_FUN_NAME) + .setFlag(SYNTHETIC).setInfo(NoType) newTyper(context.makeNewScope(tree, tree.symbol)).typedFunction(fun, mode, pt) case Assign(lhs, rhs) => @@ -1608,6 +1616,7 @@ trait Typers requires Analyzer { phase.id <= currentRun.typerPhase.id && fun1.isInstanceOf[Select] && !fun1.tpe.isInstanceOf[ImplicitMethodType] && + (fun1.symbol == null || !fun1.symbol.isConstructor) && (mode & (EXPRmode | SNDTRYmode)) == EXPRmode) tryTypedApply(fun1, args) else { typedApply(tree, fun1, args, mode, pt) @@ -1739,6 +1748,7 @@ trait Typers requires Analyzer { result } catch { case ex: TypeError => + tree.tpe = null //System.out.println("caught "+ex+" in typed");//DEBUG reportTypeError(tree.pos, ex) setError(tree) |