Skip to content

Commit 6a23cad

Browse files
committed
Phase name match is partial
1 parent bbefd66 commit 6a23cad

File tree

5 files changed

+7
-6
lines changed

5 files changed

+7
-6
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ class Run(comp: Compiler, ictx: Context) extends ImplicitRunInfo with Constraint
323323
val phasesSettings = List("-Vphases", "-Vprint")
324324
for phasesSetting <- ctx.settings.allSettings if phasesSettings.contains(phasesSetting.name) do
325325
for case vs: List[String] <- phasesSetting.userValue; p <- vs do
326-
if !phases.exists(_.phaseName == p) then report.warning(s"'$p' specifies no phase")
326+
if !phases.exists(List(p).containsPhase) then report.warning(s"'$p' specifies no phase")
327327

328328
if ctx.settings.YnoDoubleBindings.value then
329329
ctx.base.checkNoDoubleBindings = true

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ trait CliCommand:
162162
val maxCol = ctx.settings.pageWidth.value
163163
val field1 = maxField.min(texts.flatten.map(_._1.length).filter(_ < maxField).max) // widest field under maxField
164164
val field2 = if field1 + separation + maxField < maxCol then maxCol - field1 - separation else 0 // skinny window -> terminal wrap
165-
val toMark = ctx.settings.XshowPhases.value.toSet
165+
def toMark(name: String) = ctx.settings.Vphases.value.exists(name.contains)
166166
def separator(name: String) = if toMark(name) then "->" + " " * (separation - 2) else " " * separation
167167
val EOL = "\n"
168168
def formatField1(text: String): String = if text.length <= field1 then text.padLeft(field1) else text + EOL + "".padLeft(field1)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ abstract class CompilerCommand extends CliCommand:
1717
else if (settings.Xhelp.value) xusageMessage
1818
else if (settings.Yhelp.value) yusageMessage
1919
else if (settings.showPlugins.value) ctx.base.pluginDescriptions
20-
else if settings.XshowPhases.isPresentIn(summon[SettingsState]) then phasesMessage
20+
else if settings.Vphases.isPresent then phasesMessage
2121
else ""
2222

23-
final def isHelpFlag(using settings: ConcreteSettings)(using SettingsState): Boolean =
23+
final def isHelpFlag(using settings: ConcreteSettings)(using ss: SettingsState): Boolean =
2424
import settings.*
2525
val flags = Set(help, Vhelp, Whelp, Xhelp, Yhelp, showPlugins)
26-
flags.exists(_.value) || XshowPhases.isPresentIn(summon[SettingsState]) || allSettings.exists(isHelping)
26+
flags.exists(_.value) || Vphases.isPresentIn(ss) || allSettings.exists(isHelping)

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ private sealed trait VerboseSettings:
143143
self: SettingGroup =>
144144
val Vhelp: Setting[Boolean] = BooleanSetting(VerboseSetting, "V", "Print a synopsis of verbose options.")
145145
val Vprint: Setting[List[String]] = PhasesSetting(VerboseSetting, "Vprint", "Print out program after", default = "typer", aliases = List("-Xprint"))
146-
val XshowPhases: Setting[List[String]] = PhasesSetting(VerboseSetting, "Vphases", "List compiler phases.", default = "none", aliases = List("-Xshow-phases"))
146+
val Vphases: 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.")
149149
val VprofileSortedBy = ChoiceSetting(VerboseSetting, "Vprofile-sorted-by", "key", "Show metrics about sources and internal representations sorted by given column name", List("name", "path", "lines", "tokens", "tasty", "complexity"), "")

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ object Settings:
306306
def userValue(using Context): Option[T] = setting.userValueIn(ctx.settingsState)
307307
def update(x: T)(using Context): SettingsState = setting.updateIn(ctx.settingsState, x)
308308
def isDefault(using Context): Boolean = setting.isDefaultIn(ctx.settingsState)
309+
def isPresent(using Context): Boolean = setting.isPresentIn(ctx.settingsState)
309310

310311
/**
311312
* A choice with help description.

0 commit comments

Comments
 (0)