aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/Run.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-09-06 11:35:07 +0200
committerMartin Odersky <odersky@gmail.com>2014-09-06 11:36:35 +0200
commitb58b90683652e1b6e2c32412f0a03ba614b61b33 (patch)
treeb86490f67c73d5d91bcc54f691469812f6b88a73 /src/dotty/tools/dotc/Run.scala
parente1040935cbcc1d767933c38a141372538ef63ac2 (diff)
downloaddotty-b58b90683652e1b6e2c32412f0a03ba614b61b33.tar.gz
dotty-b58b90683652e1b6e2c32412f0a03ba614b61b33.tar.bz2
dotty-b58b90683652e1b6e2c32412f0a03ba614b61b33.zip
Generalize phase postcondition checking.
Have a general way how a phase can establish a postcondition which will be checked each time a later phase is tree-checked. Moves erasure constraints from TreeChecker to Erasure's post condition.
Diffstat (limited to 'src/dotty/tools/dotc/Run.scala')
-rw-r--r--src/dotty/tools/dotc/Run.scala9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/Run.scala b/src/dotty/tools/dotc/Run.scala
index a639b20cd..a4c862a84 100644
--- a/src/dotty/tools/dotc/Run.scala
+++ b/src/dotty/tools/dotc/Run.scala
@@ -37,17 +37,18 @@ class Run(comp: Compiler)(implicit ctx: Context) {
val phasesToRun = ctx.allPhases.init
.takeWhile(!stoppedBefore(_))
.filterNot(ctx.settings.Yskip.value.containsPhase(_))
- for (phase <- phasesToRun) {
+ for (phase <- phasesToRun)
if (!ctx.reporter.hasErrors) {
phase.runOn(units)
def foreachUnit(op: Context => Unit)(implicit ctx: Context): Unit =
for (unit <- units) op(ctx.fresh.setPhase(phase.next).setCompilationUnit(unit))
if (ctx.settings.Xprint.value.containsPhase(phase))
foreachUnit(printTree)
- if (ctx.settings.Ycheck.value.containsPhase(phase) && !ctx.reporter.hasErrors)
- foreachUnit(TreeChecker.check)
+ if (ctx.settings.Ycheck.value.containsPhase(phase) && !ctx.reporter.hasErrors) {
+ assert(phase.isCheckable, s"phase $phase is not checkable")
+ foreachUnit(TreeChecker.check(phasesToRun, _))
+ }
}
- }
}
}