Skip to content

Commit

Permalink
Updates to submodules, remove unnecessary changes, revert Xlint changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rochala committed May 7, 2024
1 parent 7f21b82 commit 82b7acd
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 51 deletions.
2 changes: 1 addition & 1 deletion community-build/community-projects/discipline
Submodule discipline updated 1 files
+1 −2 build.sbt
2 changes: 1 addition & 1 deletion community-build/community-projects/discipline-munit
Submodule discipline-munit updated 1 files
+2 −0 build.sbt
2 changes: 1 addition & 1 deletion community-build/community-projects/discipline-specs2
Submodule discipline-specs2 updated 1 files
+2 −0 build.sbt
2 changes: 1 addition & 1 deletion community-build/community-projects/fs2
Submodule fs2 updated 1 files
+2 −0 build.sbt
2 changes: 1 addition & 1 deletion community-build/community-projects/scodec
Submodule scodec updated 1 files
+5 −1 build.sbt
2 changes: 1 addition & 1 deletion community-build/community-projects/verify
Submodule verify updated 1 files
+3 −5 build.sbt
16 changes: 8 additions & 8 deletions community-build/src/scala/dotty/communitybuild/projects.scala
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ object projects:
project = "shapeless-3",
sbtTestCommand = "testJVM; testJS",
sbtDocCommand = forceDoc("typeable", "deriving"),
scalacOptions = "-source" :: "3.3" :: SbtCommunityProject.scalacOptions.filter(flag => flag != "-Ysafe-init" && flag != "-Wsafe-init"), // due to -Xfatal-warnings
scalacOptions = "-source" :: "3.3" :: SbtCommunityProject.scalacOptions.filter(_ != "-Wsafe-init"), // due to -Xfatal-warnings
)

lazy val xmlInterpolator = SbtCommunityProject(
Expand Down Expand Up @@ -429,7 +429,7 @@ object projects:
sbtTestCommand = "unitTests/test",
// Adds <empty> package
sbtDocCommand = "coreJVM/doc",
scalacOptions = SbtCommunityProject.scalacOptions.filter(flag => flag != "-Ysafe-init" && flag != "-Wsafe-init"),
scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Wsafe-init"),
dependencies = List(munit, scodecBits),
)

Expand Down Expand Up @@ -503,14 +503,14 @@ object projects:
project = "verify",
sbtTestCommand = "verifyJVM/test",
sbtDocCommand = "verifyJVM/doc",
scalacOptions = SbtCommunityProject.scalacOptions.filter(flag => flag != "-Xcheck-macros") // TODO enable -Xcheck-macros
scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Xcheck-macros") // TODO enable -Xcheck-macros
)

lazy val discipline = SbtCommunityProject(
project = "discipline",
sbtTestCommand = "coreJVM/test;coreJS/test",
sbtPublishCommand = "set every credentials := Nil;coreJVM/publishLocal;coreJS/publishLocal",
scalacOptions = SbtCommunityProject.scalacOptions.filter(flag => flag != "-Ysafe-init" && flag != "-Wsafe-init"),
scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Wsafe-init"),
dependencies = List(scalacheck)
)

Expand Down Expand Up @@ -540,7 +540,7 @@ object projects:
sbtTestCommand = "set Global/scalaJSStage := FastOptStage;rootJVM/test;rootJS/test",
sbtPublishCommand = "rootJVM/publishLocal;rootJS/publishLocal",
dependencies = List(discipline, disciplineMunit, scalacheck, simulacrumScalafixAnnotations),
scalacOptions = SbtCommunityProject.scalacOptions.filter(flag => flag != "-Ysafe-init" && flag != "-Wsafe-init") // disable -Ysafe-init or -Wsafe-init, due to -Xfatal-warning
scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Wsafe-init") // disable -Ysafe-init or -Wsafe-init, due to -Xfatal-warning
)

lazy val catsMtl = SbtCommunityProject(
Expand Down Expand Up @@ -655,7 +655,7 @@ object projects:
"""set actorTests/Compile/scalacOptions -= "-Xfatal-warnings"""",
"akka-actor-tests/Test/compile",
).mkString("; "),
scalacOptions = SbtCommunityProject.scalacOptions.filter(flag => flag != "-Ysafe-init" && flag != "-Wsafe-init"),
scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Wsafe-init"),
dependencies = List(scalatest, scalatestplusJunit, scalatestplusScalacheck)
)

