Skip to content

Commit 653d3e4

Browse files
authored
Merge pull request scala#10708 from som-snytt/tweak/wconf
-Wconf:x,y is -Wconf:x -Wconf:y
2 parents dd71307 + aeaacf8 commit 653d3e4

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

src/compiler/scala/tools/nsc/Reporting.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,6 +515,7 @@ object Reporting {
515515
def includes(o: WarningCategory): Boolean = this eq o
516516
def summaryCategory: WarningCategory = this
517517
lazy val name: String = WarningCategory.nameOf(this)
518+
override def toString = name
518519
}
519520

520521
object WarningCategory {
@@ -717,7 +718,7 @@ object Reporting {
717718
}
718719

719720
object MessageFilter {
720-
object Any extends MessageFilter {
721+
case object Any extends MessageFilter {
721722
def matches(message: Message): Boolean = true
722723
}
723724

@@ -763,7 +764,9 @@ object Reporting {
763764
}
764765
}
765766

766-
sealed trait Action
767+
sealed trait Action {
768+
override def toString = s"Action[${getClass.getSimpleName.stripSuffix("$")}]"
769+
}
767770

768771
object Action {
769772
object Error extends Action

src/compiler/scala/tools/nsc/settings/MutableSettings.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ class MutableSettings(val errorFn: String => Unit, val pathFactory: PathFactory)
701701
}
702702

703703
def tryToSet(args: List[String]) = tryToSetArgs(args, halting = true)
704-
def tryToSetColon(args: List[String]) = tryToSetArgs(args, halting = false)
704+
def tryToSetColon(args: List[String]) = tryToSetArgs(args, halting = false)
705705
override def tryToSetFromPropertyValue(s: String) = tryToSet(s.trim.split(',').toList) // used from ide
706706

707707
/** Try to set args, handling "help" and default.
@@ -823,12 +823,12 @@ class MutableSettings(val errorFn: String => Unit, val pathFactory: PathFactory)
823823
case Nil => (seen, Nil)
824824
}
825825
val (seen, rest) = loop(Nil, args)
826-
if (prepend) value = value.prependedAll(seen.reverse)
826+
if (prepend) value = value.prependedAll(seen)
827827
else value = value.appendedAll(seen.reverse)
828828
Some(rest)
829829
}
830830
def tryToSet(args: List[String]) = tryToSetArgs(args, halting = true)
831-
def tryToSetColon(args: List[String]) = tryToSetArgs(args, halting = false)
831+
def tryToSetColon(args: List[String]) = tryToSetArgs(args, halting = false)
832832
override def tryToSetFromPropertyValue(s: String) = tryToSet(s.trim.split(',').toList) // used from ide
833833

834834
def clear(): Unit = (v = Nil)

src/compiler/scala/tools/nsc/settings/Warnings.scala

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,13 @@ trait Warnings {
8282
|The default configuration is:
8383
| -Wconf:${WconfDefault.mkString(",")}
8484
|
85-
|User-defined configurations are added to the left. The leftmost rule matching
86-
|a warning message defines the action.
85+
|Under -Xsource:3-cross, the category of scala3-migration warnings are errors by default:
86+
| -Wconf:cat=scala3-migration:e
87+
|Under -Xsource:3-migration, they are warnings:
88+
| -Wconf:cat=scala3-migration:w
89+
|
90+
|User-defined configurations override previous settings, such that the last matching
91+
|configuration defines the action for a given diagnostic message.
8792
|
8893
|Examples:
8994
| - change every warning into an error: -Wconf:any:error

test/junit/scala/tools/nsc/reporters/WConfTest.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@ class WConfTest extends BytecodeTesting {
215215
def lint(): Unit = {
216216
check(infos(code, "cat=lint:i"), Nil)
217217
check(infos(code, "cat=lint:i", lint = true), List(l2, l23))
218-
check(reports(code, "any:s,cat=lint:ws", lint = true), Nil)
219-
check(reports(code, "cat=lint:ws,any:s", lint = true), List((-1, "2 lint warnings")))
218+
check(reports(code, "any:s,cat=lint:ws", lint = true), List((-1, "2 lint warnings")))
219+
check(reports(code, "cat=lint:ws,any:s", lint = true), Nil)
220220
check(infos(code, "cat=lint-deprecation:i", lint = true), List(l2))
221221
check(infos(code, "cat=lint-adapted-args:i", lint = true), List(l23))
222222
}

0 commit comments

Comments
 (0)