diff options
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/jvm/varargs.check | 3 | ||||
-rw-r--r-- | test/files/jvm/varargs/JavaClass.java | 1 | ||||
-rw-r--r-- | test/files/jvm/varargs/VaClass.scala | 1 | ||||
-rw-r--r-- | test/files/neg/varargs.check | 9 | ||||
-rw-r--r-- | test/files/neg/varargs.scala | 9 |
5 files changed, 18 insertions, 5 deletions
diff --git a/test/files/jvm/varargs.check b/test/files/jvm/varargs.check index fef7448acb..8379befe93 100644 --- a/test/files/jvm/varargs.check +++ b/test/files/jvm/varargs.check @@ -1,2 +1,3 @@ 7 -10
\ No newline at end of file +10 +19
\ No newline at end of file diff --git a/test/files/jvm/varargs/JavaClass.java b/test/files/jvm/varargs/JavaClass.java index b5158f2878..9851e1b78b 100644 --- a/test/files/jvm/varargs/JavaClass.java +++ b/test/files/jvm/varargs/JavaClass.java @@ -10,5 +10,6 @@ public class JavaClass { va.vs(4, "", "", ""); va.vi(1, 2, 3, 4); varargz(5, 1.0, 2.0, 3.0); + va.vt(16, "", "", ""); } }
\ No newline at end of file diff --git a/test/files/jvm/varargs/VaClass.scala b/test/files/jvm/varargs/VaClass.scala index ffa25027d3..6343f9c6f6 100644 --- a/test/files/jvm/varargs/VaClass.scala +++ b/test/files/jvm/varargs/VaClass.scala @@ -8,5 +8,6 @@ class VaClass { @varargs def vs(a: Int, b: String*) = println(a + b.length) @varargs def vi(a: Int, b: Int*) = println(a + b.sum) + @varargs def vt[T](a: Int, b: T*) = println(a + b.length) } diff --git a/test/files/neg/varargs.check b/test/files/neg/varargs.check index f3254708b8..1352dd968c 100644 --- a/test/files/neg/varargs.check +++ b/test/files/neg/varargs.check @@ -1,7 +1,10 @@ -varargs.scala:11: error: A method without repeated parameters cannot be annotated with the `varargs` annotation. +varargs.scala:16: 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 v1(a: Int, b: String*) = a + b.length + ^ +varargs.scala:19: 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.scala:21: 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 +three errors found
\ No newline at end of file diff --git a/test/files/neg/varargs.scala b/test/files/neg/varargs.scala index a2f895a87d..be75e9b0a7 100644 --- a/test/files/neg/varargs.scala +++ b/test/files/neg/varargs.scala @@ -8,13 +8,20 @@ import annotation.varargs // Failing varargs annotation object Test { + trait A { + def v1(a: Int, b: Array[String]) = a + } + + trait B extends A { + @varargs def v1(a: Int, b: String*) = a + b.length + } + @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]) { - } } |