Skip to content

Commit 5a22963

Browse files
committed
Warn if -Vprint is not a phase
1 parent 276c9a9 commit 5a22963

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

compiler/src/dotty/tools/dotc/Run.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,10 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint
344344
val phases = ctx.base.fusePhases(pluginPlan,
345345
ctx.settings.Yskip.value, ctx.settings.YstopBefore.value, stopAfter, ctx.settings.Ycheck.value)
346346
ctx.base.usePhases(phases, runCtx)
347+
val phasesSettings = List("-Vphases", "-Vprint")
348+
for phasesSetting <- ctx.settings.allSettings if phasesSettings.contains(phasesSetting.name) do
349+
for case vs: List[String] <- phasesSetting.userValue; p <- vs do
350+
if !phases.exists(_.phaseName == p) then report.warning(s"'$p' specifies no phase")
347351

348352
if ctx.settings.YnoDoubleBindings.value then
349353
ctx.base.checkNoDoubleBindings = true
@@ -366,7 +370,7 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint
366370
profiler.onPhase(phase):
367371
try units = phase.runOn(units)
368372
catch case _: InterruptedException => cancelInterrupted()
369-
for (printAt <- ctx.settings.Xprint.userValue if printAt.containsPhase(phase))
373+
for printAt <- ctx.settings.Vprint.userValue if printAt.containsPhase(phase) do
370374
for (unit <- units)
371375
def printCtx(unit: CompilationUnit) = phase.printingContext(
372376
ctx.fresh.setPhase(phase.next).setCompilationUnit(unit))

compiler/src/dotty/tools/dotc/config/ScalaSettings.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ private sealed trait PluginSettings:
145145
private sealed trait VerboseSettings:
146146
self: SettingGroup =>
147147
val Vhelp: Setting[Boolean] = BooleanSetting(VerboseSetting, "V", "Print a synopsis of verbose options.")
148-
val Xprint: Setting[List[String]] = PhasesSetting(VerboseSetting, "Vprint", "Print out program after", default = "typer", aliases = List("-Xprint"))
148+
val Vprint: Setting[List[String]] = PhasesSetting(VerboseSetting, "Vprint", "Print out program after", default = "typer", aliases = List("-Xprint"))
149149
val XshowPhases: Setting[List[String]] = PhasesSetting(VerboseSetting, "Vphases", "List compiler phases.", default = "none", aliases = List("-Xshow-phases"))
150150

151151
val Vprofile: Setting[Boolean] = BooleanSetting(VerboseSetting, "Vprofile", "Show metrics about sources and internal representations to estimate compile-time complexity.")

compiler/src/dotty/tools/dotc/transform/Recheck.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,10 @@ abstract class Recheck extends Phase, SymTransformer:
184184

185185
/** If true, remember the new types of nodes in this compilation unit
186186
* as an attachment in the unit's tpdTree node. By default, this is
187-
* enabled when -Xprint:cc is set. Can be overridden.
187+
* enabled when -Vprint:cc is set. Can be overridden.
188188
*/
189189
def keepNuTypes(using Context): Boolean =
190-
ctx.settings.Xprint.value.containsPhase(thisPhase)
190+
ctx.settings.Vprint.value.containsPhase(thisPhase)
191191

192192
/** A map from NamedTypes to the denotations they had before this phase.
193193
* Needed so that we can `reset` them after this phase.

0 commit comments

Comments
 (0)