diff options
author | Jason Zaugg <jzaugg@gmail.com> | 2014-09-03 08:22:51 +1000 |
---|---|---|
committer | Jason Zaugg <jzaugg@gmail.com> | 2014-09-03 08:22:51 +1000 |
commit | 21644611b3c676210d312eca1e0169d21070b50e (patch) | |
tree | e732aa1f0b6b6d65c21e91b40298f722200593f7 /test/files/neg | |
parent | 61dbf4ac711094db38a4b2dfb853d88499c2b1a5 (diff) | |
parent | 91c4192c39d2bdebf37a97e41d374a39ece8af85 (diff) | |
download | scala-21644611b3c676210d312eca1e0169d21070b50e.tar.gz scala-21644611b3c676210d312eca1e0169d21070b50e.tar.bz2 scala-21644611b3c676210d312eca1e0169d21070b50e.zip |
Merge pull request #3959 from lrytz/merge/2.11-to-2.12-is-it-really-sept-2-already-where-was-summer
Merge 2.11 to 2.12
Diffstat (limited to 'test/files/neg')
31 files changed, 209 insertions, 28 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/forgot-interpolator.scala b/test/files/neg/forgot-interpolator.scala index a53054d890..ca1ac30821 100644 --- a/test/files/neg/forgot-interpolator.scala +++ b/test/files/neg/forgot-interpolator.scala @@ -54,8 +54,8 @@ package test { } } import annotation._ - @implicitNotFound("No Z in ${A}") // no warn - class Z[A] + @implicitNotFound("No Z in ${T}") // no warn + class Z[T] } diff --git a/test/files/neg/macro-basic-mamdmi.check b/test/files/neg/macro-basic-mamdmi.check index 61df5131cc..54743d4936 100644 --- a/test/files/neg/macro-basic-mamdmi.check +++ b/test/files/neg/macro-basic-mamdmi.check @@ -1,5 +1,13 @@ +Impls_Macros_Test_1.scala:33: error: macro implementation not found: foo +(the most common reason for that is that you cannot use macro implementations in the same compilation run that defines them) + println(foo(2) + Macros.bar(2) * new Macros().quux(4)) + ^ +Impls_Macros_Test_1.scala:33: error: macro implementation not found: bar +(the most common reason for that is that you cannot use macro implementations in the same compilation run that defines them) + println(foo(2) + Macros.bar(2) * new Macros().quux(4)) + ^ Impls_Macros_Test_1.scala:33: error: macro implementation not found: quux (the most common reason for that is that you cannot use macro implementations in the same compilation run that defines them) println(foo(2) + Macros.bar(2) * new Macros().quux(4)) ^ -one error found +three errors found diff --git a/test/files/neg/t3909.check b/test/files/neg/t3909.check index 7da0195607..052b49f855 100644 --- a/test/files/neg/t3909.check +++ b/test/files/neg/t3909.check @@ -1,4 +1,5 @@ t3909.scala:1: error: in object DO, multiple overloaded alternatives of m1 define default arguments +Error occurred in an application involving default arguments. object DO { ^ one error found diff --git a/test/files/neg/t4851.check b/test/files/neg/t4851.check index 132dd91b50..d5711a889b 100644 --- a/test/files/neg/t4851.check +++ b/test/files/neg/t4851.check @@ -29,13 +29,13 @@ S.scala:7: warning: Adapting argument list by creating a 3-tuple: this may not b val y2 = new Some(1, 2, 3) ^ S.scala:9: warning: Adaptation of argument list by inserting () has been deprecated: this is unlikely to be what you want. - signature: J2[T](x: T): J2[T] + signature: J2(x: T): J2[T] given arguments: <none> after adaptation: new J2((): Unit) val z1 = new J2 ^ S.scala:10: warning: Adaptation of argument list by inserting () has been deprecated: this is unlikely to be what you want. - signature: J2[T](x: T): J2[T] + signature: J2(x: T): J2[T] given arguments: <none> after adaptation: new J2((): Unit) val z2 = new J2() 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/t4851/J2.java b/test/files/neg/t4851/J2.java index 82954d9489..a90f48e269 100644 --- a/test/files/neg/t4851/J2.java +++ b/test/files/neg/t4851/J2.java @@ -1,11 +1,11 @@ public class J2<T> { T x; - public <T> J(T x) { + public J2(T x) { this.x = x; } public String toString() { return "J2:" + x.getClass(); } -}
\ No newline at end of file +} diff --git a/test/files/neg/t5148.check b/test/files/neg/t5148.check index 8a667f4b88..0de4fe2d4c 100644 --- a/test/files/neg/t5148.check +++ b/test/files/neg/t5148.check @@ -1,5 +1,6 @@ -error: bad symbolic reference to scala.tools.nsc.interpreter.IMain.Request encountered in class file 'Imports.class'. -Cannot access type Request in class scala.tools.nsc.interpreter.IMain. The current classpath may be -missing a definition for scala.tools.nsc.interpreter.IMain.Request, or Imports.class may have been compiled against a version that's -incompatible with the one found on the current classpath. +error: missing or invalid dependency detected while loading class file 'Imports.class'. +Could not access type Request in class scala.tools.nsc.interpreter.IMain, +because it (or its dependencies) are missing. Check your build definition for +missing or conflicting dependencies. (Re-run with `-Ylog-classpath` to see the problematic classpath.) +A full rebuild may help if 'Imports.class' was compiled against an incompatible version of scala.tools.nsc.interpreter.IMain. one error found diff --git a/test/files/neg/t5691.check b/test/files/neg/t5691.check new file mode 100644 index 0000000000..a51ca98a10 --- /dev/null +++ b/test/files/neg/t5691.check @@ -0,0 +1,24 @@ +t5691.scala:7: warning: type parameter D defined in method foobar shadows trait D defined in class B. You may want to rename your type parameter, or possibly remove it. + def foobar[D](in: D) = in.toString + ^ +t5691.scala:10: warning: type parameter D defined in type MySeq shadows trait D defined in class B. You may want to rename your type parameter, or possibly remove it. + type MySeq[D] = Seq[D] + ^ +t5691.scala:15: warning: type parameter T defined in method bar shadows type T defined in class Foo. You may want to rename your type parameter, or possibly remove it. + def bar[T](w: T) = w.toString + ^ +t5691.scala:13: warning: type parameter T defined in class Foo shadows type T defined in class B. You may want to rename your type parameter, or possibly remove it. + class Foo[T](t: T) { + ^ +t5691.scala:19: warning: type parameter List defined in type M shadows type List defined in package object scala. You may want to rename your type parameter, or possibly remove it. + class C[M[List[_]]] + ^ +t5691.scala:20: warning: type parameter List defined in type M shadows type List defined in package object scala. You may want to rename your type parameter, or possibly remove it. + type E[M[List[_]]] = Int + ^ +t5691.scala:21: warning: type parameter List defined in type M shadows type List defined in package object scala. You may want to rename your type parameter, or possibly remove it. + def foo[N[M[List[_]]]] = ??? + ^ +error: No warnings can be incurred under -Xfatal-warnings. +7 warnings found +one error found diff --git a/test/files/neg/t5691.flags b/test/files/neg/t5691.flags new file mode 100644 index 0000000000..0e09b8575b --- /dev/null +++ b/test/files/neg/t5691.flags @@ -0,0 +1 @@ +-Xlint:type-parameter-shadow -language:higherKinds -Xfatal-warnings diff --git a/test/files/neg/t5691.scala b/test/files/neg/t5691.scala new file mode 100644 index 0000000000..e6a9bdc16a --- /dev/null +++ b/test/files/neg/t5691.scala @@ -0,0 +1,27 @@ +class B { + + type T = Int + trait D + + // method parameter shadows some other type + def foobar[D](in: D) = in.toString + + // type member's parameter shadows some other type + type MySeq[D] = Seq[D] + + // class parameter shadows some other type + class Foo[T](t: T) { + // a type parameter shadows another type parameter + def bar[T](w: T) = w.toString + } + + // even deeply nested... + class C[M[List[_]]] + type E[M[List[_]]] = Int + def foo[N[M[List[_]]]] = ??? + + // ...but not between type parameters in the same list + class F[A, M[L[A]]] // no warning! + type G[A, M[L[A]]] = Int // no warning! + def bar[A, N[M[L[A]]]] = ??? // no warning! +} diff --git a/test/files/neg/t6675b.scala b/test/files/neg/t6675b.scala index c86c9c3955..da27e1b91f 100644 --- a/test/files/neg/t6675b.scala +++ b/test/files/neg/t6675b.scala @@ -13,7 +13,7 @@ object NativelyTwo { } -class A { +class E { def f1 = (Left((0, 0)): Either[(Int, Int), (Int, Int)]) match { case LeftOrRight(a) => a } // warn def f2 = (Left((0, 0)): Either[(Int, Int), (Int, Int)]) match { case LeftOrRight((a, b)) => a } // no warn def f3 = (Left((0, 0)): Either[(Int, Int), (Int, Int)]) match { case LeftOrRight((a, b, c)) => a } // fail 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/t7848-interp-warn.flags b/test/files/neg/t7848-interp-warn.flags index 7949c2afa2..b0d7bc25cb 100644 --- a/test/files/neg/t7848-interp-warn.flags +++ b/test/files/neg/t7848-interp-warn.flags @@ -1 +1 @@ --Xlint -Xfatal-warnings +-Xlint:missing-interpolator -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/t8266-invalid-interp.check b/test/files/neg/t8266-invalid-interp.check index 70dd4081b0..bb2d44a80c 100644 --- a/test/files/neg/t8266-invalid-interp.check +++ b/test/files/neg/t8266-invalid-interp.check @@ -1,10 +1,10 @@ t8266-invalid-interp.scala:4: error: Trailing '\' escapes nothing. f"a\", ^ -t8266-invalid-interp.scala:5: error: invalid escape character at index 1 in "a\xc" +t8266-invalid-interp.scala:5: error: invalid escape '\x' not one of [\b, \t, \n, \f, \r, \\, \", \'] at index 1 in "a\xc". Use \\ for literal \. f"a\xc", ^ -t8266-invalid-interp.scala:7: error: invalid escape character at index 1 in "a\vc" +t8266-invalid-interp.scala:7: error: invalid escape '\v' not one of [\b, \t, \n, \f, \r, \\, \", \'] at index 1 in "a\vc". Use \\ for literal \. f"a\vc" ^ three errors found 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 |