diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2014-09-02 16:33:48 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@gmail.com> | 2014-09-02 16:33:48 +0200 |
commit | f196ee2ee7807f007d2397a4d6168800900ae7fa (patch) | |
tree | 475de2822a89d25217acc0b7ff0fbc7f3d798519 /test/files/neg | |
parent | 61dbf4ac711094db38a4b2dfb853d88499c2b1a5 (diff) | |
parent | 01f2d279e84fda300176e83ee94c17c08ad1dc3f (diff) | |
download | scala-f196ee2ee7807f007d2397a4d6168800900ae7fa.tar.gz scala-f196ee2ee7807f007d2397a4d6168800900ae7fa.tar.bz2 scala-f196ee2ee7807f007d2397a4d6168800900ae7fa.zip |
Merge commit '01f2d27' into merge/2.11-to-2.12-is-it-really-sept-2-already-where-was-summer
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/forgot-interpolator.check | 16 | ||||
-rw-r--r-- | test/files/neg/t4851.flags | 2 | ||||
-rw-r--r-- | test/files/neg/t7848-interp-warn.check | 6 | ||||
-rw-r--r-- | test/files/neg/t8035-no-adapted-args.check | 21 | ||||
-rw-r--r-- | test/files/neg/t8035-no-adapted-args.flags | 1 | ||||
-rw-r--r-- | test/files/neg/t8035-no-adapted-args.scala | 6 | ||||
-rw-r--r-- | test/files/neg/t8525.check | 15 | ||||
-rw-r--r-- | test/files/neg/t8525.flags | 1 | ||||
-rw-r--r-- | test/files/neg/t8525.scala | 10 | ||||
-rw-r--r-- | test/files/neg/t8610-arg.check | 6 | ||||
-rw-r--r-- | test/files/neg/t8610-arg.flags | 1 | ||||
-rw-r--r-- | test/files/neg/t8610-arg.scala | 10 | ||||
-rw-r--r-- | test/files/neg/t8610.check | 18 | ||||
-rw-r--r-- | test/files/neg/t8610.flags | 1 | ||||
-rw-r--r-- | test/files/neg/t8610.scala | 10 | ||||
-rw-r--r-- | test/files/neg/t8736-c.check | 11 | ||||
-rw-r--r-- | test/files/neg/t8736-c.flags | 1 | ||||
-rw-r--r-- | test/files/neg/t8736-c.scala | 7 | ||||
-rw-r--r-- | test/files/neg/warn-inferred-any.flags | 2 |
19 files changed, 132 insertions, 13 deletions
diff --git a/test/files/neg/forgot-interpolator.check b/test/files/neg/forgot-interpolator.check index 8988458982..8e75350518 100644 --- a/test/files/neg/forgot-interpolator.check +++ b/test/files/neg/forgot-interpolator.check @@ -1,25 +1,25 @@ -forgot-interpolator.scala:4: warning: `$bippy` looks like an interpolated identifier! Did you forget the interpolator? +forgot-interpolator.scala:4: warning: possible missing interpolator: detected interpolated identifier `$bippy` def f = "Put the $bippy in the $bippy!" // warn 1 ^ -forgot-interpolator.scala:14: warning: That looks like an interpolated expression! Did you forget the interpolator? +forgot-interpolator.scala:14: warning: possible missing interpolator: detected an interpolated expression def f = """Put the ${println("bippy")} in the bippy!""" // warn 2 ^ -forgot-interpolator.scala:30: warning: `$beppo` looks like an interpolated identifier! Did you forget the interpolator? +forgot-interpolator.scala:30: warning: possible missing interpolator: detected interpolated identifier `$beppo` def f = "$beppo was a marx bros who saw dollars." // warn 3 ^ -forgot-interpolator.scala:34: warning: `$aleppo` looks like an interpolated identifier! Did you forget the interpolator? +forgot-interpolator.scala:34: warning: possible missing interpolator: detected interpolated identifier `$aleppo` def f = "$aleppo is a pepper and a city." // warn 4 ^ -forgot-interpolator.scala:47: warning: `$hippo` looks like an interpolated identifier! Did you forget the interpolator? +forgot-interpolator.scala:47: warning: possible missing interpolator: detected interpolated identifier `$hippo` def h = "$hippo takes an implicit" // warn 6 ^ -forgot-interpolator.scala:88: warning: `$groucho` looks like an interpolated identifier! Did you forget the interpolator? +forgot-interpolator.scala:88: warning: possible missing interpolator: detected interpolated identifier `$groucho` def f2 = "I salute $groucho" // warn 7 ^ -forgot-interpolator.scala:89: warning: `$dingo` looks like an interpolated identifier! Did you forget the interpolator? +forgot-interpolator.scala:89: warning: possible missing interpolator: detected interpolated identifier `$dingo` def f3 = "I even salute $dingo" // warn 8 ^ -forgot-interpolator.scala:90: warning: `$calico` looks like an interpolated identifier! Did you forget the interpolator? +forgot-interpolator.scala:90: warning: possible missing interpolator: detected interpolated identifier `$calico` def f4 = "I also salute $calico" // warn 9 ^ error: No warnings can be incurred under -Xfatal-warnings. diff --git a/test/files/neg/t4851.flags b/test/files/neg/t4851.flags index ca0d0a0ba3..044ce22c84 100644 --- a/test/files/neg/t4851.flags +++ b/test/files/neg/t4851.flags @@ -1 +1 @@ --Ywarn-adapted-args -Xfatal-warnings -deprecation +-Xlint:adapted-args -Xfatal-warnings -deprecation diff --git a/test/files/neg/t7848-interp-warn.check b/test/files/neg/t7848-interp-warn.check index b7df6d8ce2..4cf9d55ffd 100644 --- a/test/files/neg/t7848-interp-warn.check +++ b/test/files/neg/t7848-interp-warn.check @@ -1,10 +1,10 @@ -t7848-interp-warn.scala:8: warning: `$foo` looks like an interpolated identifier! Did you forget the interpolator? +t7848-interp-warn.scala:8: warning: possible missing interpolator: detected interpolated identifier `$foo` "An important $foo message!" ^ -t7848-interp-warn.scala:12: warning: That looks like an interpolated expression! Did you forget the interpolator? +t7848-interp-warn.scala:12: warning: possible missing interpolator: detected an interpolated expression "A doubly important ${foo * 2} message!" ^ -t7848-interp-warn.scala:16: warning: `$bar` looks like an interpolated identifier! Did you forget the interpolator? +t7848-interp-warn.scala:16: warning: possible missing interpolator: detected interpolated identifier `$bar` def j = s"Try using '${ "something like $bar" }' instead." // warn ^ error: No warnings can be incurred under -Xfatal-warnings. diff --git a/test/files/neg/t8035-no-adapted-args.check b/test/files/neg/t8035-no-adapted-args.check new file mode 100644 index 0000000000..43637b2c1f --- /dev/null +++ b/test/files/neg/t8035-no-adapted-args.check @@ -0,0 +1,21 @@ +t8035-no-adapted-args.scala:4: warning: No automatic adaptation here: use explicit parentheses. + signature: Test.f[T](x: T): Int + given arguments: 1, 2, 3 + after adaptation: Test.f((1, 2, 3): (Int, Int, Int)) + f(1, 2, 3) + ^ +t8035-no-adapted-args.scala:4: error: too many arguments for method f: (x: (Int, Int, Int))Int + f(1, 2, 3) + ^ +t8035-no-adapted-args.scala:5: warning: No automatic adaptation here: use explicit parentheses. + signature: Test.f[T](x: T): Int + given arguments: <none> + after adaptation: Test.f((): Unit) + f() + ^ +t8035-no-adapted-args.scala:5: error: not enough arguments for method f: (x: Unit)Int. +Unspecified value parameter x. + f() + ^ +two warnings found +two errors found diff --git a/test/files/neg/t8035-no-adapted-args.flags b/test/files/neg/t8035-no-adapted-args.flags new file mode 100644 index 0000000000..b3e8c505e2 --- /dev/null +++ b/test/files/neg/t8035-no-adapted-args.flags @@ -0,0 +1 @@ +-Yno-adapted-args
\ No newline at end of file diff --git a/test/files/neg/t8035-no-adapted-args.scala b/test/files/neg/t8035-no-adapted-args.scala new file mode 100644 index 0000000000..82690ebe94 --- /dev/null +++ b/test/files/neg/t8035-no-adapted-args.scala @@ -0,0 +1,6 @@ +object Test { + def f[T](x: T) = 0 + + f(1, 2, 3) + f() +} diff --git a/test/files/neg/t8525.check b/test/files/neg/t8525.check new file mode 100644 index 0000000000..5287e43b7a --- /dev/null +++ b/test/files/neg/t8525.check @@ -0,0 +1,15 @@ +t8525.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 + ^ +t8525.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 + ^ +t8525.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. +three warnings found +one error found diff --git a/test/files/neg/t8525.flags b/test/files/neg/t8525.flags new file mode 100644 index 0000000000..53b2dfe7ec --- /dev/null +++ b/test/files/neg/t8525.flags @@ -0,0 +1 @@ +-Xfatal-warnings -Xlint:-missing-interpolator -Xlint diff --git a/test/files/neg/t8525.scala b/test/files/neg/t8525.scala new file mode 100644 index 0000000000..7bed04904f --- /dev/null +++ b/test/files/neg/t8525.scala @@ -0,0 +1,10 @@ + +class Named(var name: String) + +class X(name: String) extends Named(name) { + 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 + override def toString = name // shadowing mutable var name +} diff --git a/test/files/neg/t8610-arg.check b/test/files/neg/t8610-arg.check new file mode 100644 index 0000000000..d6fe207119 --- /dev/null +++ b/test/files/neg/t8610-arg.check @@ -0,0 +1,6 @@ +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. +one warning 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..f331ba9383 --- /dev/null +++ b/test/files/neg/t8610-arg.flags @@ -0,0 +1 @@ +-Xfatal-warnings -Xlint nullary-unit diff --git a/test/files/neg/t8610-arg.scala b/test/files/neg/t8610-arg.scala new file mode 100644 index 0000000000..7bed04904f --- /dev/null +++ b/test/files/neg/t8610-arg.scala @@ -0,0 +1,10 @@ + +class Named(var name: String) + +class X(name: String) extends Named(name) { + 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 + override def toString = name // shadowing mutable var name +} diff --git a/test/files/neg/t8610.check b/test/files/neg/t8610.check new file mode 100644 index 0000000000..334a947549 --- /dev/null +++ b/test/files/neg/t8610.check @@ -0,0 +1,18 @@ +t8610.scala:5: warning: possible missing interpolator: detected interpolated identifier `$name` + def x = "Hi, $name" // missing interp + ^ +t8610.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.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.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 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..7bed04904f --- /dev/null +++ b/test/files/neg/t8610.scala @@ -0,0 +1,10 @@ + +class Named(var name: String) + +class X(name: String) extends Named(name) { + 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 + override def toString = name // shadowing mutable var name +} diff --git a/test/files/neg/t8736-c.check b/test/files/neg/t8736-c.check new file mode 100644 index 0000000000..06b2228543 --- /dev/null +++ b/test/files/neg/t8736-c.check @@ -0,0 +1,11 @@ +t8736-c.scala:4: warning: higher-kinded type should be enabled +by making the implicit value scala.language.higherKinds visible. +This can be achieved by adding the import clause 'import scala.language.higherKinds' +or by setting the compiler option -language:higherKinds. +See the Scala docs for value scala.language.higherKinds for a discussion +why the feature should be explicitly enabled. + def hk[M[_]] = ??? + ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found +one error found diff --git a/test/files/neg/t8736-c.flags b/test/files/neg/t8736-c.flags new file mode 100644 index 0000000000..fde5313c96 --- /dev/null +++ b/test/files/neg/t8736-c.flags @@ -0,0 +1 @@ +-feature -language:-higherKinds,_ -Xfatal-warnings diff --git a/test/files/neg/t8736-c.scala b/test/files/neg/t8736-c.scala new file mode 100644 index 0000000000..8432775ae1 --- /dev/null +++ b/test/files/neg/t8736-c.scala @@ -0,0 +1,7 @@ +// scalac: -feature -language:-higherKinds,_ -Xfatal-warnings +// showing that wildcard doesn't supersede explicit disablement +class X { + def hk[M[_]] = ??? + + implicit def imp(x: X): Int = x.hashCode +} diff --git a/test/files/neg/warn-inferred-any.flags b/test/files/neg/warn-inferred-any.flags index a3127d392a..b580dfbbe3 100644 --- a/test/files/neg/warn-inferred-any.flags +++ b/test/files/neg/warn-inferred-any.flags @@ -1 +1 @@ --Xfatal-warnings -Ywarn-infer-any +-Xfatal-warnings -Xlint:infer-any |