summaryrefslogtreecommitdiff
path: root/test/files/neg
diff options
context:
space:
mode:
Diffstat (limited to 'test/files/neg')
-rw-r--r--test/files/neg/varargs.check7
-rw-r--r--test/files/neg/varargs.scala20
2 files changed, 27 insertions, 0 deletions
diff --git a/test/files/neg/varargs.check b/test/files/neg/varargs.check
new file mode 100644
index 0000000000..f3254708b8
--- /dev/null
+++ b/test/files/neg/varargs.check
@@ -0,0 +1,7 @@
+varargs.scala:11: error: A method without repeated parameters cannot be annotated with the `varargs` annotation.
+ @varargs def nov(a: Int) = 0
+ ^
+varargs.scala:13: error: A method with a varargs annotation produces a forwarder method with the same signature (a: Int,b: Array[java.lang.String])Int as an existing method.
+ @varargs def v2(a: Int, b: String*) = 0
+ ^
+two errors found \ No newline at end of file
diff --git a/test/files/neg/varargs.scala b/test/files/neg/varargs.scala
new file mode 100644
index 0000000000..a2f895a87d
--- /dev/null
+++ b/test/files/neg/varargs.scala
@@ -0,0 +1,20 @@
+
+
+
+import annotation.varargs
+
+
+
+// Failing varargs annotation
+object Test {
+
+ @varargs def nov(a: Int) = 0
+ @varargs def v(a: Int, b: String*) = a + b.length
+ @varargs def v2(a: Int, b: String*) = 0
+ def v2(a: Int, b: Array[String]) = 0
+
+ def main(args: Array[String]) {
+
+ }
+
+}