diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2014-09-03 09:38:36 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@gmail.com> | 2014-09-08 21:37:34 +0200 |
commit | 861ad72b59c5ea7856b2853c092aaeb15453caea (patch) | |
tree | cb8b42bcc3f137f3c150a570ea257142a866e574 /src/compiler/scala/tools/nsc/settings/Warnings.scala | |
parent | 7655a70489f565a5a7a165f893b4a1e44c3cb2b8 (diff) | |
download | scala-861ad72b59c5ea7856b2853c092aaeb15453caea.tar.gz scala-861ad72b59c5ea7856b2853c092aaeb15453caea.tar.bz2 scala-861ad72b59c5ea7856b2853c092aaeb15453caea.zip |
Address PR feedback, fix MultiChoiceSetting.contains
Diffstat (limited to 'src/compiler/scala/tools/nsc/settings/Warnings.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/settings/Warnings.scala | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/src/compiler/scala/tools/nsc/settings/Warnings.scala b/src/compiler/scala/tools/nsc/settings/Warnings.scala index 574825874d..c400e8c29c 100644 --- a/src/compiler/scala/tools/nsc/settings/Warnings.scala +++ b/src/compiler/scala/tools/nsc/settings/Warnings.scala @@ -58,7 +58,7 @@ trait Warnings { val PackageObjectClasses = LintWarning("package-object-classes", "Class or object defined in package object.") val UnsoundMatch = LintWarning("unsound-match", "Pattern match may not be typesafe.") - def allWarnings = values.toSeq.asInstanceOf[Seq[LintWarning]] + def allLintWarnings = values.toSeq.asInstanceOf[Seq[LintWarning]] } import LintWarnings._ @@ -91,24 +91,19 @@ trait Warnings { def YwarnInferAny = warnInferAny // The Xlint warning group. - val lint: MultiChoiceSetting[LintWarnings.type] = { - import LintWarnings._ - - allWarnings.sortBy(_.name) foreach { - case l: LintWarning if l.yAliased => - BooleanSetting(s"-Ywarn-${l.name}", {l.help}) withPostSetHook { s => - lint.add(if (s) l.name else s"-${l.name}") - } // withDeprecationMessage s"Enable -Xlint:${c._1}" - case _ => - } - - MultiChoiceSetting( - name = "-Xlint", - helpArg = "warning", - descr = "Enable or disable specific warnings", - domain = LintWarnings, - default = Some(List("_")) - ) + val lint = MultiChoiceSetting( + name = "-Xlint", + helpArg = "warning", + descr = "Enable or disable specific warnings", + domain = LintWarnings, + default = Some(List("_"))) + + allLintWarnings foreach { + case w if w.yAliased => + BooleanSetting(s"-Ywarn-${w.name}", {w.help}) withPostSetHook { s => + lint.add(if (s) w.name else s"-${w.name}") + } // withDeprecationMessage s"Enable -Xlint:${c._1}" + case _ => } private lazy val warnSelectNullable = BooleanSetting("-Xcheck-null", "This option is obsolete and does nothing.") |