blob: be40ead50952370ea27566bb97feb33ae241bc02 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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, ???))
}
|