Expand Down Expand Up @@ -706,7 +706,7 @@ object projects:
project = "fs2",
sbtTestCommand = "coreJVM/test; coreJS/test", // io/test requires JDK9+
sbtPublishCommand = "coreJVM/publishLocal; coreJS/publishLocal",
scalacOptions = SbtCommunityProject.scalacOptions.filter(flag => flag != "-Ysafe-init" && flag != "-Wsafe-init"),
scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Wsafe-init"),
dependencies = List(cats, catsEffect3, munitCatsEffect, scalacheckEffect, scodecBits)
)

Expand Down Expand Up @@ -743,7 +743,7 @@ object projects:
project = "http4s",
sbtTestCommand = """set ThisBuild / tlFatalWarnings := false; rootJVM/test""",
sbtPublishCommand = "publishLocal",
scalacOptions = SbtCommunityProject.scalacOptions.filter(flag => flag != "-Ysafe-init" && flag != "-Wsafe-init"),
scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Wsafe-init"),
dependencies = List(cats, catsEffect3, fs2, disciplineMunit, scalacheckEffect)
)

Expand Down
50 changes: 19 additions & 31 deletions compiler/src/dotty/tools/dotc/config/ScalaSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -359,20 +359,8 @@ private sealed trait XSettings:

val XmacroSettings: Setting[List[String]] = MultiStringSetting(AdvancedSetting, "Xmacro-settings", "setting1,setting2,..settingN", "List of settings which exposed to the macros")

@deprecated(message = "Superseded by -Wshadow, Scheduled for removal in 3.6.0", since = "3.5.0")
val Xlint: Setting[List[ChoiceWithHelp[String]]] = MultiChoiceHelpSetting(
AdvancedSetting,
name = "Xlint",
helpArg = "advanced warning",
descr = "Enable or disable specific `lint` warnings",
choices = List(
ChoiceWithHelp("all", ""),
ChoiceWithHelp("private-shadow", "Warn if a private field or class parameter shadows a superclass field"),
ChoiceWithHelp("type-parameter-shadow", "Warn when a type parameter shadows a type already in the scope"),
),
default = Nil,
deprecation = Deprecation.renamed("-Wshadow"),
)
@deprecated(message = "Superseded by -Wshadow, Scheduled for removal", since = "3.5.0")
val Xlint: Setting[_] = BooleanSetting(AdvancedSetting, "Xlint", "Enable or disable specific warnings", deprecation = Some(Deprecation("Use -Wshadow to enable shadowing lints. Scheduled for removal.")))

end XSettings

Expand Down Expand Up @@ -466,41 +454,41 @@ private sealed trait YSettings:
val YinstrumentDefs: Setting[Boolean] = BooleanSetting(ForkSetting, "Yinstrument-defs", "Add instrumentation code that counts method calls; needs -Yinstrument to be set, too.")

