Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 0 additions & 38 deletions compiler/src/dotty/tools/dotc/config/ScalaSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -492,9 +492,6 @@ 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", 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.")), ignoreInvalidArgs = true)

end XSettings

/** -Y "Forking" as in forked tongue or "Private" settings */
Expand Down Expand Up @@ -592,40 +589,5 @@ private sealed trait YSettings:
val Yinstrument: Setting[Boolean] = BooleanSetting(ForkSetting, "Yinstrument", "Add instrumentation code that counts allocations and closure creations.")
val YinstrumentDefs: Setting[Boolean] = BooleanSetting(ForkSetting, "Yinstrument-defs", "Add instrumentation code that counts method calls; needs -Yinstrument to be set, too.")
val YimplicitToGiven: Setting[Boolean] = BooleanSetting(ForkSetting, "Yimplicit-to-given", "Allows to rewrite the implicit keywords to their scala-3 given counterparts. Does not adjust imports. Use in conjunction with --rewrite.")

// Deprecated: lifted from -Y to -X
@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.", 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.", 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.", 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.", 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.", 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.", 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.", 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.", 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-enrich-error-messages"))
@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.", 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.", 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.", 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.", 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.", since = "3.5.0")
val YcheckInit: Setting[Boolean] = BooleanSetting(ForkSetting, "Ysafe-init", "Ensure safe initialization of objects.", deprecation = Deprecation.renamed("-Wsafe-init"))
end YSettings

2 changes: 0 additions & 2 deletions compiler/src/dotty/tools/dotc/config/Settings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,6 @@ object Settings:
if matches then
given ArgsSummary = state0
deprecation match
case Some(Deprecation(msg, _)) if ignoreInvalidArgs => // a special case for Xlint
state.warn(s"Option $name is deprecated: $msg", args)
case _ =>
prefix match
case Some(prefix) =>
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/plugins/Plugins.scala
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ trait Plugins {
}
val maybes = Plugin.loadAllFrom(paths, dirs, ctx.settings.disable.value)
val (goods, errors) = maybes partition (_.isSuccess)
// Explicit parameterization of recover to avoid -Xlint warning about inferred Any
// Explicit parameterization of recover to avoid -Wshadow warning about inferred Any
Copy link
Copy Markdown
Contributor

@som-snytt som-snytt May 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would that be -Winfer-union? I think that comment is from Scala 2. Probably warnings are not turned on anyway?

