summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-09-12 16:54:49 -0700
committerPaul Phillips <paulp@improving.org>2012-09-12 20:47:39 -0700
commitf5e71796d5b964026f5723318d29be5b189b442e (patch)
tree39926b10b22d920555244622655b27c104cc37ee /test
parent5f674e44c5d3dccb55ce080c60d92b8e412d03ac (diff)
downloadscala-f5e71796d5b964026f5723318d29be5b189b442e.tar.gz
scala-f5e71796d5b964026f5723318d29be5b189b442e.tar.bz2
scala-f5e71796d5b964026f5723318d29be5b189b442e.zip
Better error message for pattern arity errors.
Because friends don't tell friends: "wrong number of arguments for <none>"
Diffstat (limited to 'test')
-rw-r--r--test/files/neg/names-defaults-neg.check2
-rw-r--r--test/files/neg/wrong-args-for-none.check4
-rw-r--r--test/files/neg/wrong-args-for-none.scala6
3 files changed, 11 insertions, 1 deletions
diff --git a/test/files/neg/names-defaults-neg.check b/test/files/neg/names-defaults-neg.check
index 2809350855..f3c45a6aa0 100644
--- a/test/files/neg/names-defaults-neg.check
+++ b/test/files/neg/names-defaults-neg.check
@@ -76,7 +76,7 @@ and method f in object t8 of type (a: Int, b: Object)String
match argument types (a: Int,b: String) and expected result type Any
println(t8.f(a = 0, b = "1")) // ambigous reference
^
-names-defaults-neg.scala:69: error: wrong number of arguments for <none>: (x: Int, y: String)A1
+names-defaults-neg.scala:69: error: wrong number of arguments for pattern A1(x: Int,y: String)
A1() match { case A1(_) => () }
^
names-defaults-neg.scala:76: error: no type parameters for method test4: (x: T[T[List[T[X forSome { type X }]]]])T[T[List[T[X forSome { type X }]]]] exist so that it can be applied to arguments (List[Int])
diff --git a/test/files/neg/wrong-args-for-none.check b/test/files/neg/wrong-args-for-none.check
new file mode 100644
index 0000000000..d3b2d572ab
--- /dev/null
+++ b/test/files/neg/wrong-args-for-none.check
@@ -0,0 +1,4 @@
+wrong-args-for-none.scala:5: error: wrong number of arguments for pattern Test.Foo(x: Int,y: Int)
+ def f(x: Any) = x match { case Bar(Foo(5)) => }
+ ^
+one error found
diff --git a/test/files/neg/wrong-args-for-none.scala b/test/files/neg/wrong-args-for-none.scala
new file mode 100644
index 0000000000..1caa4782a3
--- /dev/null
+++ b/test/files/neg/wrong-args-for-none.scala
@@ -0,0 +1,6 @@
+object Test {
+ case class Foo(x: Int, y: Int)
+ case class Bar(x: AnyRef)
+
+ def f(x: Any) = x match { case Bar(Foo(5)) => }
+}