Skip to content

Commit 288b12e

Browse files
committed
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>) }
1 parent f342445 commit 288b12e

File tree

10 files changed

+283
-121
lines changed

10 files changed

+283
-121
lines changed

src/compiler/scala/tools/nsc/typechecker/Contexts.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ trait Contexts { self: Analyzer =>
1919
import definitions.{ JavaLangPackage, ScalaPackage, PredefModule, ScalaXmlTopScope, ScalaXmlPackage }
2020
import ContextMode._
2121

22+
protected def onTreeCheckerError(pos: Position, msg: String): Unit = ()
23+
2224
object NoContext
2325
extends Context(EmptyTree, NoSymbol, EmptyScope, NoCompilationUnit,
2426
null) { // We can't pass the uninitialized `this`. Instead, we treat null specially in `Context#outer`
@@ -531,8 +533,8 @@ trait Contexts { self: Analyzer =>
531533
if (msg endsWith ds) msg else msg + ds
532534
}
533535

534-
private def unitError(pos: Position, msg: String) =
535-
unit.error(pos, if (checking) "\n**** ERROR DURING INTERNAL CHECKING ****\n" + msg else msg)
536+
private def unitError(pos: Position, msg: String): Unit =
537+
if (checking) onTreeCheckerError(pos, msg) else unit.error(pos, msg)
536538

537539
@inline private def issueCommon(err: AbsTypeError)(pf: PartialFunction[AbsTypeError, Unit]) {
538540
if (settings.Yissuedebug) {

0 commit comments

Comments
 (0)