Skip to content

Commit 9d1b4bf

Browse files
committed
Print whole TreeTransform name in Ycheck and Xprint
1 parent 7ebc502 commit 9d1b4bf

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
@@ -50,7 +50,9 @@ class TreeChecker {
5050
}
5151

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

0 commit comments

Comments
 (0)