Skip to content

Commit 2a8e31e

Browse files
committed
Warn if -Vprint is not a phase
1 parent 39c7850 commit 2a8e31e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
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.Vprint.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))

0 commit comments

Comments
 (0)