errors foreach (_.recover[Any] {
// legacy behavior ignores altogether, so at least warn devs
case e: MissingPluginException => report.warning(e.getMessage)
Expand Down
71 changes: 9 additions & 62 deletions compiler/test/dotty/tools/dotc/config/ScalaSettingsTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -97,23 +97,9 @@ class ScalaSettingsTests:
s"${oldSetting.name}$value" -> newSetting

val settings = ScalaSettings
List(
createTestCase(settings.YtermConflict , settings.XtermConflict, ":package"),
createTestCase(settings.YnoGenericSig , settings.XnoGenericSig),
createTestCase(settings.Ydumpclasses , settings.Xdumpclasses,":./"),
createTestCase(settings.YjarCompressionLevel , settings.XjarCompressionLevel,":0"),
createTestCase(settings.YkindProjector , settings.XkindProjector, ":underscores"),
createTestCase(settings.YdropComments , settings.XdropComments),
createTestCase(settings.YcookComments , settings.XcookComments),
createTestCase(settings.YreadComments , settings.XreadComments),
createTestCase(settings.YnoDecodeStacktraces , settings.XnoEnrichErrorMessages),
createTestCase(settings.YnoEnrichErrorMessages, settings.XnoEnrichErrorMessages),
createTestCase(settings.YdebugMacros , settings.XdebugMacros),
// createTestCase(settings.YjavaTasty , settings.XjavaTasty),
// createTestCase(settings.YearlyTastyOutput , settings.XearlyTastyOutput, ":./"),
// createTestCase(settings.YallowOutlineFromTasty, settings.XallowOutlineFromTasty),
createTestCase(settings.YcheckInit , settings.WsafeInit),
// createTestCase(settings.Xlint , settings.Wshadow, ":all"), // this setting is not going to be mapped to replacement. Read more in the commit message
List[(String, Setting[?])](
// Fill this with newly-deprecated options; as of 3.10 there are none, but here's an example:
//createTestCase(settings.YtermConflict , settings.XtermConflict, ":package"),
).map: (deprecatedArgument, newSetting) =>
val args = List(deprecatedArgument)
val argSummary = ArgsSummary(settings.defaultState, args, errors = Nil, warnings = Nil)
Expand All @@ -126,60 +112,21 @@ class ScalaSettingsTests:
s"${oldSetting.name}:$value" -> newSetting

val settings = ScalaSettings
List(
createTestCase(settings.YtermConflict , settings.XtermConflict),
createTestCase(settings.YnoGenericSig , settings.XnoGenericSig),
createTestCase(settings.Ydumpclasses , settings.Xdumpclasses, ""),
createTestCase(settings.YjarCompressionLevel , settings.XjarCompressionLevel),
createTestCase(settings.YkindProjector , settings.XkindProjector),
createTestCase(settings.YdropComments , settings.XdropComments),
createTestCase(settings.YcookComments , settings.XcookComments),
createTestCase(settings.YreadComments , settings.XreadComments),
createTestCase(settings.YnoDecodeStacktraces , settings.XnoEnrichErrorMessages),
createTestCase(settings.YnoEnrichErrorMessages, settings.XnoEnrichErrorMessages),
createTestCase(settings.YdebugMacros , settings.XdebugMacros),
// createTestCase(settings.YjavaTasty , settings.XjavaTasty),
// createTestCase(settings.YearlyTastyOutput , settings.XearlyTastyOutput),
// createTestCase(settings.YallowOutlineFromTasty, settings.XallowOutlineFromTasty),
createTestCase(settings.YcheckInit , settings.WsafeInit),
createTestCase(settings.Xlint , settings.Wshadow),
List[(String, Setting[?])](
// Fill this with newly-deprecated options; as of 3.10 there are none, but here's an example:
//createTestCase(settings.YtermConflict , settings.XtermConflict, ":package"),
).map: (deprecatedArgument, newSetting) =>
val args = List(deprecatedArgument)
val argSummary = ArgsSummary(settings.defaultState, args, errors = Nil, warnings = Nil)
val conf = settings.processArguments(argSummary, processAll = true, skipped = Nil)
assert(newSetting.isDefaultIn(conf.sstate), s"Setting $deprecatedArgument was forwarded to ${newSetting.name}, when it should be ignored because first option was erroreus")

// -Xlint was handled in a special way when it was added, making in hard to deprecate it.
// For now on we will retain old behavior, in next version we will emit deprecation warning.
// It is also scheduled for removal in future versions.
@Test def `Make Xlint to ignore invalid args`: Unit =
val settings = ScalaSettings
val args = List("-Xlint:-unused,_")
val argSummary = ArgsSummary(settings.defaultState, args, errors = Nil, warnings = Nil)
val conf = settings.processArguments(argSummary, processAll = true, skipped = Nil)
assert(conf.warnings.contains("Option -Xlint is deprecated: Use -Wshadow to enable shadowing lints. Scheduled for removal."))
assert(conf.errors.isEmpty)

@nowarn("cat=deprecation")
@Test def `Aliases of deprecated options are correctly mapped to their replacements`: Unit =
val settings = ScalaSettings
val tests = List(
settings.YtermConflict -> settings.XtermConflict :* "package",
settings.YnoGenericSig -> settings.XnoGenericSig,
settings.Ydumpclasses -> settings.Xdumpclasses :* "./",
settings.YjarCompressionLevel -> settings.XjarCompressionLevel :* "0",
settings.YkindProjector -> settings.XkindProjector :* "underscores",
settings.YdropComments -> settings.XdropComments,
settings.YcookComments -> settings.XcookComments,
settings.YreadComments -> settings.XreadComments,
settings.YnoDecodeStacktraces -> settings.XnoEnrichErrorMessages,
settings.YnoEnrichErrorMessages -> settings.XnoEnrichErrorMessages,
settings.YdebugMacros -> settings.XdebugMacros,
settings.YcheckInit -> settings.WsafeInit,
// createTestCase(settings.YjavaTasty , settings.XjavaTasty),
// createTestCase(settings.YearlyTastyOutput , settings.XearlyTastyOutput, ":./"),
// createTestCase(settings.YallowOutlineFromTasty, settings.XallowOutlineFromTasty),
// createTestCase(settings.Xlint , settings.Wshadow, ":all"), // this setting is not going to be mapped to replacement. Read more in the commit message
val tests = List[Setting[?] *: Setting[?] *: Tuple](
// Fill this with newly-deprecated options; as of 3.10 there are none, but here's an example:
//settings.YtermConflict -> settings.XtermConflict :* "package",
)
for
test <- tests
Expand Down
6 changes: 3 additions & 3 deletions docs/_docs/reference/changed-features/wildcards.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ A step-by-step migration is made possible with the following measures:
4. Some deprecation warnings are already available under the `-source future` setting.

To smooth the transition for codebases that use kind-projector, we adopt the following measures under the command line
option `-Ykind-projector`:
option `-Xkind-projector` (`-Ykind-projector` in older versions of the Scala 3 compiler):

1. In Scala 3.0, `*` is available as a type parameter placeholder.
2. In Scala 3.2, `*` is deprecated in favor of `_`. A `-rewrite` option is
available to rewrite one to the other.
3. In Scala 3.3, `*` is removed again, and all type parameter placeholders will be expressed with `_`.

These rules make it possible to cross-build between Scala 2 using the kind projector plugin and Scala 3.0 - 3.2 using the compiler option `-Ykind-projector`.
These rules make it possible to cross-build between Scala 2 using the kind projector plugin and Scala 3.0 - 3.2 using the compiler option `-Xkind-projector`.

There is also a migration path for users that want a one-time transition to syntax with `_` as a type parameter placeholder.
With option `-Ykind-projector:underscores` Scala 3 will regard `_` as a type parameter placeholder, leaving `?` as the only syntax for wildcards.
With option `-Xkind-projector:underscores` Scala 3 will regard `_` as a type parameter placeholder, leaving `?` as the only syntax for wildcards.

To cross-compile with old Scala 2 sources, while using `_` a placeholder, you must use options `-Xsource:3 -P:kind-projector:underscore-placeholders` together with a recent version of kind-projector (`0.13` and higher) and most recent versions of Scala 2 (`2.13.5` and higher and `2.12.14` and higher)
6 changes: 3 additions & 3 deletions docs/_spec/APPLIEDreference/changed-features/wildcards.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ A step-by-step migration is made possible with the following measures:
4. The Scala 3.1 behavior is already available today under the `-source future` setting.

To smooth the transition for codebases that use kind-projector, we adopt the following measures under the command line
option `-Ykind-projector`:
option `-Xkind-projector` (`-Ykind-projector` in older versions of the Scala 3 compiler):

1. In Scala 3.0, `*` is available as a type parameter placeholder.
2. In Scala 3.2, `*` is deprecated in favor of `_`. A `-rewrite` option is
available to rewrite one to the other.
3. In Scala 3.3, `*` is removed again, and all type parameter placeholders will be expressed with `_`.

These rules make it possible to cross build between Scala 2 using the kind projector plugin and Scala 3.0 - 3.2 using the compiler option `-Ykind-projector`.
These rules make it possible to cross build between Scala 2 using the kind projector plugin and Scala 3.0 - 3.2 using the compiler option `-Xkind-projector`.

There is also a migration path for users that want a one-time transition to syntax with `_` as a type parameter placeholder.
With option `-Ykind-projector:underscores` Scala 3 will regard `_` as a type parameter placeholder, leaving `?` as the only syntax for wildcards.
With option `-Xkind-projector:underscores` Scala 3 will regard `_` as a type parameter placeholder, leaving `?` as the only syntax for wildcards.

To cross-compile with old Scala 2 sources, while using `_` a placeholder, you must use options `-Xsource:3 -P:kind-projector:underscore-placeholders` together with a recent version of kind-projector (`0.13` and higher) and most recent versions of Scala 2 (`2.13.5` and higher and `2.12.14` and higher)
2 changes: 1 addition & 1 deletion docs/_spec/TODOreference/experimental/explicit-nulls.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ val c = new C()
// c.f == "field is null"
```

The unsoundness above can be caught by the compiler with the option `-Ysafe-init`.
The unsoundness above can be caught by the compiler with the option `-Wsafe-init`.
More details can be found in [safe initialization](../other-new-features/safe-initialization.md).

## Equality
Expand Down
2 changes: 1 addition & 1 deletion library/src/scala/annotation/nowarn.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import scala.language.`2.13`
* def f = { 1; deprecated() } // show deprecation warning
* ```
*
* To ensure that a `@nowarn` annotation actually suppresses a warning, enable `-Xlint:unused` or `-Wunused:nowarn`.
* To ensure that a `@nowarn` annotation actually suppresses a warning, enable `-Wunused:nowarn`.
* The unused annotation warning is emitted in category `unused-nowarn` and can be selectively managed
* using `-Wconf:cat=unused-nowarn:s`.
*/
Expand Down
2 changes: 0 additions & 2 deletions library/src/scala/deprecatedName.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import scala.annotation.meta._
* Using this name in a named argument generates a deprecation warning.
*
* If the `name` is omitted, then using the canonical name is deprecated.
* In that case, lints such as `-Xlint:named-booleans` which encourage
* the use of a name will not warn.
*
* Library authors should state the library's deprecation policy in their documentation to give
* developers guidance on how long a deprecated name will be preserved.
Expand Down
2 changes: 1 addition & 1 deletion tests/disabled/macro/pos/t8013/inpervolated_2.scala
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//> using options -Werror -Xlint
//> using options -Werror -Wshadow
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The inpervolator was my favorite interpolator, but unfortunately it is Scala 2-only.

package t8013

// unsuspecting user of perverse macro
Expand Down
2 changes: 1 addition & 1 deletion tests/disabled/macro/pos/t8013/inpervolator_1.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

package t8013

// perverse macro to confuse Xlint
// perverse macro to confuse Wshadow

import scala.language.experimental.macros
import scala.reflect.macros.blackbox.Context
Expand Down
2 changes: 1 addition & 1 deletion tests/disabled/partest/run/t7711-script-args.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
import scala.tools.partest.ScriptTest

object Test extends ScriptTest {
override def extraSettings = s"${super.extraSettings} -Xlint"
override def extraSettings = s"${super.extraSettings} -Wshadow"
override def argv = Seq("good", "news")
}
2 changes: 1 addition & 1 deletion tests/pos/pos_valueclasses/xlint1.flags
Original file line number Diff line number Diff line change
@@ -1 +1 @@
-Xlint -Xfatal-warnings
-Wshadow -Xfatal-warnings
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't look at whether or how flags files are used in this context.

Loading
Loading