Skip to content

Commit bbefd66

Browse files
committed
Warn if -Vprint is not a phase
1 parent 4259fd3 commit bbefd66

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

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

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

324328
if ctx.settings.YnoDoubleBindings.value then
325329
ctx.base.checkNoDoubleBindings = true
@@ -343,7 +347,7 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint
343347
try units = phase.runOn(units)
344348
catch case _: InterruptedException => cancelInterrupted()
345349
profiler.afterPhase(phase, profileBefore)
346-
for (printAt <- ctx.settings.Xprint.userValue if printAt.containsPhase(phase))
350+
for printAt <- ctx.settings.Vprint.userValue if printAt.containsPhase(phase) do
347351
for (unit <- units)
348352
def printCtx(unit: CompilationUnit) = phase.printingContext(
349353
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
@@ -142,7 +142,7 @@ private sealed trait PluginSettings:
142142
private sealed trait VerboseSettings:
143143
self: SettingGroup =>
144144
val Vhelp: Setting[Boolean] = BooleanSetting(VerboseSetting, "V", "Print a synopsis of verbose options.")
145-
val Xprint: Setting[List[String]] = PhasesSetting(VerboseSetting, "Vprint", "Print out program after", default = "typer", aliases = List("-Xprint"))
145+
val Vprint: Setting[List[String]] = PhasesSetting(VerboseSetting, "Vprint", "Print out program after", default = "typer", aliases = List("-Xprint"))
146146
val XshowPhases: Setting[List[String]] = PhasesSetting(VerboseSetting, "Vphases", "List compiler phases.", default = "none", aliases = List("-Xshow-phases"))
147147

148148
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ abstract class Recheck extends Phase, SymTransformer:
180180
* can be retrieved with `knownType`
181181
*/
182182
private val keepAllTypes = inContext(ictx) {
183-
ictx.settings.Xprint.value.containsPhase(thisPhase)
183+
ictx.settings.Vprint.value.containsPhase(thisPhase)
184184
}
185185

186186
/** Should type of `tree` be kept in an attachment so that it can be retrieved with

0 commit comments

Comments
 (0)