From b1a81bb5b99caa984d6cb158ca76e463086399f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pa=C5=82ka?= Date: Wed, 20 Nov 2024 10:34:01 +0100 Subject: [PATCH] fix: Closes #18367 `-Wconf` options are processed incorrectly [Cherry-picked 16dd58fe67965e515366c41d82cbe6bfd6f3ba8e][modified] --- compiler/src/dotty/tools/dotc/reporting/WConf.scala | 2 +- compiler/test/dotty/tools/dotc/config/ScalaSettingsTests.scala | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/reporting/WConf.scala b/compiler/src/dotty/tools/dotc/reporting/WConf.scala index 6766af1e46f4..ed69dadeb897 100644 --- a/compiler/src/dotty/tools/dotc/reporting/WConf.scala +++ b/compiler/src/dotty/tools/dotc/reporting/WConf.scala @@ -119,7 +119,7 @@ object WConf: def fromSettings(settings: List[String]): Either[List[String], WConf] = if (settings.isEmpty) Right(WConf(Nil)) else - val parsedConfs: List[Either[List[String], (List[MessageFilter], Action)]] = settings.map(conf => + val parsedConfs: List[Either[List[String], (List[MessageFilter], Action)]] = settings.reverse.map(conf => val filtersAndAction = conf.split(':') if filtersAndAction.length != 2 then Left(List("exactly one `:` expected (&...&:)")) else diff --git a/compiler/test/dotty/tools/dotc/config/ScalaSettingsTests.scala b/compiler/test/dotty/tools/dotc/config/ScalaSettingsTests.scala index c36823dce987..391edde9dfe1 100644 --- a/compiler/test/dotty/tools/dotc/config/ScalaSettingsTests.scala +++ b/compiler/test/dotty/tools/dotc/config/ScalaSettingsTests.scala @@ -89,7 +89,6 @@ class ScalaSettingsTests: val nowr = new Diagnostic.Warning("This is a problem.".toMessage, util.NoSourcePosition) assertEquals(Action.Silent, sut.action(nowr)) - @Ignore("LTS backport rejected: https://github.com/scala/scala3/pull/18503") @Test def `i18367 rightmost WConf flags take precedence over flags to the left`: Unit = import reporting.{Action, Diagnostic} val sets = new ScalaSettings @@ -186,7 +185,6 @@ class ScalaSettingsTests: ) ) - @Ignore("LTS backport rejected: https://github.com/scala/scala3/pull/18503") @Test def `WConf src filter can be mixed with other filters with rightmost taking precedence`: Unit = val result = wconfSrcFilterTest( argsStr = "-Wconf:src=.*:s,cat=deprecation:e",