summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-09-09 12:25:26 -0700
committerPaul Phillips <paulp@improving.org>2013-09-09 12:53:32 -0700
commit288b12e48af3222134f3985b65e40f202af81df2 (patch)
tree87dedc0c05be446bf8ad76f1aa760af13ed145bb /src/compiler/scala/tools/nsc/typechecker/Contexts.scala
parentf342445f68654c1606871b5d7372621558731f65 (diff)
downloadscala-288b12e48af3222134f3985b65e40f202af81df2.tar.gz
scala-288b12e48af3222134f3985b65e40f202af81df2.tar.bz2
scala-288b12e48af3222134f3985b65e40f202af81df2.zip
Noise reduction + minor enhance in TreeCheckers.
Misc irrelevant work, which I can only offer as-is. It lowers the noise in -Ycheck:* output and performs some common sense chillaxes like not screaming ERROR IN INTERNAL CHECKING! WE'RE ALL GOING TO DIE! when a tree doesn't hit all nine points at the Jiffy Tree. You can see some reasonably well reduced symbol flailing if you run the included pending tests: test/partest --show-diff test/pending/pos/treecheckers Example output, Out of scope symbol reference { tree TypeTree Factory[Traversable] position OffsetPosition test/pending/pos/treecheckers/c5.scala:3 with sym ClassSymbol Factory: Factory[CC] and tpe ClassArgsTypeRef Factory[Traversable] encl(1) ModuleSymbol object Test5 ref to AbstractTypeSymbol X (<deferred> <param>) }
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Contexts.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Contexts.scala6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
index 8d42bf94f3..cd2b9b3a97 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
@@ -19,6 +19,8 @@ trait Contexts { self: Analyzer =>
import definitions.{ JavaLangPackage, ScalaPackage, PredefModule, ScalaXmlTopScope, ScalaXmlPackage }
import ContextMode._
+ protected def onTreeCheckerError(pos: Position, msg: String): Unit = ()
+
object NoContext
extends Context(EmptyTree, NoSymbol, EmptyScope, NoCompilationUnit,
null) { // We can't pass the uninitialized `this`. Instead, we treat null specially in `Context#outer`
@@ -531,8 +533,8 @@ trait Contexts { self: Analyzer =>
if (msg endsWith ds) msg else msg + ds
}
- private def unitError(pos: Position, msg: String) =
- unit.error(pos, if (checking) "\n**** ERROR DURING INTERNAL CHECKING ****\n" + msg else msg)
+ private def unitError(pos: Position, msg: String): Unit =
+ if (checking) onTreeCheckerError(pos, msg) else unit.error(pos, msg)
@inline private def issueCommon(err: AbsTypeError)(pf: PartialFunction[AbsTypeError, Unit]) {
if (settings.Yissuedebug) {