Skip to content

Commit 8eaea49

Browse files
committed
Phase name match is partial
1 parent 2a8e31e commit 8eaea49

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
@@ -348,7 +348,7 @@ extends ImplicitRunInfo, ConstraintRunInfo, cc.CaptureRunInfo {
348348
val phasesSettings = List("-Vphases", "-Vprint")
349349
for phasesSetting <- ctx.settings.allSettings if phasesSettings.contains(phasesSetting.name) do
350350
for case vs: List[String] <- phasesSetting.userValue; p <- vs do
351-
if !phases.exists(_.phaseName == p) then report.warning(s"'$p' specifies no phase")
351+
if !phases.exists(List(p).containsPhase) then report.warning(s"'$p' specifies no phase")
352352

353353
if ctx.settings.YnoDoubleBindings.value then
354354
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
@@ -163,7 +163,7 @@ trait CliCommand:
163163
val maxCol = ctx.settings.pageWidth.value
164164
val field1 = maxField.min(texts.flatten.map(_._1.length).filter(_ < maxField).max) // widest field under maxField
165165
val field2 = if field1 + separation + maxField < maxCol then maxCol - field1 - separation else 0 // skinny window -> terminal wrap
166-
val toMark = ctx.settings.XshowPhases.value.toSet
166+
def toMark(name: String) = ctx.settings.Vphases.value.exists(s => name.toLowerCase.contains(s.toLowerCase))
167167
def separator(name: String) = if toMark(name) then "->" + " " * (separation - 2) else " " * separation
168168
val EOL = "\n"
169169
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
@@ -18,10 +18,10 @@ abstract class CompilerCommand extends CliCommand:
1818
else if (settings.Xhelp.value) xusageMessage
1919
else if (settings.Yhelp.value) yusageMessage
2020
else if (settings.showPlugins.value) ctx.base.pluginDescriptions
21-
else if settings.XshowPhases.isPresentIn(summon[SettingsState]) then phasesMessage
21+
else if settings.Vphases.isPresent then phasesMessage
2222
else ""
2323

24-
final def isHelpFlag(using settings: ConcreteSettings)(using SettingsState): Boolean =
24+
final def isHelpFlag(using settings: ConcreteSettings)(using ss: SettingsState): Boolean =
2525
import settings.*
2626
val flags = Set(help, Vhelp, Whelp, Xhelp, Yhelp, showPlugins)
27-
flags.exists(_.value) || XshowPhases.isPresentIn(summon[SettingsState]) || allSettings.exists(isHelping)
27+
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
@@ -145,7 +145,7 @@ private sealed trait VerboseSettings:
145145
self: SettingGroup =>
146146
val Vhelp: Setting[Boolean] = BooleanSetting(VerboseSetting, "V", "Print a synopsis of verbose options.")
147147
val Vprint: Setting[List[String]] = PhasesSetting(VerboseSetting, "Vprint", "Print out program after", default = "typer", aliases = List("-Xprint"))
148-
val XshowPhases: Setting[List[String]] = PhasesSetting(VerboseSetting, "Vphases", "List compiler phases.", default = "none", aliases = List("-Xshow-phases"))
148+
val Vphases: Setting[List[String]] = PhasesSetting(VerboseSetting, "Vphases", "List compiler phases.", default = "none", aliases = List("-Xshow-phases"))
149149
val Vprofile: Setting[Boolean] = BooleanSetting(VerboseSetting, "Vprofile", "Show metrics about sources and internal representations to estimate compile-time complexity.")
150150
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"), "")
151151
val VprofileDetails = IntSetting(VerboseSetting, "Vprofile-details", "Show metrics about sources and internal representations of the most complex methods", 0)

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ object Settings:
320320
def userValue(using Context): Option[T] = setting.userValueIn(ctx.settingsState)
321321
def update(x: T)(using Context): SettingsState = setting.updateIn(ctx.settingsState, x)
322322
def isDefault(using Context): Boolean = setting.isDefaultIn(ctx.settingsState)
323+
def isPresent(using Context): Boolean = setting.isPresentIn(ctx.settingsState)
323324

324325
/**
325326
* A choice with help description.

0 commit comments

Comments
 (0)