diff options
author | Som Snytt <som.snytt@gmail.com> | 2014-07-16 11:01:31 -0700 |
---|---|---|
committer | Som Snytt <som.snytt@gmail.com> | 2014-07-16 23:52:27 -0700 |
commit | f81ec8d1f6481ddacfb27e743c6c58961e765f0e (patch) | |
tree | 95becbb83f676c4044aca1239916464279c16820 /src/compiler/scala/tools/nsc/settings/MutableSettings.scala | |
parent | 04cb634ec4564c6ee3bd34c3cef899537c3787ba (diff) | |
download | scala-f81ec8d1f6481ddacfb27e743c6c58961e765f0e.tar.gz scala-f81ec8d1f6481ddacfb27e743c6c58961e765f0e.tar.bz2 scala-f81ec8d1f6481ddacfb27e743c6c58961e765f0e.zip |
SI-8525 Clarify usage of -Xlint:_,flag
Also clarify usage of -Xlint flag.
Align more with javac -Xlint:all,-flag,flag where once a flag is
explicitly enabled it cannot be disabled, but where the wildcard
is a backstop only. (There is no all option yet here.)
-Xlint and -Xlint:_ just set a flag which is consulted by any
unset lint warning.
Xlint warnings consult the state of Xlint when they are unset.
Individual -Ywarn-ings do not.
Other warnings are explicitly set to false. They can only be
enabled programmatically.
Some tests are corrected. Also, option order is no longer
significant, see the unit test.
Diffstat (limited to 'src/compiler/scala/tools/nsc/settings/MutableSettings.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/settings/MutableSettings.scala | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/settings/MutableSettings.scala b/src/compiler/scala/tools/nsc/settings/MutableSettings.scala index dc49e8b822..0dd4ae0b3b 100644 --- a/src/compiler/scala/tools/nsc/settings/MutableSettings.scala +++ b/src/compiler/scala/tools/nsc/settings/MutableSettings.scala @@ -567,13 +567,12 @@ class MutableSettings(val errorFn: String => Unit) def badChoice(s: String, n: String) = errorFn(s"'$s' is not a valid choice for '$name'") def choosing = choices.nonEmpty def isChoice(s: String) = (s == "_") || (choices contains (s stripPrefix "-")) - def wildcards = choices // filter (!_.isSetByUser) override protected def tts(args: List[String], halting: Boolean) = { - val total = collection.mutable.ListBuffer.empty[String] ++ value + val added = collection.mutable.ListBuffer.empty[String] def tryArg(arg: String) = arg match { - case "_" if choosing => wildcards foreach (total += _) - case s if !choosing || isChoice(s) => total += s + case "_" if choosing => default() + case s if !choosing || isChoice(s) => added += s case s => badChoice(s, name) } def stoppingAt(arg: String) = (arg startsWith "-") || (choosing && !isChoice(arg)) @@ -584,7 +583,7 @@ class MutableSettings(val errorFn: String => Unit) } val rest = loop(args) if (rest.size == args.size) default() // if no arg consumed, trigger default action - else value = total.toList // update once + else value = added.toList // update all new settings at once Some(rest) } } |