summaryrefslogtreecommitdiff
path: root/test/files/neg
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2012-06-10 21:59:35 +0200
committerJason Zaugg <jzaugg@gmail.com>2012-06-10 22:17:19 +0200
commitfc6ea96f1946712a889b7db50a520be49ea2e208 (patch)
tree757d25fbdb055ba84170f75ca851a225bd8a57d6 /test/files/neg
parent30ef129f322687cbc885d344ca73dd4877fbedd6 (diff)
downloadscala-fc6ea96f1946712a889b7db50a520be49ea2e208.tar.gz
scala-fc6ea96f1946712a889b7db50a520be49ea2e208.tar.bz2
scala-fc6ea96f1946712a889b7db50a520be49ea2e208.zip
SI-5696 Detect excess constructor argument lists.
An apply method fooled the usual mechanism.
Diffstat (limited to 'test/files/neg')
-rw-r--r--test/files/neg/t5696.check19
-rw-r--r--test/files/neg/t5696.scala47
2 files changed, 66 insertions, 0 deletions
diff --git a/test/files/neg/t5696.check b/test/files/neg/t5696.check
new file mode 100644
index 0000000000..72b7781fc4
--- /dev/null
+++ b/test/files/neg/t5696.check
@@ -0,0 +1,19 @@
+t5696.scala:6: error: too many argument lists for constructor invocation
+ new G(1)(2) {}
+ ^
+t5696.scala:14: error: too many argument lists for constructor invocation
+ new G()(2) {}
+ ^
+t5696.scala:22: error: too many argument lists for constructor invocation
+ new G[Int]()(2) {}
+ ^
+t5696.scala:30: error: too many argument lists for constructor invocation
+ new G[Int]()(2)(3) {}
+ ^
+t5696.scala:38: error: too many argument lists for constructor invocation
+ new G[Int]()()(2) {}
+ ^
+t5696.scala:46: error: too many argument lists for constructor invocation
+ object x extends G(1)(2) {}
+ ^
+6 errors found
diff --git a/test/files/neg/t5696.scala b/test/files/neg/t5696.scala
new file mode 100644
index 0000000000..051e3a07f9
--- /dev/null
+++ b/test/files/neg/t5696.scala
@@ -0,0 +1,47 @@
+class TestApply1 {
+ class G(y: Int) {
+ def apply(x: Int) = 1
+ }
+
+ new G(1)(2) {}
+}
+
+class TestApply2 {
+ class G {
+ def apply(x: Int) = 1
+ }
+
+ new G()(2) {}
+}
+
+class TestApply3 {
+ class G[X] {
+ def apply(x: Int) = 1
+ }
+
+ new G[Int]()(2) {}
+}
+
+class TestApply4 {
+ class G[X] {
+ def apply(x: Int)(y: Int) = 1
+ }
+
+ new G[Int]()(2)(3) {}
+}
+
+class TestApply5 {
+ class G[X]()() {
+ def apply(x: Int) = 1
+ }
+
+ new G[Int]()()(2) {}
+}
+
+class TestApply6 {
+ class G(y: Int) {
+ def apply(x: Int) = 1
+ }
+
+ object x extends G(1)(2) {}
+}