We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7a8bc79 commit be61c78Copy full SHA for be61c78
tests/run/byNameVarargs/i499.scala
@@ -0,0 +1,28 @@
1
+object Test {
2
+ def foo(a: => Any*) = ()
3
+ def bar(a: => Any*) = foo(a : _*)
4
+ def baz(a: => Seq[Any]) = foo(a : _*)
5
+ bar(???, ???)
6
+ baz(Seq(???, ???))
7
+ baz(Array(???, ???))
8
+
9
+ def foo1(a => Any, b: => Any*) = ()
10
+ foo1(???)
11
+ foo1(???, ???, ???)
12
13
+ def assertFails(a => Any) = {
14
+ var failed = false
15
+ try {
16
+ a
17
+ } catch {
18
+ case e => failed = true
19
+ }
20
+ assert(failed)
21
22
23
+ def forceLength(b: => Any*) = b.length
24
+ assertFails(forceLength(???))
25
26
+ def forceHead(b: => Any*) = b(0)
27
+ assertFails(forceHead(1, ???))
28
+}
0 commit comments