summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/files/neg/t8610-arg.check14
-rw-r--r--test/files/neg/t8610-arg.flags2
-rw-r--r--test/files/run/t8610.check6
-rw-r--r--test/junit/scala/tools/nsc/settings/SettingsTest.scala24
4 files changed, 11 insertions, 35 deletions
diff --git a/test/files/neg/t8610-arg.check b/test/files/neg/t8610-arg.check
index ea2805508d..d6fe207119 100644
--- a/test/files/neg/t8610-arg.check
+++ b/test/files/neg/t8610-arg.check
@@ -1,18 +1,6 @@
-t8610-arg.scala:5: warning: possible missing interpolator: detected interpolated identifier `$name`
- def x = "Hi, $name" // missing interp
- ^
-t8610-arg.scala:7: 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-arg.scala:9: warning: private[this] value name in class X shadows mutable name inherited from class Named. Changes to name will not be visible within class X - you may want to give them distinct names.
- override def toString = name // shadowing mutable var name
- ^
t8610-arg.scala:8: 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.
-four warnings found
+one warning found
one error found
diff --git a/test/files/neg/t8610-arg.flags b/test/files/neg/t8610-arg.flags
index f8867a7b4e..f331ba9383 100644
--- a/test/files/neg/t8610-arg.flags
+++ b/test/files/neg/t8610-arg.flags
@@ -1 +1 @@
--Xfatal-warnings -Xlint warn-nullary-unit
+-Xfatal-warnings -Xlint nullary-unit
diff --git a/test/files/run/t8610.check b/test/files/run/t8610.check
index fde82d5109..b3ab7a9cef 100644
--- a/test/files/run/t8610.check
+++ b/test/files/run/t8610.check
@@ -1,13 +1,7 @@
-t8610.scala:4: warning: possible missing interpolator: detected interpolated identifier `$name`
- def x = "Hi, $name" // missing interp
- ^
t8610.scala:6: 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:7: warning: side-effecting nullary methods are discouraged: suggest defining as `def u()` instead
- def u: Unit = () // unitarian universalist
- ^
Hi, $name
diff --git a/test/junit/scala/tools/nsc/settings/SettingsTest.scala b/test/junit/scala/tools/nsc/settings/SettingsTest.scala
index 9203054d9a..960d7f8ac1 100644
--- a/test/junit/scala/tools/nsc/settings/SettingsTest.scala
+++ b/test/junit/scala/tools/nsc/settings/SettingsTest.scala
@@ -38,29 +38,23 @@ class SettingsTest {
assertFalse(check("-Yinline:false", "-optimise").value)
}
- @Test def userSettingsHavePrecedenceOverLint() {
- def check(args: String*): MutableSettings#BooleanSetting = {
- val s = new MutableSettings(msg => throw new IllegalArgumentException(msg))
- val (ok, residual) = s.processArguments(args.toList, processAll = true)
- assert(residual.isEmpty)
- s.warnAdaptedArgs // among Xlint
- }
- assertTrue(check("-Xlint").value)
- assertFalse(check("-Xlint", "-Ywarn-adapted-args:false").value)
- assertFalse(check("-Ywarn-adapted-args:false", "-Xlint").value)
- }
-
- def check(args: String*)(b: MutableSettings => MutableSettings#BooleanSetting): MutableSettings#BooleanSetting = {
+ // for the given args, select the desired setting
+ private def check(args: String*)(b: MutableSettings => MutableSettings#BooleanSetting): MutableSettings#BooleanSetting = {
val s = new MutableSettings(msg => throw new IllegalArgumentException(msg))
val (ok, residual) = s.processArguments(args.toList, processAll = true)
assert(residual.isEmpty)
b(s)
}
+ @Test def userSettingsHavePrecedenceOverLint() {
+ assertTrue(check("-Xlint")(_.warnAdaptedArgs))
+ assertFalse(check("-Xlint", "-Ywarn-adapted-args:false")(_.warnAdaptedArgs))
+ assertFalse(check("-Ywarn-adapted-args:false", "-Xlint")(_.warnAdaptedArgs))
+ }
+
@Test def anonymousLintersCanBeNamed() {
assertTrue(check("-Xlint")(_.warnMissingInterpolator)) // among Xlint
assertFalse(check("-Xlint:-missing-interpolator")(_.warnMissingInterpolator))
assertFalse(check("-Xlint:-missing-interpolator", "-Xlint")(_.warnMissingInterpolator))
- // two lint settings are first come etc; unlike -Y
- assertTrue(check("-Xlint", "-Xlint:-missing-interpolator")(_.warnMissingInterpolator))
+ assertFalse(check("-Xlint", "-Xlint:-missing-interpolator")(_.warnMissingInterpolator))
}
}