Skip to content

Commit 0470ec1

Browse files
authored
Indicate deprecated option aliases (#24359)
Fixes #24333 Option aliases are `SettingAlias` which may have a `Deprecation` with an optional message.
1 parent bc5f15e commit 0470ec1

File tree

149 files changed

+369
-257
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+369
-257
lines changed

community-build/src/scala/dotty/communitybuild/projects.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ object projects:
315315
project = "shapeless-3",
316316
sbtTestCommand = "testJVM; testJS",
317317
sbtDocCommand = forceDoc("typeable", "deriving"),
318-
scalacOptions = "-source" :: "3.3" :: SbtCommunityProject.scalacOptions.filter(_ != "-Wsafe-init"), // due to -Xfatal-warnings
318+
scalacOptions = "-source" :: "3.3" :: SbtCommunityProject.scalacOptions.filter(_ != "-Wsafe-init"), // due to -Werror
319319
)
320320

321321
lazy val xmlInterpolator = SbtCommunityProject(
@@ -484,7 +484,7 @@ object projects:
484484
project = "cats",
485485
sbtTestCommand = "set Global/scalaJSStage := FastOptStage;rootJVM/test;rootJS/test",
486486
sbtPublishCommand = "rootJVM/publishLocal;rootJS/publishLocal",
487-
scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Wsafe-init") // disable -Ysafe-init or -Wsafe-init, due to -Xfatal-warning
487+
scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Wsafe-init") // turn off -Wsafe-init due to -Werror
488488
)
489489

490490
lazy val catsMtl = SbtCommunityProject(
@@ -583,10 +583,10 @@ object projects:
583583
extraSbtArgs = List(s"-Dakka.build.scalaVersion=$compilerVersion"),
584584
sbtTestCommand = List(
585585
"set every targetSystemJdk := true",
586-
// selectively disable -Xfatal-warnings due to deprecations
587-
"""set actor/Compile/scalacOptions -= "-Xfatal-warnings"""",
588-
"""set testkit/Compile/scalacOptions -= "-Xfatal-warnings"""",
589-
"""set actorTests/Compile/scalacOptions -= "-Xfatal-warnings"""",
586+
// selectively turn off -Werror due to deprecations
587+
"""set actor/Compile/scalacOptions += "-Werror:false"""",
588+
"""set testkit/Compile/scalacOptions += "-Werror:false"""",
589+
"""set actorTests/Compile/scalacOptions += "-Werror:false"""",
590590
"akka-actor-tests/Test/compile",
591591
).mkString("; "),
592592
scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Wsafe-init"),

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package dotty.tools.dotc
22
package config
33

44
import dotty.tools.dotc.config.PathResolver.Defaults
5-
import dotty.tools.dotc.config.Settings.{Setting, SettingGroup, SettingCategory, Deprecation}
5+
import dotty.tools.dotc.config.Settings.{Setting, SettingAlias, SettingGroup, SettingCategory, Deprecation}
66
import dotty.tools.dotc.config.SourceVersion
77
import dotty.tools.dotc.core.Contexts.*
88
import dotty.tools.dotc.rewrites.Rewrites
@@ -40,7 +40,7 @@ abstract class ScalaSettings extends SettingGroup, AllScalaSettings:
4040
val forkSettings: List[Setting[?]] = settingsByCategory(ForkSetting).sortBy(_.name)
4141
val advancedSettings: List[Setting[?]] = settingsByCategory(AdvancedSetting).sortBy(_.name)
4242
val verboseSettings: List[Setting[?]] = settingsByCategory(VerboseSetting).sortBy(_.name)
43-
val settingsByAliases: Map[String, Setting[?]] = allSettings.flatMap(s => s.aliases.map(_ -> s)).toMap
43+
val settingsByAliases: Map[String, Setting[?]] = allSettings.flatMap(s => s.aliases.map(_.name -> s)).toMap
4444

4545

4646
trait AllScalaSettings extends CommonScalaSettings, PluginSettings, VerboseSettings, WarningSettings, XSettings, YSettings:
@@ -146,8 +146,8 @@ private sealed trait PluginSettings:
146146
private sealed trait VerboseSettings:
147147
self: SettingGroup =>
148148
val Vhelp: Setting[Boolean] = BooleanSetting(VerboseSetting, "V", "Print a synopsis of verbose options.")
149-
val Vprint: Setting[List[String]] = PhasesSetting(VerboseSetting, "Vprint", "Print out program after", aliases = List("-Xprint"))
150-
val XshowPhases: Setting[Boolean] = BooleanSetting(VerboseSetting, "Vphases", "List compiler phases.", aliases = List("-Xshow-phases"))
149+
val Vprint: Setting[List[String]] = PhasesSetting(VerboseSetting, "Vprint", "Print out program after", aliases = SettingAlias("-Xprint", Deprecation()) :: Nil)
150+
val XshowPhases: Setting[Boolean] = BooleanSetting(VerboseSetting, "Vphases", "List compiler phases.", aliases = SettingAlias("-Xshow-phases", Deprecation()) :: Nil)
151151

152152
val Vprofile: Setting[Boolean] = BooleanSetting(VerboseSetting, "Vprofile", "Show metrics about sources and internal representations to estimate compile-time complexity.")
153153
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"), "")
@@ -161,7 +161,7 @@ private sealed trait WarningSettings:
161161
self: SettingGroup =>
162162

163163
val Whelp: Setting[Boolean] = BooleanSetting(WarningSetting, "W", "Print a synopsis of warning options.")
164-
val Werror: Setting[Boolean] = BooleanSetting(WarningSetting, "Werror", "Fail the compilation if there are any warnings.", aliases = List("-Xfatal-warnings"))
164+
val Werror: Setting[Boolean] = BooleanSetting(WarningSetting, "Werror", "Fail the compilation if there are any warnings.", aliases = SettingAlias("-Xfatal-warnings", Deprecation()) :: Nil)
165165
val Wall: Setting[Boolean] = BooleanSetting(WarningSetting, "Wall", "Enable all warning settings.")
166166
private val WvalueDiscard: Setting[Boolean] = BooleanSetting(WarningSetting, "Wvalue-discard", "Warn when non-Unit expression results are unused.")
167167
private val WNonUnitStatement = BooleanSetting(WarningSetting, "Wnonunit-statement", "Warn when block statements are non-Unit expressions.")

0 commit comments

Comments
 (0)