// Deprecated: lifted from -Y to -X
@deprecated(message = "Lifted to -X, Scheduled for removal in 3.6.0", since = "3.5.0")
@deprecated(message = "Lifted to -X, Scheduled for removal.", since = "3.5.0")
val YtermConflict: Setting[String] = ChoiceSetting(ForkSetting, "Yresolve-term-conflict", "strategy", "Resolve term conflicts", List("package", "object", "error"), "error", deprecation = Deprecation.renamed("-Xresolve-term-conflict"))
@deprecated(message = "Lifted to -X, Scheduled for removal in 3.6.0", since = "3.5.0")
@deprecated(message = "Lifted to -X, Scheduled for removal.", since = "3.5.0")
val YnoGenericSig: Setting[Boolean] = BooleanSetting(ForkSetting, "Yno-generic-signatures", "Suppress generation of generic signatures for Java.", deprecation = Deprecation.renamed("-Xno-generic-signatures"))
@deprecated(message = "Lifted to -X, Scheduled for removal in 3.6.0", since = "3.5.0")
@deprecated(message = "Lifted to -X, Scheduled for removal.", since = "3.5.0")
val Ydumpclasses: Setting[String] = StringSetting(ForkSetting, "Ydump-classes", "dir", "Dump the generated bytecode to .class files (useful for reflective compilation that utilizes in-memory classloaders).", default = "", deprecation = Deprecation.renamed("-Xdump-classes"))
@deprecated(message = "Lifted to -X, Scheduled for removal in 3.6.0", since = "3.5.0")
@deprecated(message = "Lifted to -X, Scheduled for removal.", since = "3.5.0")
val YjarCompressionLevel: Setting[Int] = IntChoiceSetting(ForkSetting, "Yjar-compression-level", "compression level to use when writing jar files", Deflater.DEFAULT_COMPRESSION to Deflater.BEST_COMPRESSION, Deflater.DEFAULT_COMPRESSION, deprecation = Deprecation.renamed("-Xjar-compression-level"))
@deprecated(message = "Lifted to -X, Scheduled for removal in 3.6.0", since = "3.5.0")
@deprecated(message = "Lifted to -X, Scheduled for removal.", since = "3.5.0")
val YkindProjector: Setting[String] = ChoiceSetting(ForkSetting, "Ykind-projector", "[underscores, enable, disable]", "Allow `*` as type lambda placeholder to be compatible with kind projector. When invoked as -Ykind-projector:underscores will repurpose `_` to be a type parameter placeholder, this will disable usage of underscore as a wildcard.", List("disable", "", "underscores"), "disable", legacyArgs = true, deprecation = Deprecation.renamed("-Xkind-projector"))
@deprecated(message = "Lifted to -X, Scheduled for removal in 3.6.0", since = "3.5.0")
@deprecated(message = "Lifted to -X, Scheduled for removal.", since = "3.5.0")
val YdropComments: Setting[Boolean] = BooleanSetting(ForkSetting, "Ydrop-docs", "Drop documentation when scanning source files.", aliases = List("-Ydrop-comments"), deprecation = Deprecation.renamed("-Xdrop-docs"))
@deprecated(message = "Lifted to -X, Scheduled for removal in 3.6.0", since = "3.5.0")
@deprecated(message = "Lifted to -X, Scheduled for removal.", since = "3.5.0")
val YcookComments: Setting[Boolean] = BooleanSetting(ForkSetting, "Ycook-docs", "Cook the documentation (type check `@usecase`, etc.)", aliases = List("-Ycook-comments"), deprecation = Deprecation.renamed("-Xcook-docs"))
@deprecated(message = "Lifted to -X, Scheduled for removal in 3.6.0", since = "3.5.0")
@deprecated(message = "Lifted to -X, Scheduled for removal.", since = "3.5.0")
val YreadComments: Setting[Boolean] = BooleanSetting(ForkSetting, "Yread-docs", "Read documentation from tasty.", deprecation = Deprecation.renamed("-Xread-docs"))
@deprecated(message = "Lifted to -X, Scheduled for removal in 3.6.0", since = "3.5.0")
@deprecated(message = "Lifted to -X, Scheduled for removal.", since = "3.5.0")
val YnoDecodeStacktraces: Setting[Boolean] = BooleanSetting(ForkSetting, "Yno-decode-stacktraces", "Show raw StackOverflow stacktraces, instead of decoding them into triggering operations.", deprecation = Deprecation.renamed("-Xno-decode-stacktraces"))
@deprecated(message = "Lifted to -X, Scheduled for removal in 3.6.0", since = "3.5.0")
@deprecated(message = "Lifted to -X, Scheduled for removal.", since = "3.5.0")
val YnoEnrichErrorMessages: Setting[Boolean] = BooleanSetting(ForkSetting, "Yno-enrich-error-messages", "Show raw error messages, instead of enriching them with contextual information.", deprecation = Deprecation.renamed("-Xno-enrich-error-messages"))
@deprecated(message = "Lifted to -X, Scheduled for removal in 3.6.0", since = "3.5.0")
@deprecated(message = "Lifted to -X, Scheduled for removal.", since = "3.5.0")
val YdebugMacros: Setting[Boolean] = BooleanSetting(ForkSetting, "Ydebug-macros", "Show debug info when quote pattern match fails", deprecation = Deprecation.renamed("-Xdebug-macros"))

// @deprecated(message = "Lifted to -X, Scheduled for removal in 3.8.0", since = "3.7.0")
// @deprecated(message = "Lifted to -X, Scheduled for removal.", since = "3.7.0")
// val YjavaTasty: Setting[Boolean] = BooleanSetting(ForkSetting, "Yjava-tasty", "Pickler phase should compute TASTy for .java defined symbols for use by build tools", aliases = List("-Ypickle-java"), preferPrevious = true, deprecation = Deprecation.lifted("-Xjava-tasty"))
// @deprecated(message = "Lifted to -X, Scheduled for removal in 3.8.0", since = "3.7.0")
// @deprecated(message = "Lifted to -X, Scheduled for removal.", since = "3.7.0")
// val YearlyTastyOutput: Setting[AbstractFile] = OutputSetting(ForkSetting, "Yearly-tasty-output", "directory|jar", "Destination to write generated .tasty files to for use in pipelined compilation.", NoAbstractFile, aliases = List("-Ypickle-write"), preferPrevious = true, deprecation = Deprecation.lifted("-Xearly-tasty-output"))
// @deprecated(message = "Lifted to -X, Scheduled for removal in 3.8.0", since = "3.7.0")
// @deprecated(message = "Lifted to -X, Scheduled for removal.", since = "3.7.0")
// val YallowOutlineFromTasty: Setting[Boolean] = BooleanSetting(ForkSetting, "Yallow-outline-from-tasty", "Allow outline TASTy to be loaded with the -from-tasty option.", deprecation = Deprecation.lifted("-Xallow-outline-from-tasty"))

