My IDE's tooling shows that xs
has type Int*
in the following snippet:
def accept(xs: Int*) = true
The language reference, however, says that a repeated parameter declared as T*
has type Seq[T]
. Is there a difference between Int*
and Seq[Int]
?
They are different, and it's somewhere between bug and regrettable feature that T* leaks into type signatures.
Repeated parameter typed as T* rather than Seq[T]
Yes, they are different. See, e.g., Overriding a repeated class parameter in Scala?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With