Skip to content

Commit c6965c9

Browse files
committed
Warn if -Vprint is not a phase
1 parent 9e0397e commit c6965c9

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
@@ -345,6 +345,10 @@ extends ImplicitRunInfo, ConstraintRunInfo, cc.CaptureRunInfo {
345345
val phases = ctx.base.fusePhases(pluginPlan,
346346
ctx.settings.Yskip.value, ctx.settings.YstopBefore.value, stopAfter, ctx.settings.Ycheck.value)
347347
ctx.base.usePhases(phases, runCtx)
348+
val phasesSettings = List("-Vphases", "-Vprint")
349+
for phasesSetting <- ctx.settings.allSettings if phasesSettings.contains(phasesSetting.name) do
350+
for case vs: List[String] <- phasesSetting.userValue; p <- vs do
351+
if !phases.exists(_.phaseName == p) then report.warning(s"'$p' specifies no phase")
348352

349353
if ctx.settings.YnoDoubleBindings.value then
350354
ctx.base.checkNoDoubleBindings = true
@@ -367,7 +371,7 @@ extends ImplicitRunInfo, ConstraintRunInfo, cc.CaptureRunInfo {
367371
profiler.onPhase(phase):
368372
try units = phase.runOn(units)
369373
catch case _: InterruptedException => cancelInterrupted()
370-
for (printAt <- ctx.settings.Xprint.userValue if printAt.containsPhase(phase))
374+
for printAt <- ctx.settings.Vprint.userValue if printAt.containsPhase(phase) do
371375
for (unit <- units)
372376
def printCtx(unit: CompilationUnit) = phase.printingContext(
373377
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
@@ -144,7 +144,7 @@ private sealed trait PluginSettings:
144144
private sealed trait VerboseSettings:
145145
self: SettingGroup =>
146146
val Vhelp: Setting[Boolean] = BooleanSetting(VerboseSetting, "V", "Print a synopsis of verbose options.")
147-
val Xprint: Setting[List[String]] = PhasesSetting(VerboseSetting, "Vprint", "Print out program after", default = "typer", aliases = List("-Xprint"))
147+
val Vprint: Setting[List[String]] = PhasesSetting(VerboseSetting, "Vprint", "Print out program after", default = "typer", aliases = List("-Xprint"))
148148
val XshowPhases: Setting[List[String]] = PhasesSetting(VerboseSetting, "Vphases", "List compiler phases.", default = "none", aliases = List("-Xshow-phases"))
149149

150150
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
@@ -183,10 +183,10 @@ abstract class Recheck extends Phase, SymTransformer:
183183

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

191191
def resetNuTypes()(using Context): Unit =
192192
nuTypes.clear(resetToInitial = false)

0 commit comments

Comments
 (0)