diff --git a/compiler/src/dotty/tools/dotc/config/CompilerCommand.scala b/compiler/src/dotty/tools/dotc/config/CompilerCommand.scala index 8dcb7c78401b..eb17fbe376cd 100644 --- a/compiler/src/dotty/tools/dotc/config/CompilerCommand.scala +++ b/compiler/src/dotty/tools/dotc/config/CompilerCommand.scala @@ -102,8 +102,8 @@ object CompilerCommand { } def isStandard(s: Setting[?]): Boolean = !isAdvanced(s) && !isPrivate(s) - def isAdvanced(s: Setting[?]): Boolean = s.name startsWith "-X" - def isPrivate(s: Setting[?]) : Boolean = s.name startsWith "-Y" + def isAdvanced(s: Setting[?]): Boolean = s.name.startsWith("-X") && s.name != "-X" + def isPrivate(s: Setting[?]) : Boolean = s.name.startsWith("-Y") && s.name != "-Y" /** Messages explaining usage and options */ def usageMessage = createUsageMsg("where possible standard", shouldExplain = false, isStandard) @@ -112,7 +112,14 @@ object CompilerCommand { def shouldStopWithInfo = { import settings._ - Set(help, Xhelp, Yhelp, showPlugins) exists (_.value) + Set(help, Xhelp, Yhelp, showPlugins, XshowPhases) exists (_.value) + } + + def phasesMessage: String = { + (new Compiler()).phases.map { + case List(single) => single.phaseName + case more => more.map(_.phaseName).mkString("{", ", ", "}") + }.mkString("\n") } def infoMessage: String = { @@ -121,6 +128,7 @@ object CompilerCommand { else if (Xhelp.value) xusageMessage else if (Yhelp.value) yusageMessage else if (showPlugins.value) ctx.pluginDescriptions + else if (XshowPhases.value) phasesMessage else "" } diff --git a/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala b/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala index c52f7a231896..8b053263ed00 100644 --- a/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala +++ b/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala @@ -76,9 +76,10 @@ class ScalaSettings extends Settings.SettingGroup { val XprintTypes: Setting[Boolean] = BooleanSetting("-Xprint-types", "Print tree types (debugging option).") val XprintDiff: Setting[Boolean] = BooleanSetting("-Xprint-diff", "Print changed parts of the tree since last print.") val XprintDiffDel: Setting[Boolean] = BooleanSetting("-Xprint-diff-del", "Print changed parts of the tree since last print including deleted parts.") - val XprintInline: Setting[Boolean] = BooleanSetting("-Xprint-inline", "Show where inlined code comes from") + val XprintInline: Setting[Boolean] = BooleanSetting("-Xprint-inline", "Show where inlined code comes from") val XprintSuspension: Setting[Boolean] = BooleanSetting("-Xprint-suspension", "Show when code is suspended until macros are compiled") val Xprompt: Setting[Boolean] = BooleanSetting("-Xprompt", "Display a prompt after each error (debugging option).") + val XshowPhases: Setting[Boolean] = BooleanSetting("-Xshow-phases", "Print all compiler phases") val XnoValueClasses: Setting[Boolean] = BooleanSetting("-Xno-value-classes", "Do not use value classes. Helps debugging.") val XreplLineWidth: Setting[Int] = IntSetting("-Xrepl-line-width", "Maximal number of columns per line for REPL output", 390) val XfatalWarnings: Setting[Boolean] = BooleanSetting("-Xfatal-warnings", "Fail the compilation if there are any warnings.")