// Deprecated: lifted from -Y to -W
@deprecated(message = "Lifted to -W, Scheduled for removal in 3.6.0", since = "3.5.0")
@deprecated(message = "Lifted to -W, Scheduled for removal.", since = "3.5.0")
val YcheckInit: Setting[Boolean] = BooleanSetting(ForkSetting, "Ysafe-init", "Ensure safe initialization of objects.", deprecation = Deprecation.renamed("-Wsafe-init"))

// Deprecated: Scheduled for removal
@deprecated(message = "Scheduled for removal in 3.6.0", since = "3.5.0")
val YoutputOnlyTasty: Setting[Boolean] = BooleanSetting(ForkSetting, "Youtput-only-tasty", "Used to only generate the TASTy file without the classfiles", deprecation = Deprecation.removed("3.6.0"))
@deprecated(message = "Scheduled for removal.", since = "3.5.0")
val YoutputOnlyTasty: Setting[Boolean] = BooleanSetting(ForkSetting, "Youtput-only-tasty", "Used to only generate the TASTy file without the classfiles", deprecation = Deprecation.removed())
end YSettings
10 changes: 7 additions & 3 deletions compiler/src/dotty/tools/dotc/config/Settings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ object Settings:
if argStringValue.isEmpty then state.deprecated(deprecatedMsg, List(replacedBy))
else state.deprecated(deprecatedMsg, List(s"$replacedBy:$argStringValue"))

case Some(Deprecation(msg, _)) => state.deprecated(msg)
case Some(Deprecation(msg, _)) =>
state.deprecated(s"Option $name is deprecated: $msg")

case None =>
val value = getValue
var dangers = warnings
Expand Down Expand Up @@ -263,14 +265,16 @@ object Settings:
* @param msg deprecation message that will be displayed in following format: s"Option $name is deprecated: $msg"
* @param replacedBy option that is substituting current option
*/
case class Deprecation private(
case class Deprecation(
msg: String,
replacedBy: Option[String] = None,
)

object Deprecation:
def renamed(replacement: String) = Some(Deprecation(s"Use $replacement instead.", Some(replacement)))
def removed(removedVersion: String) = Some(Deprecation(s"Scheduled for removal in s$removedVersion", None))
def removed(removedVersion: Option[String] = None) =
val msg = removedVersion.map(" in " + _).getOrElse(".")
Some(Deprecation(s"Scheduled for removal$msg", None))

object Setting:
extension [T](setting: Setting[T])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class ScalaSettingsTests:
// createTestCase(settings.YearlyTastyOutput , settings.XearlyTastyOutput, ":./"),
// createTestCase(settings.YallowOutlineFromTasty, settings.XallowOutlineFromTasty),
createTestCase(settings.YcheckInit , settings.WcheckInit),
createTestCase(settings.Xlint , settings.Wshadow, ":all"),
// createTestCase(settings.Xlint , settings.Wshadow, ":all"), // this setting is not going to be mapped to replacement. Read more in the commit message
).map: (deprecatedArgument, newSetting) =>
val args = List(deprecatedArgument)
val argSummary = ArgsSummary(settings.defaultState, args, errors = Nil, warnings = Nil)
Expand Down Expand Up @@ -171,7 +171,7 @@ class ScalaSettingsTests:
// createTestCase(settings.YearlyTastyOutput , settings.XearlyTastyOutput, ":./"),
// createTestCase(settings.YallowOutlineFromTasty, settings.XallowOutlineFromTasty),
createTestCase(settings.YcheckInit , settings.WcheckInit),
createTestCase(settings.Xlint , settings.Wshadow, ":all"),
// createTestCase(settings.Xlint , settings.Wshadow, ":all"), // this setting is not going to be mapped to replacement. Read more in the commit message
).flatten.map: (deprecatedArgument, newSetting) =>
val args = List(deprecatedArgument)
val argSummary = ArgsSummary(settings.defaultState, args, errors = Nil, warnings = Nil)
Expand Down

0 comments on commit 82b7acd

Please sign in to comment.