Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

-Wconf:x,y is -Wconf:x -Wconf:y #10708

Open
wants to merge 2 commits into
base: 2.13.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/compiler/scala/tools/nsc/Reporting.scala
Expand Up @@ -522,6 +522,7 @@ object Reporting {
def includes(o: WarningCategory): Boolean = this eq o
def summaryCategory: WarningCategory = this
lazy val name: String = WarningCategory.nameOf(this)
override def toString = name
}

object WarningCategory {
Expand Down Expand Up @@ -722,7 +723,7 @@ object Reporting {
}

object MessageFilter {
object Any extends MessageFilter {
case object Any extends MessageFilter {
def matches(message: Message): Boolean = true
}

Expand Down Expand Up @@ -768,7 +769,9 @@ object Reporting {
}
}

sealed trait Action
sealed trait Action {
override def toString = s"Action[${getClass.getSimpleName.stripSuffix("$")}]"
}

object Action {
object Error extends Action
Expand Down
6 changes: 3 additions & 3 deletions src/compiler/scala/tools/nsc/settings/MutableSettings.scala
Expand Up @@ -700,7 +700,7 @@ class MutableSettings(val errorFn: String => Unit, val pathFactory: PathFactory)
}

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

/** Try to set args, handling "help" and default.
Expand Down Expand Up @@ -822,12 +822,12 @@ class MutableSettings(val errorFn: String => Unit, val pathFactory: PathFactory)
case Nil => (seen, Nil)
}
val (seen, rest) = loop(Nil, args)
if (prepend) value = value.prependedAll(seen.reverse)
if (prepend) value = value.prependedAll(seen)
else value = value.appendedAll(seen.reverse)
Some(rest)
}
def tryToSet(args: List[String]) = tryToSetArgs(args, halting = true)
def tryToSetColon(args: List[String]) = tryToSetArgs(args, halting = false)
def tryToSetColon(args: List[String]) = tryToSetArgs(args, halting = false)
override def tryToSetFromPropertyValue(s: String) = tryToSet(s.trim.split(',').toList) // used from ide

def clear(): Unit = (v = Nil)
Expand Down
9 changes: 7 additions & 2 deletions src/compiler/scala/tools/nsc/settings/Warnings.scala
Expand Up @@ -82,8 +82,13 @@ trait Warnings {
|The default configuration is:
| -Wconf:${WconfDefault.mkString(",")}
|
|User-defined configurations are added to the left. The leftmost rule matching
|a warning message defines the action.
|Under -Xsource:3-cross, the category of scala3-migration warnings are errors by default:
| -Wconf:cat=scala3-migration:e
|Under -Xsource:3-migration, they are warnings:
| -Wconf:cat=scala3-migration:w
|
|User-defined configurations override previous settings, such that the last matching
|configuration defines the action for a given diagnostic message.
|
|Examples:
| - change every warning into an error: -Wconf:any:error
Expand Down
4 changes: 2 additions & 2 deletions test/junit/scala/tools/nsc/reporters/WConfTest.scala
Expand Up @@ -215,8 +215,8 @@ class WConfTest extends BytecodeTesting {
def lint(): Unit = {
check(infos(code, "cat=lint:i"), Nil)
check(infos(code, "cat=lint:i", lint = true), List(l2, l23))
check(reports(code, "any:s,cat=lint:ws", lint = true), Nil)
check(reports(code, "cat=lint:ws,any:s", lint = true), List((-1, "2 lint warnings")))
check(reports(code, "any:s,cat=lint:ws", lint = true), List((-1, "2 lint warnings")))
check(reports(code, "cat=lint:ws,any:s", lint = true), Nil)
check(infos(code, "cat=lint-deprecation:i", lint = true), List(l2))
check(infos(code, "cat=lint-adapted-args:i", lint = true), List(l23))
}
Expand Down