aboutsummaryrefslogtreecommitdiff
path: root/tests/run/byNameVarargs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/run/byNameVarargs')
-rw-r--r--tests/run/byNameVarargs/i499.scala28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/run/byNameVarargs/i499.scala b/tests/run/byNameVarargs/i499.scala
new file mode 100644
index 000000000..be40ead50
--- /dev/null
+++ b/tests/run/byNameVarargs/i499.scala
@@ -0,0 +1,28 @@
+object Test {
+ def foo(a: => Any*) = ()
+ def bar(a: => Any*) = foo(a : _*)
+ def baz(a: => Seq[Any]) = foo(a : _*)
+ bar(???, ???)
+ baz(Seq(???, ???))
+ baz(Array(???, ???))
+
+ def foo1(a => Any, b: => Any*) = ()
+ foo1(???)
+ foo1(???, ???, ???)
+
+ def assertFails(a => Any) = {
+ var failed = false
+ try {
+ a
+ } catch {
+ case e => failed = true
+ }
+ assert(failed)
+ }
+
+ def forceLength(b: => Any*) = b.length
+ assertFails(forceLength(???))
+
+ def forceHead(b: => Any*) = b(0)
+ assertFails(forceHead(1, ???))
+}