diff --git a/community-build/src/scala/dotty/communitybuild/projects.scala b/community-build/src/scala/dotty/communitybuild/projects.scala index a5c482a9a339..0689b44c1012 100644 --- a/community-build/src/scala/dotty/communitybuild/projects.scala +++ b/community-build/src/scala/dotty/communitybuild/projects.scala @@ -315,7 +315,7 @@ object projects: project = "shapeless-3", sbtTestCommand = "testJVM; testJS", sbtDocCommand = forceDoc("typeable", "deriving"), - scalacOptions = "-source" :: "3.3" :: SbtCommunityProject.scalacOptions.filter(_ != "-Wsafe-init"), // due to -Xfatal-warnings + scalacOptions = "-source" :: "3.3" :: SbtCommunityProject.scalacOptions.filter(_ != "-Wsafe-init"), // due to -Werror ) lazy val xmlInterpolator = SbtCommunityProject( @@ -484,7 +484,7 @@ object projects: project = "cats", sbtTestCommand = "set Global/scalaJSStage := FastOptStage;rootJVM/test;rootJS/test", sbtPublishCommand = "rootJVM/publishLocal;rootJS/publishLocal", - scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Wsafe-init") // disable -Ysafe-init or -Wsafe-init, due to -Xfatal-warning + scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Wsafe-init") // turn off -Wsafe-init due to -Werror ) lazy val catsMtl = SbtCommunityProject( @@ -583,10 +583,10 @@ object projects: extraSbtArgs = List(s"-Dakka.build.scalaVersion=$compilerVersion"), sbtTestCommand = List( "set every targetSystemJdk := true", - // selectively disable -Xfatal-warnings due to deprecations - """set actor/Compile/scalacOptions -= "-Xfatal-warnings"""", - """set testkit/Compile/scalacOptions -= "-Xfatal-warnings"""", - """set actorTests/Compile/scalacOptions -= "-Xfatal-warnings"""", + // selectively turn off -Werror due to deprecations + """set actor/Compile/scalacOptions += "-Werror:false"""", + """set testkit/Compile/scalacOptions += "-Werror:false"""", + """set actorTests/Compile/scalacOptions += "-Werror:false"""", "akka-actor-tests/Test/compile", ).mkString("; "), scalacOptions = SbtCommunityProject.scalacOptions.filter(_ != "-Wsafe-init"), diff --git a/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala b/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala index 2a5db6eebf9a..9dfad99ab4b1 100644 --- a/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala +++ b/compiler/src/dotty/tools/dotc/config/ScalaSettings.scala @@ -2,7 +2,7 @@ package dotty.tools.dotc package config import dotty.tools.dotc.config.PathResolver.Defaults -import dotty.tools.dotc.config.Settings.{Setting, SettingGroup, SettingCategory, Deprecation} +import dotty.tools.dotc.config.Settings.{Setting, SettingAlias, SettingGroup, SettingCategory, Deprecation} import dotty.tools.dotc.config.SourceVersion import dotty.tools.dotc.core.Contexts.* import dotty.tools.dotc.rewrites.Rewrites @@ -40,7 +40,7 @@ abstract class ScalaSettings extends SettingGroup, AllScalaSettings: val forkSettings: List[Setting[?]] = settingsByCategory(ForkSetting).sortBy(_.name) val advancedSettings: List[Setting[?]] = settingsByCategory(AdvancedSetting).sortBy(_.name) val verboseSettings: List[Setting[?]] = settingsByCategory(VerboseSetting).sortBy(_.name) - val settingsByAliases: Map[String, Setting[?]] = allSettings.flatMap(s => s.aliases.map(_ -> s)).toMap + val settingsByAliases: Map[String, Setting[?]] = allSettings.flatMap(s => s.aliases.map(_.name -> s)).toMap trait AllScalaSettings extends CommonScalaSettings, PluginSettings, VerboseSettings, WarningSettings, XSettings, YSettings: @@ -146,8 +146,8 @@ private sealed trait PluginSettings: private sealed trait VerboseSettings: self: SettingGroup => val Vhelp: Setting[Boolean] = BooleanSetting(VerboseSetting, "V", "Print a synopsis of verbose options.") - val Vprint: Setting[List[String]] = PhasesSetting(VerboseSetting, "Vprint", "Print out program after", aliases = List("-Xprint")) - val XshowPhases: Setting[Boolean] = BooleanSetting(VerboseSetting, "Vphases", "List compiler phases.", aliases = List("-Xshow-phases")) + val Vprint: Setting[List[String]] = PhasesSetting(VerboseSetting, "Vprint", "Print out program after", aliases = SettingAlias("-Xprint", Deprecation()) :: Nil) + val XshowPhases: Setting[Boolean] = BooleanSetting(VerboseSetting, "Vphases", "List compiler phases.", aliases = SettingAlias("-Xshow-phases", Deprecation()) :: Nil) val Vprofile: Setting[Boolean] = BooleanSetting(VerboseSetting, "Vprofile", "Show metrics about sources and internal representations to estimate compile-time complexity.") 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: self: SettingGroup => val Whelp: Setting[Boolean] = BooleanSetting(WarningSetting, "W", "Print a synopsis of warning options.") - val Werror: Setting[Boolean] = BooleanSetting(WarningSetting, "Werror", "Fail the compilation if there are any warnings.", aliases = List("-Xfatal-warnings")) + val Werror: Setting[Boolean] = BooleanSetting(WarningSetting, "Werror", "Fail the compilation if there are any warnings.", aliases = SettingAlias("-Xfatal-warnings", Deprecation()) :: Nil) val Wall: Setting[Boolean] = BooleanSetting(WarningSetting, "Wall", "Enable all warning settings.") private val WvalueDiscard: Setting[Boolean] = BooleanSetting(WarningSetting, "Wvalue-discard", "Warn when non-Unit expression results are unused.") private val WNonUnitStatement = BooleanSetting(WarningSetting, "Wnonunit-statement", "Warn when block statements are non-Unit expressions.") diff --git a/compiler/src/dotty/tools/dotc/config/Settings.scala b/compiler/src/dotty/tools/dotc/config/Settings.scala index 72d0b985c31b..105ebda16de1 100644 --- a/compiler/src/dotty/tools/dotc/config/Settings.scala +++ b/compiler/src/dotty/tools/dotc/config/Settings.scala @@ -92,6 +92,12 @@ object Settings: */ type SettingDependencies = List[(Setting[?], Any)] + case class SettingAlias(name: String, deprecation: Option[Deprecation]) + object SettingAlias: + given Conversion[String, SettingAlias] = SettingAlias(_, None) + def apply(name: String): SettingAlias = SettingAlias(name, None) + def apply(name: String, deprecation: Deprecation): SettingAlias = SettingAlias(name, Some(deprecation)) + case class Setting[T] private[Settings] ( category: SettingCategory, name: String, @@ -100,7 +106,7 @@ object Settings: helpArg: String = "", choices: Option[Seq[?]] = None, prefix: Option[String] = None, - aliases: List[String] = Nil, + aliases: List[SettingAlias] = Nil, depends: SettingDependencies = Nil, ignoreInvalidArgs: Boolean = false, preferPrevious: Boolean = false, @@ -112,7 +118,11 @@ object Settings: legacyChoices: Option[Seq[?]] = None)(private[Settings] val idx: Int)(using ct: ClassTag[T]): validateSettingString(prefix.getOrElse(name)) - aliases.foreach(validateSettingString) + for alias <- aliases do + validateSettingString(alias.name) + val msg = "An alias is only \"replaced by\" its primary setting; its deprecation can have only a custom message." + for dep <- alias.deprecation do + assert(!dep.replacedBy.isDefined, msg) assert(name.startsWith(s"-${category.prefixLetter}"), s"Setting $name does not start with category -$category") assert(legacyArgs || !choices.exists(_.contains("")), s"Empty string is not supported as a choice for setting $name") validateSettingTag(ct) @@ -121,7 +131,7 @@ object Settings: // Example: -opt Main.scala would be interpreted as -opt:Main.scala, and the source file would be ignored. assert(!(ct == ListTag && ignoreInvalidArgs), s"Ignoring invalid args is not supported for multivalue settings: $name") - val allFullNames: List[String] = s"$name" :: s"-$name" :: aliases + val allFullNames: List[String] = s"$name" :: s"-$name" :: aliases.map(_.name) def valueIn(state: SettingsState): T = state.value(idx).asInstanceOf[T] @@ -142,34 +152,53 @@ object Settings: case Some(xs) => xs.mkString(", ") case None => "" - // Updates the state from the next arg if this setting is applicable. - def tryToSet(state: ArgsSummary): ArgsSummary = - val ArgsSummary(sstate, arg :: args, _, _) = state: @unchecked - def changed = sstate.wasChanged(idx) + /** Updates the state from the next arg if this setting is applicable. */ + def tryToSet(state0: ArgsSummary): ArgsSummary = + inline def state(using ArgsSummary) = summon[ArgsSummary] + inline def sstate(using ArgsSummary) = state.sstate + inline def changed(using ArgsSummary) = sstate.wasChanged(idx) + val arg :: args = state0.arguments: @unchecked // there must be an arg /** Updates the value in state. + * + * If this option is deprecated, add a warning. + * If the option is `replacedBy` another option, instead of applying the value, + * add the reconstructed arg to be applied subsequently. * * @param value will be evaluated at most once for side effects * @param altArg alt string to apply with alt setting if this setting is deprecated * @param args remaining arguments to process * @return updated argument state */ - def update(value: => Any, altArg: String, args: List[String]): ArgsSummary = - deprecation match - case Some(Deprecation(msg, Some(replacedBy))) => - val deprecatedMsg = s"Option $name is deprecated: $msg" - val altArg1 = - if altArg.isEmpty then List(replacedBy) - else List(s"$replacedBy:$altArg") - state.deprecated(deprecatedMsg, altArg1, args) // retry with reconstructed arg - case Some(Deprecation(msg, _)) => - state.updated(updateIn(sstate, value), args) // allow but warn - .warn(s"Option $name is deprecated: $msg") - case None => - state.updated(updateIn(sstate, value), args) + def update(value: => Any, altArg: String, args: List[String])(using ArgsSummary): ArgsSummary = + def checkDeprecatedAlias()(using ArgsSummary) = + val name = arg.takeWhile(_ != ':') + aliases.find(alt => alt.name == name && alt.deprecation.isDefined) + .map: + case SettingAlias(alt, dep) => + val msg = + dep.collect: + case dep if dep.msg.nonEmpty => dep.msg + .getOrElse(s"use ${this.name} instead") + state.warn(s"Option $alt is a deprecated alias: $msg", args) + .getOrElse(state) + def doUpdate(using ArgsSummary) = + deprecation match + case Some(Deprecation(msg, Some(replacedBy))) => + val deprecatedMsg = s"Option $name is deprecated: $msg" + val altArg1 = + if altArg.isEmpty then List(replacedBy) + else List(s"$replacedBy:$altArg") + state.deprecated(deprecatedMsg, altArg1, args) // retry with reconstructed arg + case Some(Deprecation(msg, _)) => + state.updated(updateIn(sstate, value), args) // allow but warn + .warn(s"Option $name is deprecated: $msg") + case None => + state.updated(updateIn(sstate, value), args) + doUpdate(using checkDeprecatedAlias()) end update - def setBoolean(argValue: String, args: List[String]) = + def setBoolean(argValue: String, args: List[String])(using ArgsSummary) = def checkAndSet(v: Boolean) = val dubious = changed && v != valueIn(sstate).asInstanceOf[Boolean] if dubious then @@ -183,7 +212,7 @@ object Settings: else if argValue.equalsIgnoreCase("false") then checkAndSet(false) else state.fail(s"$argValue is not a valid choice for Boolean flag $name", args) - def setString(argValue: String, args: List[String]) = + def setString(argValue: String, args: List[String])(using ArgsSummary) = choices match case Some(choices) if !choices.contains(argValue) => state.fail(s"$argValue is not a valid choice for $name", args) @@ -193,7 +222,7 @@ object Settings: else update(argValue, argValue, args) - def setInt(argValue: String, args: List[String]) = + def setInt(argValue: String, args: List[String])(using ArgsSummary) = argValue.toIntOption.map: intValue => choices match case Some(r: Range) if intValue < r.head || r.last < intValue => @@ -207,7 +236,7 @@ object Settings: .getOrElse: state.fail(s"$argValue is not an integer argument for $name", args) - def setOutput(arg: String, args: List[String]) = + def setOutput(arg: String, args: List[String])(using ArgsSummary) = val path = Directory(arg) val isJar = path.ext.isJar if (!isJar && !path.isDirectory) then @@ -221,7 +250,7 @@ object Settings: // argRest is the remainder of -foo:bar if any. This setting will receive a value from argRest or args.head. // useArg means use argRest even if empty. - def doSet(argRest: String, useArg: Boolean): ArgsSummary = + def doSet(argRest: String, useArg: Boolean)(using ArgsSummary): ArgsSummary = def missingArg = val msg = s"missing argument for option $name" if ignoreInvalidArgs then state.warn(s"$msg, the tag was ignored", args) else state.fail(msg, args) @@ -248,12 +277,12 @@ object Settings: doSet(arg1, args1) end doSet - def setVersion(arg: String, args: List[String]) = + def setVersion(arg: String, args: List[String])(using ArgsSummary) = ScalaVersion.parse(arg) match case Success(v) => update(v, arg, args) case Failure(e) => state.fail(e.getMessage, args) - def setMultivalue(arg: String, args: List[String]) = + def setMultivalue(arg: String, args: List[String])(using ArgsSummary) = val split = arg.split(",").toList def setOrUpdate(actual: List[String]) = val updated = @@ -286,21 +315,25 @@ object Settings: allFullNames.exists(_ == name) || prefix.exists(arg.startsWith) 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) => - // todo an error if empty suffix - doSet(arg.drop(prefix.length), useArg = true) + val value = arg.drop(prefix.length) + if value.isEmpty then + state.warn(s"Option $name requires a suffix: $arg", args) + else + doSet(value, useArg = true) case none => val split = arg.split(":", 2) if split.length == 1 then doSet("", useArg = false) else doSet(split(1), useArg = true) - else state + else state0 end tryToSet end Setting @@ -342,6 +375,7 @@ object Settings: ) object Deprecation: + def apply(): Deprecation = Deprecation(msg = "", replacedBy = None) def renamed(replacement: String) = Some(Deprecation(s"Use $replacement instead.", Some(replacement))) def removed(removedVersion: Option[String] = None) = val msg = removedVersion.map(" in " + _).getOrElse(".") @@ -418,37 +452,37 @@ object Settings: assert(!name.startsWith("-"), s"Setting $name cannot start with -") "-" + name - def BooleanSetting(category: SettingCategory, name: String, descr: String, initialValue: Boolean = false, aliases: List[String] = Nil, preferPrevious: Boolean = false, deprecation: Option[Deprecation] = None, ignoreInvalidArgs: Boolean = false): Setting[Boolean] = + def BooleanSetting(category: SettingCategory, name: String, descr: String, initialValue: Boolean = false, aliases: List[SettingAlias] = Nil, preferPrevious: Boolean = false, deprecation: Option[Deprecation] = None, ignoreInvalidArgs: Boolean = false): Setting[Boolean] = publish(Setting(category, prependName(name), descr, initialValue, aliases = aliases, preferPrevious = preferPrevious, deprecation = deprecation, ignoreInvalidArgs = ignoreInvalidArgs)) - def StringSetting(category: SettingCategory, name: String, helpArg: String, descr: String, default: String, aliases: List[String] = Nil, deprecation: Option[Deprecation] = None, depends: SettingDependencies = Nil): Setting[String] = + def StringSetting(category: SettingCategory, name: String, helpArg: String, descr: String, default: String, aliases: List[SettingAlias] = Nil, deprecation: Option[Deprecation] = None, depends: SettingDependencies = Nil): Setting[String] = publish(Setting(category, prependName(name), descr, default, helpArg, aliases = aliases, deprecation = deprecation, depends = depends)) - def ChoiceSetting(category: SettingCategory, name: String, helpArg: String, descr: String, choices: List[String], default: String, aliases: List[String] = Nil, legacyArgs: Boolean = false, deprecation: Option[Deprecation] = None): Setting[String] = + def ChoiceSetting(category: SettingCategory, name: String, helpArg: String, descr: String, choices: List[String], default: String, aliases: List[SettingAlias] = Nil, legacyArgs: Boolean = false, deprecation: Option[Deprecation] = None): Setting[String] = publish(Setting(category, prependName(name), descr, default, helpArg, Some(choices), aliases = aliases, legacyArgs = legacyArgs, deprecation = deprecation)) - def MultiChoiceSetting(category: SettingCategory, name: String, helpArg: String, descr: String, choices: List[String], default: List[String] = Nil, legacyChoices: List[String] = Nil, aliases: List[String] = Nil, deprecation: Option[Deprecation] = None): Setting[List[String]] = + def MultiChoiceSetting(category: SettingCategory, name: String, helpArg: String, descr: String, choices: List[String], default: List[String] = Nil, legacyChoices: List[String] = Nil, aliases: List[SettingAlias] = Nil, deprecation: Option[Deprecation] = None): Setting[List[String]] = publish(Setting(category, prependName(name), descr, default, helpArg, Some(choices), legacyChoices = Some(legacyChoices), aliases = aliases, deprecation = deprecation)) - def MultiChoiceHelpSetting(category: SettingCategory, name: String, helpArg: String, descr: String, choices: List[ChoiceWithHelp[String]], default: List[ChoiceWithHelp[String]], legacyChoices: List[String] = Nil, aliases: List[String] = Nil, deprecation: Option[Deprecation] = None): Setting[List[ChoiceWithHelp[String]]] = + def MultiChoiceHelpSetting(category: SettingCategory, name: String, helpArg: String, descr: String, choices: List[ChoiceWithHelp[String]], default: List[ChoiceWithHelp[String]], legacyChoices: List[String] = Nil, aliases: List[SettingAlias] = Nil, deprecation: Option[Deprecation] = None): Setting[List[ChoiceWithHelp[String]]] = publish(Setting(category, prependName(name), descr, default, helpArg, Some(choices), legacyChoices = Some(legacyChoices), aliases = aliases, deprecation = deprecation)) - def IntSetting(category: SettingCategory, name: String, descr: String, default: Int, aliases: List[String] = Nil, deprecation: Option[Deprecation] = None): Setting[Int] = + def IntSetting(category: SettingCategory, name: String, descr: String, default: Int, aliases: List[SettingAlias] = Nil, deprecation: Option[Deprecation] = None): Setting[Int] = publish(Setting(category, prependName(name), descr, default, aliases = aliases, deprecation = deprecation)) def IntChoiceSetting(category: SettingCategory, name: String, descr: String, choices: Seq[Int], default: Int, deprecation: Option[Deprecation] = None): Setting[Int] = publish(Setting(category, prependName(name), descr, default, choices = Some(choices), deprecation = deprecation)) - def MultiStringSetting(category: SettingCategory, name: String, helpArg: String, descr: String, default: List[String] = Nil, aliases: List[String] = Nil, deprecation: Option[Deprecation] = None): Setting[List[String]] = + def MultiStringSetting(category: SettingCategory, name: String, helpArg: String, descr: String, default: List[String] = Nil, aliases: List[SettingAlias] = Nil, deprecation: Option[Deprecation] = None): Setting[List[String]] = publish(Setting(category, prependName(name), descr, default, helpArg, aliases = aliases, deprecation = deprecation)) - def OutputSetting(category: SettingCategory, name: String, helpArg: String, descr: String, default: AbstractFile, aliases: List[String] = Nil, preferPrevious: Boolean = false, deprecation: Option[Deprecation] = None): Setting[AbstractFile] = + def OutputSetting(category: SettingCategory, name: String, helpArg: String, descr: String, default: AbstractFile, aliases: List[SettingAlias] = Nil, preferPrevious: Boolean = false, deprecation: Option[Deprecation] = None): Setting[AbstractFile] = publish(Setting(category, prependName(name), descr, default, helpArg, aliases = aliases, preferPrevious = preferPrevious, deprecation = deprecation)) - def PathSetting(category: SettingCategory, name: String, descr: String, default: String, aliases: List[String] = Nil, deprecation: Option[Deprecation] = None): Setting[String] = + def PathSetting(category: SettingCategory, name: String, descr: String, default: String, aliases: List[SettingAlias] = Nil, deprecation: Option[Deprecation] = None): Setting[String] = publish(Setting(category, prependName(name), descr, default, aliases = aliases, deprecation = deprecation)) - def PhasesSetting(category: SettingCategory, name: String, descr: String, default: String = "", aliases: List[String] = Nil, deprecation: Option[Deprecation] = None, depends: SettingDependencies = Nil): Setting[List[String]] = + def PhasesSetting(category: SettingCategory, name: String, descr: String, default: String = "", aliases: List[SettingAlias] = Nil, deprecation: Option[Deprecation] = None, depends: SettingDependencies = Nil): Setting[List[String]] = publish(Setting(category, prependName(name), descr, if (default.isEmpty) Nil else List(default), aliases = aliases, deprecation = deprecation, depends = depends)) def PrefixSetting(category: SettingCategory, name0: String, descr: String, deprecation: Option[Deprecation] = None): Setting[List[String]] = @@ -459,7 +493,7 @@ object Settings: def VersionSetting(category: SettingCategory, name: String, descr: String, default: ScalaVersion = NoScalaVersion, legacyArgs: Boolean = false, deprecation: Option[Deprecation] = None): Setting[ScalaVersion] = publish(Setting(category, prependName(name), descr, default, legacyArgs = legacyArgs, deprecation = deprecation)) - def OptionSetting[T: ClassTag](category: SettingCategory, name: String, descr: String, aliases: List[String] = Nil, deprecation: Option[Deprecation] = None): Setting[Option[T]] = + def OptionSetting[T: ClassTag](category: SettingCategory, name: String, descr: String, aliases: List[SettingAlias] = Nil, deprecation: Option[Deprecation] = None): Setting[Option[T]] = publish(Setting(category, prependName(name), descr, None, propertyClass = Some(summon[ClassTag[T]].runtimeClass), aliases = aliases, deprecation = deprecation)) end SettingGroup diff --git a/compiler/src/dotty/tools/dotc/reporting/Reporter.scala b/compiler/src/dotty/tools/dotc/reporting/Reporter.scala index 9465b1c6738e..d52d92dcb825 100644 --- a/compiler/src/dotty/tools/dotc/reporting/Reporter.scala +++ b/compiler/src/dotty/tools/dotc/reporting/Reporter.scala @@ -232,7 +232,7 @@ abstract class Reporter extends interfaces.ReporterResult { def finalizeReporting()(using Context) = if (hasWarnings && ctx.settings.Werror.value) - report(new Error("No warnings can be incurred under -Werror (or -Xfatal-warnings)", NoSourcePosition)) + report(new Error("No warnings can be incurred under -Werror", NoSourcePosition)) /** Summary of warnings and errors */ def summary: String = diff --git a/compiler/test/dotty/tools/dotc/SettingsTests.scala b/compiler/test/dotty/tools/dotc/SettingsTests.scala index 37d278b43a0a..8ec63f90c1a2 100644 --- a/compiler/test/dotty/tools/dotc/SettingsTests.scala +++ b/compiler/test/dotty/tools/dotc/SettingsTests.scala @@ -407,6 +407,73 @@ class SettingsTests: testValues(summary = summaryColon) testValues(summary = summaryWhitespace) + @Test def `prefix option requires nonempty suffix`: Unit = + object Settings extends SettingGroup: + val jvmargs = PrefixSetting(RootSetting, "J", "Pass -J directly to the runtime system.") + import Settings.* + val args = List("-J") + val summary = processArguments(args, processAll = true) + withProcessedArgs(summary): + assertTrue("Nothing to see here", summary.errors.isEmpty) + assertEquals(1, summary.warnings.length) + assertTrue("Prefix option warns", summary.warnings.head.contains("requires a suffix")) + assertTrue("Prefix option is empty", jvmargs.value.isEmpty) + + @Test def `alias deprecation is honored`: Unit = + object Settings extends SettingGroup: + val flag = BooleanSetting(RootSetting, "yas", "Yes, do it!", + aliases = SettingAlias("-meh", Deprecation("that was a dumb flag name")) :: Nil, + ) + import Settings.* + val args = List("-meh") + val summary = processArguments(args, processAll = true) + withProcessedArgs(summary): + assertTrue("Nothing to see here", summary.errors.isEmpty) + assertEquals(1, summary.warnings.length) + assertEquals("Option -meh is a deprecated alias: that was a dumb flag name", summary.warnings.head) + assertTrue("flag was set anyway", flag.value) + + @Test def `alias deprecation is honored when primary option is deprecated`: Unit = + object Settings extends SettingGroup: + val flag = BooleanSetting(RootSetting, "yas", "Yes, do it!", + aliases = SettingAlias("-meh", Deprecation("that was a dumb flag name")) :: Nil, + deprecation = Deprecation.removed(), + ) + import Settings.* + val args = List("-meh") + val summary = processArguments(args, processAll = true) + withProcessedArgs(summary): + assertTrue("Nothing to see here", summary.errors.isEmpty) + assertEquals(2, summary.warnings.length) + assertEquals("Option -meh is a deprecated alias: that was a dumb flag name", summary.warnings.head) + assertEquals("Option -yas is deprecated: Scheduled for removal.", summary.warnings(1)) + assertTrue("flag was set anyway", flag.value) + + @Test def `alias deprecation respects primary rename`: Unit = + object Settings extends SettingGroup: + val flag = BooleanSetting(RootSetting, "yas", "Yes, do it!", + aliases = SettingAlias("-meh", Deprecation("that was a dumb flag name")) :: Nil, + deprecation = Deprecation.renamed("anything!"), + ) + import Settings.* + val args = List("-meh") + val summary = processArguments(args, processAll = true) + withProcessedArgs(summary): + assertTrue("Nothing to see here", summary.errors.isEmpty) + assertEquals(2, summary.warnings.length) + assertEquals("Option -meh is a deprecated alias: that was a dumb flag name", summary.warnings.head) + assertEquals("Option -yas is deprecated: Use anything! instead.", summary.warnings(1)) + assertFalse("flag was set anyway", flag.value) + + @Test def `alias deprecation can't be replaced by anything`: Unit = + object Settings extends SettingGroup: + val flag = BooleanSetting(RootSetting, "yas", "Yes, do it!", + aliases = SettingAlias("-meh", Deprecation.renamed("anything at all!")) :: Nil, + ) + import Settings.* + assertThrows[AssertionError](_.getMessage.contains("replaced by")): + flag + // use the supplied summary for evaluating settings private def withProcessedArgs(summary: ArgsSummary)(f: SettingsState ?=> Unit) = f(using summary.sstate) diff --git a/compiler/test/dotty/tools/dotc/config/ScalaSettingsTests.scala b/compiler/test/dotty/tools/dotc/config/ScalaSettingsTests.scala index deb4fe9e57a3..c36e15a0eb36 100644 --- a/compiler/test/dotty/tools/dotc/config/ScalaSettingsTests.scala +++ b/compiler/test/dotty/tools/dotc/config/ScalaSettingsTests.scala @@ -160,34 +160,37 @@ class ScalaSettingsTests: assert(conf.errors.isEmpty) @nowarn("cat=deprecation") - @Test def `Deprecated options aliases are correctly mapped to their replacements`: Unit = - def createTestCase(oldSetting: Setting[?], newSetting: Setting[?], value: String = "") = - oldSetting.aliases.map: alias => - s"$alias$value" -> newSetting - + @Test def `Aliases of deprecated options are correctly mapped to their replacements`: Unit = 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), + 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.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 - ).flatten.map: (deprecatedArgument, newSetting) => - val args = List(deprecatedArgument) - val argSummary = ArgsSummary(settings.defaultState, args, errors = Nil, warnings = Nil) + ) + for + test <- tests + (old: Setting[?], fwd: Setting[?]) = test.take(2): @unchecked + SettingAlias(alias, _) <- old.aliases + do + assert(old.deprecation.isDefined) + val argString = if test.size > 2 then s"$alias:${test(2)}" else alias + val argSummary = ArgsSummary(settings.defaultState, arguments = argString :: Nil, errors = Nil, warnings = Nil) val conf = settings.processArguments(argSummary, processAll = true, skipped = Nil) - assert(!newSetting.isDefaultIn(conf.sstate), s"Setting alias $deprecatedArgument was not forwarded to ${newSetting.name}") + def problem = s"Setting alias $argString was not forwarded to ${fwd.name}" + assert(!fwd.isDefaultIn(conf.sstate), problem) @Test def `i18367 rightmost WConf flags take precedence over flags to the left`: Unit = import reporting.{Action, Diagnostic} @@ -306,4 +309,12 @@ class ScalaSettingsTests: assertEquals(0, result.warnings.length) assertEquals(1, result.errors.length) + @Test def `deprecated aliases warn`: Unit = + val settings = ScalaSettings + val args = "-Xfatal-warnings" :: "-Xprint" :: "typer" :: Nil + val result = settings.processArguments(args, processAll = true) + assertEquals(2, result.warnings.length) + assertEquals("Option -Xfatal-warnings is a deprecated alias: use -Werror instead", result.warnings.head) + assertEquals(0, result.errors.length) + end ScalaSettingsTests diff --git a/repl/test-resources/repl/rewrite-messages b/repl/test-resources/repl/rewrite-messages index d7bcbe5d3a90..2f78486782c6 100644 --- a/repl/test-resources/repl/rewrite-messages +++ b/repl/test-resources/repl/rewrite-messages @@ -4,7 +4,7 @@ scala> import scala.util._ 1 | import scala.util._ | ^ | `_` is no longer supported for a wildcard import; use `*` instead -No warnings can be incurred under -Werror (or -Xfatal-warnings) +No warnings can be incurred under -Werror 1 warning found 1 error found scala> extension (x: Int) def foo(y: Int) = x + y @@ -15,6 +15,6 @@ scala> 2 foo 4 | ^^^ |Alphanumeric method foo is not declared infix; it should not be used as infix operator. |Instead, use method syntax .foo(...) or backticked identifier `foo`. -No warnings can be incurred under -Werror (or -Xfatal-warnings) +No warnings can be incurred under -Werror 1 warning found -1 error found \ No newline at end of file +1 error found diff --git a/sbt-test/source-dependencies/changedTypeOfChildOfSealed/incOptions.properties b/sbt-test/source-dependencies/changedTypeOfChildOfSealed/incOptions.properties index fad0545c8f66..c2b3d1a2b4a8 100644 --- a/sbt-test/source-dependencies/changedTypeOfChildOfSealed/incOptions.properties +++ b/sbt-test/source-dependencies/changedTypeOfChildOfSealed/incOptions.properties @@ -1 +1 @@ -scalac.options = -Xfatal-warnings \ No newline at end of file +scalac.options = -Werror diff --git a/sbt-test/source-dependencies/sealed-extends-sealed/project/DottyInjectedPlugin.scala b/sbt-test/source-dependencies/sealed-extends-sealed/project/DottyInjectedPlugin.scala index fc8fd26fc29e..88e5199c45d5 100644 --- a/sbt-test/source-dependencies/sealed-extends-sealed/project/DottyInjectedPlugin.scala +++ b/sbt-test/source-dependencies/sealed-extends-sealed/project/DottyInjectedPlugin.scala @@ -7,6 +7,6 @@ object DottyInjectedPlugin extends AutoPlugin { override val projectSettings = Seq( scalaVersion := sys.props("plugin.scalaVersion"), - scalacOptions ++= Seq("-source:3.0-migration", "-Xfatal-warnings") + scalacOptions ++= Seq("-source:3.0-migration", "-Werror") ) } diff --git a/sbt-test/source-dependencies/sealed/test b/sbt-test/source-dependencies/sealed/test index 69c8ebe98a74..0ee9b910a31f 100644 --- a/sbt-test/source-dependencies/sealed/test +++ b/sbt-test/source-dependencies/sealed/test @@ -1,4 +1,4 @@ -> 'set scalacOptions += "-Xfatal-warnings"' +> 'set scalacOptions += "-Werror"' > compile @@ -8,4 +8,4 @@ $ copy-file changes/A.scala A.scala # D.scala needs recompiling because the pattern match in D # is no longer exhaustive, which should be a warning # there is no way to make warnings errors, so this has to be manually checked --> compile \ No newline at end of file +-> compile diff --git a/sbt-test/tasty-compat/add-overload/build.sbt b/sbt-test/tasty-compat/add-overload/build.sbt index 52a04f07148e..4c69acb7a34f 100644 --- a/sbt-test/tasty-compat/add-overload/build.sbt +++ b/sbt-test/tasty-compat/add-overload/build.sbt @@ -16,7 +16,7 @@ lazy val `a-changes` = project.in(file("a-changes")) lazy val c = project.in(file(".")) .settings( - scalacOptions ++= Seq("-from-tasty", "-Ycheck:readTasty", "-Xfatal-warnings"), + scalacOptions ++= Seq("-from-tasty", "-Ycheck:readTasty", "-Werror"), Compile / sources := Seq(new java.io.File("c-input/B.tasty")), Compile / unmanagedClasspath += (ThisBuild / baseDirectory).value / "c-input", Compile / classDirectory := (ThisBuild / baseDirectory).value / "c-output" diff --git a/sbt-test/tasty-compat/add-param-unroll/build.sbt b/sbt-test/tasty-compat/add-param-unroll/build.sbt index 24bf7f140cd1..e857fd5e1fac 100644 --- a/sbt-test/tasty-compat/add-param-unroll/build.sbt +++ b/sbt-test/tasty-compat/add-param-unroll/build.sbt @@ -29,7 +29,7 @@ lazy val c = project.in(file("c")) .settings(commonSettings) .settings(printSettings) .settings( - // scalacOptions ++= Seq("-from-tasty", "-Ycheck:readTasty", "-Xfatal-warnings", "-Vprint:readTasty", "-Xprint-types"), + // scalacOptions ++= Seq("-from-tasty", "-Ycheck:readTasty", "-Werror", "-Vprint:readTasty", "-Xprint-types"), // Compile / sources := Seq(new java.io.File("c-input/B.tasty")), Compile / unmanagedClasspath += (ThisBuild / baseDirectory).value / "c-input", Compile / classDirectory := (ThisBuild / baseDirectory).value / "c-output" diff --git a/tests/disabled/macro/pos/t8013/inpervolated_2.scala b/tests/disabled/macro/pos/t8013/inpervolated_2.scala index cbe5139cef5a..d2cacd86e1ea 100644 --- a/tests/disabled/macro/pos/t8013/inpervolated_2.scala +++ b/tests/disabled/macro/pos/t8013/inpervolated_2.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -Xlint +//> using options -Werror -Xlint package t8013 // unsuspecting user of perverse macro diff --git a/tests/disabled/partest/neg/t5663-badwarneq.scala b/tests/disabled/partest/neg/t5663-badwarneq.scala index 1cc554264ce4..8e32d55b9900 100644 --- a/tests/disabled/partest/neg/t5663-badwarneq.scala +++ b/tests/disabled/partest/neg/t5663-badwarneq.scala @@ -24,7 +24,7 @@ final case class ValueClass3(val value: Int) extends AnyVal /* It's not possible to run partest without -deprecation. * Since detecting the warnings requires a neg test with - * -Xfatal-warnings, and deprecation terminates the compile, + * -Werror and deprecation terminates the compile, * we'll just comment out the nasty part. The point was * just to show there's nothing special about a trait * that extends a case class, which is only permitted diff --git a/tests/explicit-nulls/neg-patmat/match-pat.scala b/tests/explicit-nulls/neg-patmat/match-pat.scala index 1b93267d8fe3..2357a585635e 100644 --- a/tests/explicit-nulls/neg-patmat/match-pat.scala +++ b/tests/explicit-nulls/neg-patmat/match-pat.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror class Foo { diff --git a/tests/explicit-nulls/pos/match-pat.scala b/tests/explicit-nulls/pos/match-pat.scala index 33013d1865fd..2b0b5e64dbbf 100644 --- a/tests/explicit-nulls/pos/match-pat.scala +++ b/tests/explicit-nulls/pos/match-pat.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror // Ensure we don't get "the type test for argType cannot be checked at runtime" warning diff --git a/tests/explicit-nulls/pos/unsafe-match-null-pat.scala b/tests/explicit-nulls/pos/unsafe-match-null-pat.scala index ff31642a4027..4c46959e78b1 100644 --- a/tests/explicit-nulls/pos/unsafe-match-null-pat.scala +++ b/tests/explicit-nulls/pos/unsafe-match-null-pat.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror import scala.language.unsafeNulls diff --git a/tests/neg-custom-args/captures/capt-wf.scala b/tests/neg-custom-args/captures/capt-wf.scala index 7521a0e26472..1f6bf5b16ac6 100644 --- a/tests/neg-custom-args/captures/capt-wf.scala +++ b/tests/neg-custom-args/captures/capt-wf.scala @@ -1,4 +1,4 @@ -//> using options -language:experimental.captureChecking -Xfatal-warnings +//> using options -language:experimental.captureChecking -Werror import caps.cap class C type Cap = C^ @@ -35,4 +35,4 @@ def test(c: Cap, other: String): Unit = val y3: String^{ev} = ??? // error cs is empty () -// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings) \ No newline at end of file +// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings) diff --git a/tests/neg-custom-args/sourcepath2/hi/A.check b/tests/neg-custom-args/sourcepath2/hi/A.check index 6267edaac603..d44b67b8cd53 100644 --- a/tests/neg-custom-args/sourcepath2/hi/A.check +++ b/tests/neg-custom-args/sourcepath2/hi/A.check @@ -4,4 +4,4 @@ | class Hello is in the wrong directory. | It was declared to be in package | But it is found in directory hi -No warnings can be incurred under -Werror (or -Xfatal-warnings) +No warnings can be incurred under -Werror diff --git a/tests/neg-custom-args/wildcards.scala b/tests/neg-custom-args/wildcards.scala index c734e2d046b5..049f998324ee 100644 --- a/tests/neg-custom-args/wildcards.scala +++ b/tests/neg-custom-args/wildcards.scala @@ -1,6 +1,6 @@ -//> using options -source future -deprecation -Xfatal-warnings +//> using options -source future -deprecation -Werror object Test { val xs: List[_] = List(1, 2, 3) // error val ys: Map[_ <: AnyRef, _ >: Null] = Map() // error // error -} \ No newline at end of file +} diff --git a/tests/neg-deep-subtype/i17435.scala b/tests/neg-deep-subtype/i17435.scala index aec165a18f56..9f77fc673168 100644 --- a/tests/neg-deep-subtype/i17435.scala +++ b/tests/neg-deep-subtype/i17435.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror import scala.collection.mutable diff --git a/tests/neg-deep-subtype/i5495.scala b/tests/neg-deep-subtype/i5495.scala index 7d50c9761c30..db2610e10f6d 100644 --- a/tests/neg-deep-subtype/i5495.scala +++ b/tests/neg-deep-subtype/i5495.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror class A class B diff --git a/tests/neg-deep-subtype/i5826b.scala b/tests/neg-deep-subtype/i5826b.scala index a3c3382bbc51..31d505c1b844 100644 --- a/tests/neg-deep-subtype/i5826b.scala +++ b/tests/neg-deep-subtype/i5826b.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror class Foo { def test1[A]: List[Int] | A => Int = { diff --git a/tests/neg-deep-subtype/patmat-applied.scala b/tests/neg-deep-subtype/patmat-applied.scala index 9123f3ab2ed6..fbdfdaf03626 100644 --- a/tests/neg-deep-subtype/patmat-applied.scala +++ b/tests/neg-deep-subtype/patmat-applied.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror class A[-T] class B[T] extends A[T] diff --git a/tests/neg-macros/i9570.check b/tests/neg-macros/i9570.check index 3c1f0f644318..23fba1b1c0a6 100644 --- a/tests/neg-macros/i9570.check +++ b/tests/neg-macros/i9570.check @@ -2,4 +2,4 @@ 15 | case '{HCons(_,$t)} => // warn (in .check file) | ^ | Use of `_` for lambda in quoted pattern. Use explicit lambda instead or use `$_` to match any term. -No warnings can be incurred under -Werror (or -Xfatal-warnings) +No warnings can be incurred under -Werror diff --git a/tests/neg-macros/i9570.scala b/tests/neg-macros/i9570.scala index f1bae86fc17a..b77697ef477f 100644 --- a/tests/neg-macros/i9570.scala +++ b/tests/neg-macros/i9570.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror import scala.quoted.* @@ -25,4 +25,4 @@ object Macros { } } -// nopos-error No warnings can be incurred under -Werror (or -Xfatal-warnings) \ No newline at end of file +// nopos-error No warnings can be incurred under -Werror diff --git a/tests/neg-macros/macro-deprecation.check b/tests/neg-macros/macro-deprecation.check index c3ba52b73c56..e091f5e701e9 100644 --- a/tests/neg-macros/macro-deprecation.check +++ b/tests/neg-macros/macro-deprecation.check @@ -2,4 +2,4 @@ 5 |inline def f = ${ impl } // warn (in .check file) | ^^^^ | method impl is deprecated -No warnings can be incurred under -Werror (or -Xfatal-warnings) +No warnings can be incurred under -Werror diff --git a/tests/neg-macros/macro-deprecation.scala b/tests/neg-macros/macro-deprecation.scala index 7d44658bef90..61cefe91b78e 100644 --- a/tests/neg-macros/macro-deprecation.scala +++ b/tests/neg-macros/macro-deprecation.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation +//> using options -Werror -deprecation import scala.quoted.* diff --git a/tests/neg-scalajs/enumeration-warnings.check b/tests/neg-scalajs/enumeration-warnings.check index d092d545b22b..b388611645cd 100644 --- a/tests/neg-scalajs/enumeration-warnings.check +++ b/tests/neg-scalajs/enumeration-warnings.check @@ -58,4 +58,4 @@ | ^^^^^^^^^^^^ | Passing null as name to a constructor of scala.Enumeration.Val requires reflection at run-time. | The resulting program is unlikely to function properly. -No warnings can be incurred under -Werror (or -Xfatal-warnings) +No warnings can be incurred under -Werror diff --git a/tests/neg-scalajs/enumeration-warnings.scala b/tests/neg-scalajs/enumeration-warnings.scala index d05c044a32ab..bbf7ff8f357c 100644 --- a/tests/neg-scalajs/enumeration-warnings.scala +++ b/tests/neg-scalajs/enumeration-warnings.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror class UnableToTransformValue extends Enumeration { val a = { diff --git a/tests/neg/IsInstanceOfClassTag.scala b/tests/neg/IsInstanceOfClassTag.scala index 139ca7eae5a6..72d8c9224619 100644 --- a/tests/neg/IsInstanceOfClassTag.scala +++ b/tests/neg/IsInstanceOfClassTag.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror import scala.reflect.ClassTag diff --git a/tests/neg/adhoc-extension/B.scala b/tests/neg/adhoc-extension/B.scala index 05a243077aaa..3287d21c4eea 100644 --- a/tests/neg/adhoc-extension/B.scala +++ b/tests/neg/adhoc-extension/B.scala @@ -1,4 +1,4 @@ -//> using options -source future -feature -Xfatal-warnings +//> using options -source future -feature -Werror package adhoc class B extends A // warn: adhoc-extension (under -strict -feature -Xfatal-warnings) @@ -8,4 +8,4 @@ object O { val a = new A {} // warn object E extends A // warn } -// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings) \ No newline at end of file +// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings) diff --git a/tests/neg/classtag-typetest/3_1-migration.scala b/tests/neg/classtag-typetest/3_1-migration.scala index f387ccabf7c4..ddfcace194e4 100644 --- a/tests/neg/classtag-typetest/3_1-migration.scala +++ b/tests/neg/classtag-typetest/3_1-migration.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror import scala.language.`future-migration` import scala.reflect.ClassTag diff --git a/tests/neg/classtag-typetest/3_1.scala b/tests/neg/classtag-typetest/3_1.scala index b6c8010364fc..2f5db79a6a25 100644 --- a/tests/neg/classtag-typetest/3_1.scala +++ b/tests/neg/classtag-typetest/3_1.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror import scala.language.future import scala.reflect.ClassTag diff --git a/tests/neg/enum-variance.scala b/tests/neg/enum-variance.scala index ae6693ad94cc..75daa30a3c9c 100644 --- a/tests/neg/enum-variance.scala +++ b/tests/neg/enum-variance.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror enum View[-T]: case Refl(f: T => T) // error: enum case Refl requires explicit declaration of type T diff --git a/tests/neg/filtering-fors.scala b/tests/neg/filtering-fors.scala index 7d998a37f057..d62a8722f4ba 100644 --- a/tests/neg/filtering-fors.scala +++ b/tests/neg/filtering-fors.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror object Test { @@ -31,4 +31,4 @@ object Test { for (case (x: String) <- xs; case (y, z) <- xs) do () // OK for (case (x, y) <- pairs) yield (y, x) // OK -} \ No newline at end of file +} diff --git a/tests/neg/i1050.scala b/tests/neg/i1050.scala index 2489cbde49c9..5005521407b6 100644 --- a/tests/neg/i1050.scala +++ b/tests/neg/i1050.scala @@ -1,4 +1,4 @@ -//> using options -source future -deprecation -Xfatal-warnings +//> using options -source future -deprecation -Werror // i1050 checks failing at posttyper trait A { type L <: Nothing } diff --git a/tests/neg/i12188/Test.scala b/tests/neg/i12188/Test.scala index 511a4804e5be..44403c8304b0 100644 --- a/tests/neg/i12188/Test.scala +++ b/tests/neg/i12188/Test.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror sealed trait P case class PC1(a: String) extends P @@ -10,4 +10,4 @@ def foo(x: P): Unit = x match // warn case _: PC1 => -// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings) \ No newline at end of file +// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings) diff --git a/tests/neg/i13946/BadPrinter.scala b/tests/neg/i13946/BadPrinter.scala index f26ae97c1dfb..67ab6776a883 100644 --- a/tests/neg/i13946/BadPrinter.scala +++ b/tests/neg/i13946/BadPrinter.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -feature +//> using options -Werror -feature // in BadPrinter.scala import language.future diff --git a/tests/neg/i15474b.check b/tests/neg/i15474b.check index ac894168d51e..55974512acb5 100644 --- a/tests/neg/i15474b.check +++ b/tests/neg/i15474b.check @@ -3,4 +3,4 @@ | ^^^^^^^^^^ | Infinite loop in function body | Test1.c.apply(from).toInt -No warnings can be incurred under -Werror (or -Xfatal-warnings) +No warnings can be incurred under -Werror diff --git a/tests/neg/i15474b.scala b/tests/neg/i15474b.scala index 0a99056f8a6e..61ef0c4c0414 100644 --- a/tests/neg/i15474b.scala +++ b/tests/neg/i15474b.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror import scala.language.implicitConversions diff --git a/tests/neg/i16092.scala b/tests/neg/i16092.scala index c1327d3f6f70..3dcc7b31299c 100644 --- a/tests/neg/i16092.scala +++ b/tests/neg/i16092.scala @@ -1,4 +1,4 @@ -//> using options -source future -deprecation -Xfatal-warnings +//> using options -source future -deprecation -Werror trait X { type T diff --git a/tests/neg/i16876/Test.scala b/tests/neg/i16876/Test.scala index dd7c1c2418ae..7bf582acaa37 100644 --- a/tests/neg/i16876/Test.scala +++ b/tests/neg/i16876/Test.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -Wunused:all +//> using options -Werror -Wunused:all object Foo { private def myMethod(a: Int, b: Int, c: Int) = adder // ok @@ -7,4 +7,4 @@ object Foo { private def myMethodFailing(a: Int, b: Int, c: Int) = a + 0 // warn // warn myMethodFailing(1, 2, 3) } -// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings) \ No newline at end of file +// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings) diff --git a/tests/neg/i17335.scala b/tests/neg/i17335.scala index b22ece6e42bf..021a2f190bbe 100644 --- a/tests/neg/i17335.scala +++ b/tests/neg/i17335.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -Wunused:all +//> using options -Werror -Wunused:all def aMethod() = doStuff { (x) => x } // error diff --git a/tests/neg/i17612b.check b/tests/neg/i17612b.check index 681b682b459d..39e2738fcd63 100644 --- a/tests/neg/i17612b.check +++ b/tests/neg/i17612b.check @@ -30,4 +30,4 @@ 41 | class UnderDerived(x: Int, y: Int, z: Int) extends Derived(x, 1, y, z) // warn // warn // warn | ^ | value z in class UnderDerived shadows field z inherited from trait Base -No warnings can be incurred under -Werror (or -Xfatal-warnings) +No warnings can be incurred under -Werror diff --git a/tests/neg/i17612b/i17612b.scala b/tests/neg/i17612b/i17612b.scala index a7afbf019d07..b833b37bb201 100644 --- a/tests/neg/i17612b/i17612b.scala +++ b/tests/neg/i17612b/i17612b.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -Wshadow:private-shadow -source:3.3 +//> using options -Werror -Wshadow:private-shadow -source:3.3 object i17612b: @@ -42,4 +42,4 @@ object i17612b: def main(args: Array[String]) = val derived = new Derived(1, 1, 1, 1) -// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings) \ No newline at end of file +// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings) diff --git a/tests/neg/i17613b.check b/tests/neg/i17613b.check index 494d218fb366..c1807d6c45cb 100644 --- a/tests/neg/i17613b.check +++ b/tests/neg/i17613b.check @@ -58,4 +58,4 @@ 42 | class InnerCl[ImClassR] // warn | ^^^^^^^^ | Type parameter ImClassR for class InnerCl shadows an explicitly renamed type : ImClassR -No warnings can be incurred under -Werror (or -Xfatal-warnings) +No warnings can be incurred under -Werror diff --git a/tests/neg/i17613b/i17613b.scala b/tests/neg/i17613b/i17613b.scala index 0969a9a869ea..de854f9e43b9 100644 --- a/tests/neg/i17613b/i17613b.scala +++ b/tests/neg/i17613b/i17613b.scala @@ -1,4 +1,4 @@ -//> using options -Wshadow:type-parameter-shadow -Xfatal-warnings +//> using options -Wshadow:type-parameter-shadow -Werror object i17613b: import importTry._ diff --git a/tests/neg/i18632.check b/tests/neg/i18632.check index a0fa733cf8e3..f5b128dd39a3 100644 --- a/tests/neg/i18632.check +++ b/tests/neg/i18632.check @@ -2,4 +2,4 @@ 12 | bar // warn | ^^^ | unused value of type String -No warnings can be incurred under -Werror (or -Xfatal-warnings) +No warnings can be incurred under -Werror diff --git a/tests/neg/i4986d.scala b/tests/neg/i4986d.scala index 0def343fe847..36b6c54d9753 100644 --- a/tests/neg/i4986d.scala +++ b/tests/neg/i4986d.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror trait Foo[A] @@ -22,4 +22,4 @@ trait Bar[A] type Barable[A] = { def bar(implicit ev: Bar[A]): Any // ok } -// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings) \ No newline at end of file +// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings) diff --git a/tests/neg/i5854.scala b/tests/neg/i5854.scala index 61c7c2d833e7..f67216669c66 100644 --- a/tests/neg/i5854.scala +++ b/tests/neg/i5854.scala @@ -1,4 +1,4 @@ -//> using options -source future -deprecation -Xfatal-warnings +//> using options -source future -deprecation -Werror object bar { trait Sub { @@ -23,4 +23,4 @@ object bar { val zero : String = (new Caster[Int,String]()).upcast(0) println("...") } -} \ No newline at end of file +} diff --git a/tests/neg/i6716-source-3.4.scala b/tests/neg/i6716-source-3.4.scala index f6f1961b67a4..966a45ca9eb2 100644 --- a/tests/neg/i6716-source-3.4.scala +++ b/tests/neg/i6716-source-3.4.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -source 3.4 +//> using options -Werror -source 3.4 trait Monad[T]: def id: String @@ -16,4 +16,4 @@ object Test extends App { println(summon[Monad[Foo]].id) println(summon[Monad[Bar]].id) } -// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings) \ No newline at end of file +// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings) diff --git a/tests/neg/i8681.scala b/tests/neg/i8681.scala index 637dd123bd48..fcde4b3d8e34 100644 --- a/tests/neg/i8681.scala +++ b/tests/neg/i8681.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror case class A(a: Int) case class B(b: Int) @@ -14,4 +14,4 @@ val b = (A(1): A | B) match { case B(_) => "OK" case C(_) => "NOT OK" // error } -// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings) \ No newline at end of file +// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings) diff --git a/tests/neg/i8711.check b/tests/neg/i8711.check index 245092a6dfd0..492d16dfa1db 100644 --- a/tests/neg/i8711.check +++ b/tests/neg/i8711.check @@ -18,4 +18,4 @@ 14 | case x: C => x // error | ^ | this case is unreachable since type A | B and class C are unrelated -No warnings can be incurred under -Werror (or -Xfatal-warnings) +No warnings can be incurred under -Werror diff --git a/tests/neg/i8711.scala b/tests/neg/i8711.scala index 18f53447d024..88b0a39839fd 100644 --- a/tests/neg/i8711.scala +++ b/tests/neg/i8711.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror class A class B @@ -21,4 +21,4 @@ object Test { } } -// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings) \ No newline at end of file +// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings) diff --git a/tests/neg/i9168.scala b/tests/neg/i9168.scala index ed8bd4750972..b8da818e58b7 100644 --- a/tests/neg/i9168.scala +++ b/tests/neg/i9168.scala @@ -1,3 +1,3 @@ -//> using options -Xfatal-warnings +//> using options -Werror def g: Int = try 42 finally ; // error diff --git a/tests/neg/i9408b.check b/tests/neg/i9408b.check index 1fd651f70112..6672e66d4f08 100644 --- a/tests/neg/i9408b.check +++ b/tests/neg/i9408b.check @@ -2,4 +2,4 @@ 8 | val length: Int = "abc" // warn | ^^^^^ |The conversion (test.conversions.Conv.implicitLength : String => Int) will not be applied implicitly here in Scala 3 because only implicit methods and instances of Conversion class will continue to work as implicit views. -No warnings can be incurred under -Werror (or -Xfatal-warnings) +No warnings can be incurred under -Werror diff --git a/tests/neg/i9408b/Test_2.scala b/tests/neg/i9408b/Test_2.scala index dc5c2bd7b30d..3e5170a9b58e 100644 --- a/tests/neg/i9408b/Test_2.scala +++ b/tests/neg/i9408b/Test_2.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror import language.`3.0-migration` import scala.language.implicitConversions @@ -8,4 +8,4 @@ object Test { val length: Int = "abc" // warn } -// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings) \ No newline at end of file +// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings) diff --git a/tests/neg/impl-conv/B.scala b/tests/neg/impl-conv/B.scala index 7ba9fbb92459..fb35add21cd9 100644 --- a/tests/neg/impl-conv/B.scala +++ b/tests/neg/impl-conv/B.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -feature +//> using options -Werror -feature package implConv @@ -10,4 +10,4 @@ object B { val x: Int = "" // ok val y: String = 1 // warn: feature } -// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings) \ No newline at end of file +// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings) diff --git a/tests/neg/indentLeft.scala b/tests/neg/indentLeft.scala index 22386bd54561..dd47463ae959 100644 --- a/tests/neg/indentLeft.scala +++ b/tests/neg/indentLeft.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror // nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings) object Test { @@ -8,4 +8,4 @@ object Test { println("!") // warn: too far to the left } -// error: too far to the left \ No newline at end of file +// error: too far to the left diff --git a/tests/neg/indentRight.scala b/tests/neg/indentRight.scala index e3359bf238dd..4bddd19a513e 100644 --- a/tests/neg/indentRight.scala +++ b/tests/neg/indentRight.scala @@ -1,4 +1,4 @@ -//> using options -no-indent -Xfatal-warnings +//> using options -no-indent -Werror trait A case class B() extends A // warn: Line is indented too far to the right @@ -33,4 +33,4 @@ object Test { println("!") // error: expected a toplevel definition } -// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings) \ No newline at end of file +// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings) diff --git a/tests/neg/inline-unstable-accessors.check b/tests/neg/inline-unstable-accessors.check index c1984e4cc533..deab0b898ccc 100644 --- a/tests/neg/inline-unstable-accessors.check +++ b/tests/neg/inline-unstable-accessors.check @@ -297,4 +297,4 @@ | added to package I: | @publicInBinary private[I] def inline$valBinaryAPI2: Int = foo.I.valBinaryAPI2 -------------------------------------------------------------------------------------------------------------------- -No warnings can be incurred under -Werror (or -Xfatal-warnings) +No warnings can be incurred under -Werror diff --git a/tests/neg/into-override.scala b/tests/neg/into-override.scala index 6a1e2ca10fda..f5f6db4da169 100644 --- a/tests/neg/into-override.scala +++ b/tests/neg/into-override.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -preview +//> using options -Werror -preview import Conversion.into diff --git a/tests/neg/missing-targetName.scala b/tests/neg/missing-targetName.scala index 32f4646cd5a3..25c3ede1ed14 100644 --- a/tests/neg/missing-targetName.scala +++ b/tests/neg/missing-targetName.scala @@ -1,4 +1,4 @@ -//> using options -Yrequire-targetName -Xfatal-warnings +//> using options -Yrequire-targetName -Werror // Compile with -strict -Xfatal-warnings -deprecation import scala.annotation.targetName @@ -9,4 +9,4 @@ class & { // error val frozen_& : Int = ??? // warn object some_??? // warn } -// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings) \ No newline at end of file +// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings) diff --git a/tests/neg/nullless.scala b/tests/neg/nullless.scala index 20f9af841e14..662d5cab4a03 100644 --- a/tests/neg/nullless.scala +++ b/tests/neg/nullless.scala @@ -1,4 +1,4 @@ -//> using options -source future -deprecation -Xfatal-warnings +//> using options -source future -deprecation -Werror object nullless { trait LowerBound[T] { diff --git a/tests/neg/pureStatement.scala b/tests/neg/pureStatement.scala index 09a59f1621db..12e6af81b346 100644 --- a/tests/neg/pureStatement.scala +++ b/tests/neg/pureStatement.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror class IOCapability @@ -32,4 +32,4 @@ object Test { broken.foo // no extra error, and no pure expression warning broken.foo() // same } -// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings) \ No newline at end of file +// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings) diff --git a/tests/neg/runtimeChecked-2.check b/tests/neg/runtimeChecked-2.check index 1b30d637a6b9..317836588ff9 100644 --- a/tests/neg/runtimeChecked-2.check +++ b/tests/neg/runtimeChecked-2.check @@ -2,4 +2,4 @@ 10 | case is: Some[t] => ??? // unreachable | ^^^^^^^^^^^ | Unreachable case -No warnings can be incurred under -Werror (or -Xfatal-warnings) +No warnings can be incurred under -Werror diff --git a/tests/neg/runtimeChecked.check b/tests/neg/runtimeChecked.check index 3d984e08517d..faa0971a0e3b 100644 --- a/tests/neg/runtimeChecked.check +++ b/tests/neg/runtimeChecked.check @@ -4,4 +4,4 @@ |the type test for ::[Int] cannot be checked at runtime because its type arguments can't be determined from List[Any] | | longer explanation available when compiling with `-explain` -No warnings can be incurred under -Werror (or -Xfatal-warnings) +No warnings can be incurred under -Werror diff --git a/tests/neg/structural-2.scala b/tests/neg/structural-2.scala index 4353467fc821..e340b36d60ce 100644 --- a/tests/neg/structural-2.scala +++ b/tests/neg/structural-2.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror import scala.reflect.Selectable.reflectiveSelectable diff --git a/tests/neg/unchecked-patterns.scala b/tests/neg/unchecked-patterns.scala index d0e04be687dc..f77ab8a9a263 100644 --- a/tests/neg/unchecked-patterns.scala +++ b/tests/neg/unchecked-patterns.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror object Test { @@ -25,4 +25,4 @@ object Test { val Pair(t1, t2) = (5, 5) // OK val Triple(u1, u2, u3) = (5, 5, 5) // OK } -// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings) \ No newline at end of file +// nopos-error: No warnings can be incurred under -Werror (or -Xfatal-warnings) diff --git a/tests/pos-deep-subtype/3324c.scala b/tests/pos-deep-subtype/3324c.scala index aefa25eaafc2..58c008c9dbd9 100644 --- a/tests/pos-deep-subtype/3324c.scala +++ b/tests/pos-deep-subtype/3324c.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror sealed trait A[T] class B[T] extends A[T] diff --git a/tests/pos-deep-subtype/3324d.scala b/tests/pos-deep-subtype/3324d.scala index 9372f33c3d10..d53f4acc90e7 100644 --- a/tests/pos-deep-subtype/3324d.scala +++ b/tests/pos-deep-subtype/3324d.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror class Test { val x: Any = ??? @@ -7,4 +7,4 @@ class Test { case _: List[Int @unchecked] => 5 case _: Option[Int] @unchecked => 5 } -} \ No newline at end of file +} diff --git a/tests/pos-deep-subtype/3324e.scala b/tests/pos-deep-subtype/3324e.scala index 58ba0152ed21..38bbe98af866 100644 --- a/tests/pos-deep-subtype/3324e.scala +++ b/tests/pos-deep-subtype/3324e.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror class C[T] { val x: T = ??? diff --git a/tests/pos-deep-subtype/3324h.scala b/tests/pos-deep-subtype/3324h.scala index 6bae5f6a01d9..dfd210990c75 100644 --- a/tests/pos-deep-subtype/3324h.scala +++ b/tests/pos-deep-subtype/3324h.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror import scala.language.`3.3` diff --git a/tests/pos-deep-subtype/Result.scala b/tests/pos-deep-subtype/Result.scala index df42e54f3138..3509e4db53ef 100644 --- a/tests/pos-deep-subtype/Result.scala +++ b/tests/pos-deep-subtype/Result.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror object p { diff --git a/tests/pos-deep-subtype/classTag.scala b/tests/pos-deep-subtype/classTag.scala index b084f7f7e59c..5433e3edbf12 100644 --- a/tests/pos-deep-subtype/classTag.scala +++ b/tests/pos-deep-subtype/classTag.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror import scala.reflect.ClassTag @@ -9,4 +9,4 @@ object IsInstanceOfClassTag { case _ => None } } -} \ No newline at end of file +} diff --git a/tests/pos-deep-subtype/gadt.scala b/tests/pos-deep-subtype/gadt.scala index 18fbe6e10986..4d8bf9cb1a08 100644 --- a/tests/pos-deep-subtype/gadt.scala +++ b/tests/pos-deep-subtype/gadt.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror sealed trait Exp[T] case class Num(n: Int) extends Exp[Int] diff --git a/tests/pos-deep-subtype/i16899.scala b/tests/pos-deep-subtype/i16899.scala index e5acac1f927e..2b4f8a063c84 100644 --- a/tests/pos-deep-subtype/i16899.scala +++ b/tests/pos-deep-subtype/i16899.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror sealed trait Unset diff --git a/tests/pos-deep-subtype/i9736.scala b/tests/pos-deep-subtype/i9736.scala index 6ef1c42c981e..025f4c6d2db6 100644 --- a/tests/pos-deep-subtype/i9736.scala +++ b/tests/pos-deep-subtype/i9736.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror class Test { type MyCombo = Int | Unit @@ -6,4 +6,4 @@ class Test { z match case i: Int => ??? case _ => ??? -} \ No newline at end of file +} diff --git a/tests/pos-deep-subtype/i9782.scala b/tests/pos-deep-subtype/i9782.scala index 02c69a35b752..f9d093079e24 100644 --- a/tests/pos-deep-subtype/i9782.scala +++ b/tests/pos-deep-subtype/i9782.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror trait Txn[T <: Txn[T]] diff --git a/tests/pos-macros/i13405/Test.scala b/tests/pos-macros/i13405/Test.scala index b698bd875642..6a5d5c638707 100644 --- a/tests/pos-macros/i13405/Test.scala +++ b/tests/pos-macros/i13405/Test.scala @@ -1,3 +1,3 @@ -//> using options -Xfatal-warnings +//> using options -Werror @main def main: Unit = hh() diff --git a/tests/pos-macros/i21672/Test_2.scala b/tests/pos-macros/i21672/Test_2.scala index b164962100af..b1d06411b1aa 100644 --- a/tests/pos-macros/i21672/Test_2.scala +++ b/tests/pos-macros/i21672/Test_2.scala @@ -1,3 +1,3 @@ -//> using options -Xfatal-warnings +//> using options -Werror object Test: Repro() diff --git a/tests/pos/Dynamic.scala b/tests/pos/Dynamic.scala index 9f3a83468fc1..568a05d55ea6 100644 --- a/tests/pos/Dynamic.scala +++ b/tests/pos/Dynamic.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature package scala diff --git a/tests/pos/adhoc-extension/A.scala b/tests/pos/adhoc-extension/A.scala index efc0415cdc15..428b80a10bf6 100644 --- a/tests/pos/adhoc-extension/A.scala +++ b/tests/pos/adhoc-extension/A.scala @@ -1,4 +1,4 @@ -//> using options -source future -deprecation -Xfatal-warnings +//> using options -source future -deprecation -Werror package adhoc class A diff --git a/tests/pos/annot-constant/Test_2.scala b/tests/pos/annot-constant/Test_2.scala index 420b33195a45..cd58ed099d98 100644 --- a/tests/pos/annot-constant/Test_2.scala +++ b/tests/pos/annot-constant/Test_2.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature package pkg diff --git a/tests/pos/given-loop-prevention.scala b/tests/pos/given-loop-prevention.scala index f02559af1e82..0aab22dc3233 100644 --- a/tests/pos/given-loop-prevention.scala +++ b/tests/pos/given-loop-prevention.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -source 3.4 +//> using options -Werror -source 3.4 class Foo diff --git a/tests/pos/i10247.scala b/tests/pos/i10247.scala index 4268e309a4ae..496bba3df95a 100644 --- a/tests/pos/i10247.scala +++ b/tests/pos/i10247.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature // check that deprecation warnings of Red are not caught in its enclosing scope enum Color(rgb: Int) { diff --git a/tests/pos/i10259.scala b/tests/pos/i10259.scala index e8da9e6a7be7..f3a223391e6d 100644 --- a/tests/pos/i10259.scala +++ b/tests/pos/i10259.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature trait S[T] extends (T => T): def apply(x: T) = ??? diff --git a/tests/pos/i10383.scala b/tests/pos/i10383.scala index f14267a38041..5e827bbfba9f 100644 --- a/tests/pos/i10383.scala +++ b/tests/pos/i10383.scala @@ -1,3 +1,3 @@ -//> using options -source future -deprecation -Xfatal-warnings +//> using options -source future -deprecation -Werror def r = BigInt(1) to BigInt(3) // error diff --git a/tests/pos/i11729.scala b/tests/pos/i11729.scala index 79d3174dc2e9..933ddf387067 100644 --- a/tests/pos/i11729.scala +++ b/tests/pos/i11729.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature type Return[X] = X match case List[t] => List[t] diff --git a/tests/pos/i13433.scala b/tests/pos/i13433.scala index c38199e3b917..90b5b1cd718f 100644 --- a/tests/pos/i13433.scala +++ b/tests/pos/i13433.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature import scala.reflect.TypeTest diff --git a/tests/pos/i13433b.scala b/tests/pos/i13433b.scala index e8316f92e330..9ef86d0c5e24 100644 --- a/tests/pos/i13433b.scala +++ b/tests/pos/i13433b.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature import scala.reflect.ClassTag diff --git a/tests/pos/i14637.scala b/tests/pos/i14637.scala index 512471f7b19a..debeacf0464b 100644 --- a/tests/pos/i14637.scala +++ b/tests/pos/i14637.scala @@ -1,8 +1,8 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature class C object Givens: given cOrdering: Ordering[C]: override def compare(c0: C, c1: C) = 0 - val greeting = "we love Givens" \ No newline at end of file + val greeting = "we love Givens" diff --git a/tests/pos/i15166/Test_2.scala b/tests/pos/i15166/Test_2.scala index b447aacde2ab..55056d00be30 100644 --- a/tests/pos/i15166/Test_2.scala +++ b/tests/pos/i15166/Test_2.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror object Test { val x: InterfaceAudience_JAVA_ONLY_1.Public = ??? } diff --git a/tests/pos/i15474.scala b/tests/pos/i15474.scala index f2c85120e4b2..20603f397b7c 100644 --- a/tests/pos/i15474.scala +++ b/tests/pos/i15474.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror import scala.language.implicitConversions import scala.language.future diff --git a/tests/pos/i16649-irrefutable.scala b/tests/pos/i16649-irrefutable.scala index 7a5a98733922..45ef4265ccbd 100644 --- a/tests/pos/i16649-irrefutable.scala +++ b/tests/pos/i16649-irrefutable.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature import quoted.* diff --git a/tests/pos/i16808.scala b/tests/pos/i16808.scala index 43e77634a535..d0bc55b43316 100644 --- a/tests/pos/i16808.scala +++ b/tests/pos/i16808.scala @@ -1,4 +1,4 @@ -//> using options -source future -deprecation -Xfatal-warnings +//> using options -source future -deprecation -Werror def collectKeys[A, B, C](xs: Map[A, B])(f: PartialFunction[A, C]): Map[C, B] = xs.collect{ case (f(c) , b) => (c, b) } diff --git a/tests/pos/i17735.scala b/tests/pos/i17735.scala index 17fb31010a8a..2927eabadd68 100644 --- a/tests/pos/i17735.scala +++ b/tests/pos/i17735.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -Wvalue-discard +//> using options -Werror -Wvalue-discard import scala.collection.mutable import scala.annotation.nowarn diff --git a/tests/pos/i17735a.scala b/tests/pos/i17735a.scala index b4d91f8d25fc..c698be537451 100644 --- a/tests/pos/i17735a.scala +++ b/tests/pos/i17735a.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -Wvalue-discard -Wconf:msg=non-Unit:s +//> using options -Werror -Wvalue-discard -Wconf:msg=non-Unit:s import scala.collection.mutable import scala.annotation.nowarn diff --git a/tests/pos/i17741.scala b/tests/pos/i17741.scala index aa32e5a573d4..e22a1f0a882d 100644 --- a/tests/pos/i17741.scala +++ b/tests/pos/i17741.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -Wnonunit-statement +//> using options -Werror -Wnonunit-statement class Node() class Elem( diff --git a/tests/pos/i19013-a.scala b/tests/pos/i19013-a.scala index 0a6a5e2d1179..afc785f349e5 100644 --- a/tests/pos/i19013-a.scala +++ b/tests/pos/i19013-a.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror def handle[E <: Exception](f: => Unit): Option[E] = try diff --git a/tests/pos/i19013-b.scala b/tests/pos/i19013-b.scala index a4ec71654ff5..80240300783b 100644 --- a/tests/pos/i19013-b.scala +++ b/tests/pos/i19013-b.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror case class CustomException(x: Any) extends Exception("") @@ -8,4 +8,4 @@ def handle[E](f: => Unit): Option[E] = None catch case CustomException(e: E @unchecked ) => Some(e) -val r: RuntimeException = handle[RuntimeException](throw new Exception()).get \ No newline at end of file +val r: RuntimeException = handle[RuntimeException](throw new Exception()).get diff --git a/tests/pos/i19301.scala b/tests/pos/i19301.scala index a4a5a858b754..ea0549313cb0 100644 --- a/tests/pos/i19301.scala +++ b/tests/pos/i19301.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror object Extensions: infix def foo(x: String): Unit = () diff --git a/tests/pos/i21282.scala b/tests/pos/i21282.scala index a483f3763f89..a2648b1bf0ec 100644 --- a/tests/pos/i21282.scala +++ b/tests/pos/i21282.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -source:future-migration +//> using options -Werror -source:future-migration import scala.quoted.* diff --git a/tests/pos/i21749.scala b/tests/pos/i21749.scala index 6180b629f06b..1b3d54d26768 100644 --- a/tests/pos/i21749.scala +++ b/tests/pos/i21749.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -no-indent +//> using options -Werror -no-indent object Test { 1 match { diff --git a/tests/pos/i2673.scala b/tests/pos/i2673.scala index cb426cd6be0f..9544f2004bbf 100644 --- a/tests/pos/i2673.scala +++ b/tests/pos/i2673.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature package Foos diff --git a/tests/pos/i3323b.scala b/tests/pos/i3323b.scala index 0edc6177bbe9..f912ddea1dad 100644 --- a/tests/pos/i3323b.scala +++ b/tests/pos/i3323b.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature class Foo { def foo(lss: List[Int]): Unit = { diff --git a/tests/pos/i3589b.scala b/tests/pos/i3589b.scala index f4552c7f8370..4d7189335ddc 100644 --- a/tests/pos/i3589b.scala +++ b/tests/pos/i3589b.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature class Test { def test(x: 1 | 2 | 3) = (x: @annotation.switch) match { diff --git a/tests/pos/i4166.scala b/tests/pos/i4166.scala index 2ce9d018b614..8d6042294fa9 100644 --- a/tests/pos/i4166.scala +++ b/tests/pos/i4166.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature package foo { class Hello diff --git a/tests/pos/i4185.scala b/tests/pos/i4185.scala index 643f479c59b6..631379e125d1 100644 --- a/tests/pos/i4185.scala +++ b/tests/pos/i4185.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature object ord { class Ord diff --git a/tests/pos/i4674.scala b/tests/pos/i4674.scala index 3b570a74e80a..228debabc902 100644 --- a/tests/pos/i4674.scala +++ b/tests/pos/i4674.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature class Test { def test(x: String) = { diff --git a/tests/pos/i5970.scala b/tests/pos/i5970.scala index 668e42cbbad5..e287924e7b2a 100644 --- a/tests/pos/i5970.scala +++ b/tests/pos/i5970.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature object Test { case class Foo[T](t: T) diff --git a/tests/pos/i6190a.scala b/tests/pos/i6190a.scala index b6d21662389e..41a98459714c 100644 --- a/tests/pos/i6190a.scala +++ b/tests/pos/i6190a.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature case class Rule(name: String) object Rule extends (String => Rule) { diff --git a/tests/pos/i6190c.scala b/tests/pos/i6190c.scala index 37a837addb62..45a6738d0ca9 100644 --- a/tests/pos/i6190c.scala +++ b/tests/pos/i6190c.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature case class Rule(name: String) diff --git a/tests/pos/i6290.scala b/tests/pos/i6290.scala index bc3646f1e1d2..ce125e6ae572 100644 --- a/tests/pos/i6290.scala +++ b/tests/pos/i6290.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature -source:3.3 +//> using options -Werror -deprecation -feature -source:3.3 class TC { type T } diff --git a/tests/pos/i6621.scala b/tests/pos/i6621.scala index 599a75ba776e..33d3697aeb19 100644 --- a/tests/pos/i6621.scala +++ b/tests/pos/i6621.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature object Unapply { def unapply(a: Any): Option[(Int, Int)] = diff --git a/tests/pos/i7219b.scala b/tests/pos/i7219b.scala index 91dc0d136420..a31196f0eba5 100644 --- a/tests/pos/i7219b.scala +++ b/tests/pos/i7219b.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature object Foo { enum MyEnum { diff --git a/tests/pos/i7219c.scala b/tests/pos/i7219c.scala index 1ddfeca39ff1..3c23a3f935d2 100644 --- a/tests/pos/i7219c.scala +++ b/tests/pos/i7219c.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature object Foo { enum MyEnum { diff --git a/tests/pos/i7296.scala b/tests/pos/i7296.scala index 67fb3eee48a4..37c40bec8369 100644 --- a/tests/pos/i7296.scala +++ b/tests/pos/i7296.scala @@ -1,4 +1,4 @@ -//> using options -source future -deprecation -Xfatal-warnings +//> using options -source future -deprecation -Werror class Foo: private var blah: Double = 0L diff --git a/tests/pos/i8758.scala b/tests/pos/i8758.scala index ad170750c09e..1ac40d454ace 100644 --- a/tests/pos/i8758.scala +++ b/tests/pos/i8758.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature def test = "?johndoe" match { case s":$name" => println(s":name $name") diff --git a/tests/pos/i8781.scala b/tests/pos/i8781.scala index 857ff43b9c0a..54db47f37086 100644 --- a/tests/pos/i8781.scala +++ b/tests/pos/i8781.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature @main def Test = diff --git a/tests/pos/i8956.scala b/tests/pos/i8956.scala index a6937a3f2363..40fec732a9c3 100644 --- a/tests/pos/i8956.scala +++ b/tests/pos/i8956.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature type Numeric = Double | Int diff --git a/tests/pos/i9260.scala b/tests/pos/i9260.scala index cf740eb3c096..2879c4b94989 100644 --- a/tests/pos/i9260.scala +++ b/tests/pos/i9260.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature package asts diff --git a/tests/pos/i9751.scala b/tests/pos/i9751.scala index 78c9116f77d1..284239293f51 100644 --- a/tests/pos/i9751.scala +++ b/tests/pos/i9751.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature object Test { extension (x: Int) diff --git a/tests/pos/i9751b.scala b/tests/pos/i9751b.scala index bbbe8052a20c..9cb3700327a1 100644 --- a/tests/pos/i9751b.scala +++ b/tests/pos/i9751b.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature object Test { inline def f(inline x: Boolean): Unit = diff --git a/tests/pos/i9776.scala b/tests/pos/i9776.scala index 73efe2531918..ebcf585a5ef3 100644 --- a/tests/pos/i9776.scala +++ b/tests/pos/i9776.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature import scala.annotation.switch diff --git a/tests/pos/i9804.scala b/tests/pos/i9804.scala index 80b0de79b97f..8d96bbdcfacc 100644 --- a/tests/pos/i9804.scala +++ b/tests/pos/i9804.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature import scala.quoted.* diff --git a/tests/pos/into-expr.scala b/tests/pos/into-expr.scala index 8fd1a13fbfee..ecb057622f32 100644 --- a/tests/pos/into-expr.scala +++ b/tests/pos/into-expr.scala @@ -1,5 +1,5 @@ -//> using options -feature -Xfatal-warnings -preview +//> using options -feature -Werror -preview import Conversion.into diff --git a/tests/pos/into-sam.scala b/tests/pos/into-sam.scala index bb12696b9fc6..c887a824f2b8 100644 --- a/tests/pos/into-sam.scala +++ b/tests/pos/into-sam.scala @@ -1,5 +1,5 @@ -//> using options -feature -Xfatal-warnings -preview +//> using options -feature -Werror -preview import Conversion.into diff --git a/tests/pos/matchable-same-type.scala b/tests/pos/matchable-same-type.scala index 71ab788d0d16..3d6ecb51bf2b 100644 --- a/tests/pos/matchable-same-type.scala +++ b/tests/pos/matchable-same-type.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature import scala.language.`future-migration` diff --git a/tests/pos/not-looping-implicit.scala b/tests/pos/not-looping-implicit.scala index d99da915fbf4..4a231a8ebf8f 100644 --- a/tests/pos/not-looping-implicit.scala +++ b/tests/pos/not-looping-implicit.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature import scala.deriving.Mirror import scala.compiletime._ @@ -42,4 +42,4 @@ object InputValue { @main def Test = implicit lazy val inputValueSchema: Schema[InputValue] = Schema.gen - println(summon[Schema[InputValue]]) \ No newline at end of file + println(summon[Schema[InputValue]]) diff --git a/tests/pos/nowarnannot.scala b/tests/pos/nowarnannot.scala index 1710ae34b56f..eb4ca27ef7d3 100644 --- a/tests/pos/nowarnannot.scala +++ b/tests/pos/nowarnannot.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -Wvalue-discard +//> using options -Werror -Wvalue-discard case class F(i: Int) diff --git a/tests/pos/stats-in-empty-pkg.scala b/tests/pos/stats-in-empty-pkg.scala index cbfade71f8b9..a6d43006341e 100644 --- a/tests/pos/stats-in-empty-pkg.scala +++ b/tests/pos/stats-in-empty-pkg.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature def foo = 23 val bar = foo diff --git a/tests/pos/strict-pattern-bindings-3.0-migration.scala b/tests/pos/strict-pattern-bindings-3.0-migration.scala index f1d88af0c152..3cb9d2c5f485 100644 --- a/tests/pos/strict-pattern-bindings-3.0-migration.scala +++ b/tests/pos/strict-pattern-bindings-3.0-migration.scala @@ -1,6 +1,6 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature -// These tests should pass under -Xfatal-warnings with source version less than 3.2 +// These tests should pass under -Werror with source version less than 3.2 import language.`3.0-migration` object Test: diff --git a/tests/pos/strict-pattern-bindings-3.1.scala b/tests/pos/strict-pattern-bindings-3.1.scala index bb912204e38a..a4deff26d5db 100644 --- a/tests/pos/strict-pattern-bindings-3.1.scala +++ b/tests/pos/strict-pattern-bindings-3.1.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature // These tests should pass under -Xfatal-warnings with source version less than 3.2 import language.`3.1` diff --git a/tests/pos/switches.scala b/tests/pos/switches.scala index beb378debb40..4e6770ca8b46 100644 --- a/tests/pos/switches.scala +++ b/tests/pos/switches.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature import scala.annotation.switch diff --git a/tests/pos/t6595.scala b/tests/pos/t6595.scala index b89c8f97308f..3ae9f44e50d3 100644 --- a/tests/pos/t6595.scala +++ b/tests/pos/t6595.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature import scala.annotation.switch diff --git a/tests/pos/t6963c.scala b/tests/pos/t6963c.scala index 6effd4082065..156af48ef857 100644 --- a/tests/pos/t6963c.scala +++ b/tests/pos/t6963c.scala @@ -1,4 +1,4 @@ -//> using options -Xmigration:2.9 -Xfatal-warnings +//> using options -Xmigration:2.9 -Werror // import collection.Seq object Test { diff --git a/tests/pos/tasty-parent-unapply.scala b/tests/pos/tasty-parent-unapply.scala index 0f882ee060d8..10eab77ea6b0 100644 --- a/tests/pos/tasty-parent-unapply.scala +++ b/tests/pos/tasty-parent-unapply.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature import scala.quoted.* diff --git a/tests/pos/type-test-matchable.scala b/tests/pos/type-test-matchable.scala index 579af12fa2e7..f6a937a9c985 100644 --- a/tests/pos/type-test-matchable.scala +++ b/tests/pos/type-test-matchable.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature import scala.language.`future-migration` import scala.reflect.TypeTest diff --git a/tests/pos/unchecked-scrutinee.scala b/tests/pos/unchecked-scrutinee.scala index 72fcd3da14e4..b446a2b8b954 100644 --- a/tests/pos/unchecked-scrutinee.scala +++ b/tests/pos/unchecked-scrutinee.scala @@ -1,7 +1,7 @@ -//> using options -Xfatal-warnings -deprecation -feature +//> using options -Werror -deprecation -feature object Test { (List(1: @unchecked, 2, 3): @unchecked) match { case a :: as => } -} \ No newline at end of file +} diff --git a/tests/pos/xfatalWarnings.scala b/tests/pos/xfatalWarnings.scala index ba278fc87aa3..c34c23a883dc 100644 --- a/tests/pos/xfatalWarnings.scala +++ b/tests/pos/xfatalWarnings.scala @@ -1,4 +1,4 @@ -//> using options -nowarn -Xfatal-warnings +//> using options -nowarn -Werror // succeeds despite -Xfatal-warnings because of -nowarn object xfatalWarnings { diff --git a/tests/run/convertible.scala b/tests/run/convertible.scala index bf1a41234b17..4525e52e654e 100644 --- a/tests/run/convertible.scala +++ b/tests/run/convertible.scala @@ -1,4 +1,4 @@ -//> using options -feature -Xfatal-warnings -preview +//> using options -feature -Werror -preview import Conversion.into diff --git a/tests/run/i11050.scala b/tests/run/i11050.scala index 34613fdaf5fd..b5d1df16b14d 100644 --- a/tests/run/i11050.scala +++ b/tests/run/i11050.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror import scala.compiletime.* import scala.deriving.* diff --git a/tests/run/i6716.scala b/tests/run/i6716.scala index c0678c51fb30..db67bf4325a6 100644 --- a/tests/run/i6716.scala +++ b/tests/run/i6716.scala @@ -1,4 +1,4 @@ -//> using options -Xfatal-warnings +//> using options -Werror trait Monad[T]: def id: String @@ -15,4 +15,4 @@ object Bar { object Test extends App { println(summon[Monad[Foo]].id) println(summon[Monad[Bar]].id) -} \ No newline at end of file +} diff --git a/tests/warn/implicit-conversions-old.scala b/tests/warn/implicit-conversions-old.scala index 24e1124015e3..9781fb16f61d 100644 --- a/tests/warn/implicit-conversions-old.scala +++ b/tests/warn/implicit-conversions-old.scala @@ -5,15 +5,15 @@ class B object A { - implicit def a2b(x: A): B = ??? // warn under -Xfatal-warnings -feature + implicit def a2b(x: A): B = ??? // warn under -Werror -feature - implicit def b2a(x: B): A = ??? // warn under -Xfatal-warnings -feature + implicit def b2a(x: B): A = ??? // warn under -Werror -feature } class C object D { - implicit def a2c(x: A): C = ??? // warn under -Xfatal-warnings -feature + implicit def a2c(x: A): C = ??? // warn under -Werror -feature } object Test { @@ -22,4 +22,4 @@ object Test { val x1: A = new B val x2: B = new A // ok, since it's an old-style comversion val x3: C = new A // ok, since it's an old-style comversion -} \ No newline at end of file +} diff --git a/tests/warn/implicit-conversions.scala b/tests/warn/implicit-conversions.scala index 2896d7dc4447..b6db0dc4f270 100644 --- a/tests/warn/implicit-conversions.scala +++ b/tests/warn/implicit-conversions.scala @@ -25,7 +25,7 @@ object D { object Test { import D.given - val x1: A = new B // warn under -Xfatal-warnings -feature - val x2: B = new A // warn under -Xfatal-warnings -feature - val x3: C = new A // warn under -Xfatal-warnings -feature -} \ No newline at end of file + val x1: A = new B // warn under -Werror -feature + val x2: B = new A // warn under -Werror -feature + val x3: C = new A // warn under -Werror -feature +} diff --git a/tests/warn/strict-pattern-bindings-3.2.scala b/tests/warn/strict-pattern-bindings-3.2.scala index e4df8e770a01..beb2e4d6a771 100644 --- a/tests/warn/strict-pattern-bindings-3.2.scala +++ b/tests/warn/strict-pattern-bindings-3.2.scala @@ -1,5 +1,5 @@ -// These tests should fail under -Xfatal-warnings with source version source version 3.2 or later +// These tests should fail under -Werror with source version source version 3.2 or later import language.`3.2` object Test: @@ -34,4 +34,4 @@ object Test: object Triple { def unapply(t: (Int, Int, Int)): (Int, Int, Int) = t } val Positive(p) = 5 // warn - val Some(s1) = Option(1) // warn \ No newline at end of file + val Some(s1) = Option(1) // warn