Skip to content

Commit a1333a7

Browse files
committed
Print whole TreeTransform name in Ycheck and Xprint
1 parent 5ec0bdf commit a1333a7

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

Diff for: src/dotty/tools/dotc/Run.scala

+5-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package dotc
33

44
import core._
55
import Contexts._, Periods._, Symbols._, Phases._, Decorators._
6+
import dotty.tools.dotc.transform.TreeTransforms.TreeTransformer
67
import io.PlainFile
78
import util.{SourceFile, NoSource, Stats, SimpleMap}
89
import reporting.Reporter
@@ -60,7 +61,10 @@ class Run(comp: Compiler)(implicit ctx: Context) {
6061

6162
private def printTree(ctx: Context) = {
6263
val unit = ctx.compilationUnit
63-
println(s"result of $unit after ${ctx.phase.prev}:")
64+
val prevPhase = ctx.phase.prev // can be a mini-phase
65+
val squahsedPhase = ctx.squashed(prevPhase)
66+
67+
println(s"result of $unit after ${squahsedPhase}:")
6468
println(unit.tpdTree.show(ctx))
6569
}
6670

Diff for: src/dotty/tools/dotc/core/Contexts.scala

+4
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,10 @@ object Contexts {
472472

473473
/** The standard definitions */
474474
val definitions = new Definitions
475+
476+
def squashed(p: Phase): Phase = {
477+
squashedPhases.find(_.period.containsPhaseId(p.id)).getOrElse(NoPhase)
478+
}
475479
}
476480

477481
/** The essential mutable state of a context base, collected into a common class */

Diff for: src/dotty/tools/dotc/transform/TreeChecker.scala

+3-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ class TreeChecker {
4949
}
5050

5151
def check(phasesToRun: Seq[Phase], ctx: Context) = {
52-
println(s"checking ${ctx.compilationUnit} after phase ${ctx.phase.prev}")
52+
val prevPhase = ctx.phase.prev // can be a mini-phase
53+
val squahsedPhase = ctx.squashed(prevPhase)
54+
println(s"checking ${ctx.compilationUnit} after phase ${squahsedPhase}")
5355
val checkingCtx = ctx.fresh
5456
.setTyperState(ctx.typerState.withReporter(new ThrowingReporter(ctx.typerState.reporter)))
5557
val checker = new Checker(previousPhases(phasesToRun.toList)(ctx))

0 commit comments

Comments
 (0)