diff options
author | Som Snytt <som.snytt@gmail.com> | 2014-05-22 09:02:18 -0700 |
---|---|---|
committer | Som Snytt <som.snytt@gmail.com> | 2014-07-08 21:28:35 -0700 |
commit | 2103dbc5230ddf2a369389f179f4ef70eae344f2 (patch) | |
tree | 28c5cd4446ea34018daf746760d896c39388f58c /test/files/neg | |
parent | d1fa9ac2dc8a9432925e3c7fb4d63e62bdc98a29 (diff) | |
download | scala-2103dbc5230ddf2a369389f179f4ef70eae344f2.tar.gz scala-2103dbc5230ddf2a369389f179f4ef70eae344f2.tar.bz2 scala-2103dbc5230ddf2a369389f179f4ef70eae344f2.zip |
SI-8610 -Xlint is multichoice option
Make -Xlint a "multichoice" option for purposes of option parsing.
This allows turning on "lint with these warnings" instead of only
"turn off these warnings but enable other lint warnings".
```
$ scalac -Xlint:warn-adapted-args linty.scala # lint plus a warning
$ scalac -Xlint warn-adapted-args linty.scala # same
$ scalac -Xlint linty.scala # same as now
$ scalac -Xlint -- linty.scala # ok, not necessary
$ scalac -Xlint _ -- linty.scala # another funky underscore
```
This would also enable Xlint options that are not standalone options,
although that is not implemented in this commit. For example,
`-Xlint:no-missing-interpolator` could be used to disable that
warning. (There is no `-Xoption:flavor=off` syntax.) (`no-` switches
would not be enabled by `_`.)
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/t8610-arg.check | 9 | ||||
-rw-r--r-- | test/files/neg/t8610-arg.flags | 1 | ||||
-rw-r--r-- | test/files/neg/t8610-arg.scala | 7 | ||||
-rw-r--r-- | test/files/neg/t8610.check | 15 | ||||
-rw-r--r-- | test/files/neg/t8610.flags | 1 | ||||
-rw-r--r-- | test/files/neg/t8610.scala | 7 |
6 files changed, 40 insertions, 0 deletions
diff --git a/test/files/neg/t8610-arg.check b/test/files/neg/t8610-arg.check new file mode 100644 index 0000000000..f2879b0d45 --- /dev/null +++ b/test/files/neg/t8610-arg.check @@ -0,0 +1,9 @@ +t8610-arg.scala:3: warning: `$name` looks like an interpolated identifier! Did you forget the interpolator? + def x = "Hi, $name" // missing interp + ^ +t8610-arg.scala:6: warning: side-effecting nullary methods are discouraged: suggest defining as `def u()` instead + def u: Unit = () // unitarian universalist + ^ +error: No warnings can be incurred under -Xfatal-warnings. +two warnings found +one error found diff --git a/test/files/neg/t8610-arg.flags b/test/files/neg/t8610-arg.flags new file mode 100644 index 0000000000..f8867a7b4e --- /dev/null +++ b/test/files/neg/t8610-arg.flags @@ -0,0 +1 @@ +-Xfatal-warnings -Xlint warn-nullary-unit diff --git a/test/files/neg/t8610-arg.scala b/test/files/neg/t8610-arg.scala new file mode 100644 index 0000000000..494a3354da --- /dev/null +++ b/test/files/neg/t8610-arg.scala @@ -0,0 +1,7 @@ + +case class X(name: String) { + def x = "Hi, $name" // missing interp + def f(p: (Int, Int)): Int = p._1 * p._2 + def g = f(3, 4) // adapted + def u: Unit = () // unitarian universalist +} diff --git a/test/files/neg/t8610.check b/test/files/neg/t8610.check new file mode 100644 index 0000000000..7a18e55127 --- /dev/null +++ b/test/files/neg/t8610.check @@ -0,0 +1,15 @@ +t8610.scala:3: warning: `$name` looks like an interpolated identifier! Did you forget the interpolator? + def x = "Hi, $name" // missing interp + ^ +t8610.scala:5: warning: Adapting argument list by creating a 2-tuple: this may not be what you want. + signature: X.f(p: (Int, Int)): Int + given arguments: 3, 4 + after adaptation: X.f((3, 4): (Int, Int)) + def g = f(3, 4) // adapted + ^ +t8610.scala:6: warning: side-effecting nullary methods are discouraged: suggest defining as `def u()` instead + def u: Unit = () // unitarian universalist + ^ +error: No warnings can be incurred under -Xfatal-warnings. +three warnings found +one error found diff --git a/test/files/neg/t8610.flags b/test/files/neg/t8610.flags new file mode 100644 index 0000000000..954eaba352 --- /dev/null +++ b/test/files/neg/t8610.flags @@ -0,0 +1 @@ +-Xfatal-warnings -Xlint diff --git a/test/files/neg/t8610.scala b/test/files/neg/t8610.scala new file mode 100644 index 0000000000..494a3354da --- /dev/null +++ b/test/files/neg/t8610.scala @@ -0,0 +1,7 @@ + +case class X(name: String) { + def x = "Hi, $name" // missing interp + def f(p: (Int, Int)): Int = p._1 * p._2 + def g = f(3, 4) // adapted + def u: Unit = () // unitarian universalist +} |