Stefan Matthias Aust <
[hidden email]> writes:
> The Scala 2.1.3 compiler compiles this code just fine:
>
> package test;
>
> object test {
> class A
> class B
>
> def m(a: A, b: B*) = b.toArray
> def m(a: A*, b: B ) = a.toArray
> def m(a: A*, b: B*) = a.toArray
> }
>
> But I cannot call the second or third method variant. If it is only
> possible that the last parameter can be a variable argument parameter
> (and so it seems), the compiler should not allow the other definitions.
This is not allowed, according to my recollection and to the spec.
The spec says (page 31):
The last value parameter of a parameter section may be suffixed by
"*", e.g. (..., x:T*).
It then goes on to talk about what * types mean, exclusively talking
about them as the last parameter of a method. So, it's a bug that
this was accepted.
-Lex