From 21fcf64c8197b481325c3765b897f7159817875c Mon Sep 17 00:00:00 2001 From: Hubert Plociniczak Date: Sun, 12 Aug 2012 14:20:14 +0200 Subject: Fixes SI-6214. addSynthetics was calling typedStat that caused flushing error buffer. Typically that would result in errors being re-added but addSynthetics was the last thing to run in typedStats. Instead of adding yet another check I used this as an opportunity to cleanup the once necessary workaround for typing stats. Since we are now chaining buffers of contexts manual handling is no longer necessary. Review by @odersky (I recall that you were planning to cleanup that part at some point). --- src/compiler/scala/tools/nsc/typechecker/Typers.scala | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala') diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index a6d7424837..5bd96d49ce 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -2644,7 +2644,6 @@ trait Typers extends Modes with Adaptations with Tags { def includesTargetPos(tree: Tree) = tree.pos.isRange && context.unit.exists && (tree.pos includes context.unit.targetPos) val localTarget = stats exists includesTargetPos - val statsErrors = scala.collection.mutable.LinkedHashSet[AbsTypeError]() def typedStat(stat: Tree): Tree = { if (context.owner.isRefinementClass && !treeInfo.isDeclarationOrTypeDef(stat)) OnlyDeclarationsError(stat) @@ -2663,7 +2662,6 @@ trait Typers extends Modes with Adaptations with Tags { stat } else { val localTyper = if (inBlock || (stat.isDef && !stat.isInstanceOf[LabelDef])) { - context.flushBuffer() this } else newTyper(context.make(stat, exprOwner)) // XXX this creates a spurious dead code warning if an exception is thrown @@ -2680,7 +2678,6 @@ trait Typers extends Modes with Adaptations with Tags { "a pure expression does nothing in statement position; " + "you may be omitting necessary parentheses" ) - statsErrors ++= localTyper.context.errBuffer result } } @@ -2763,12 +2760,7 @@ trait Typers extends Modes with Adaptations with Tags { } } - val stats1 = withSavedContext(context) { - val result = stats mapConserve typedStat - context.flushBuffer() - result - } - context.updateBuffer(statsErrors) + val stats1 = stats mapConserve typedStat if (phase.erasedTypes) stats1 else { checkNoDoubleDefs(stats1) -- cgit v1.2.3