Closed
Description
Minimized code
➜ dotty git:(master) ./bin/scala
Starting scala3 REPL...
scala> List(1, List(2): _*)
val res0: List[Any] = List(1, List(2))
Output
Sometimes the missing error on the sequence argument ascription makes it hard to spot the problem.
scala> import collection.mutable.ListBuffer
scala> val xs = ListBuffer.empty[Int]
val xs: scala.collection.mutable.ListBuffer[Int] = ListBuffer()
scala> xs.+=(1, 2, 3, List(4,5,6) ++ List(7,8,9): _*)
1 |xs.+=(1, 2, 3, List(4,5,6) ++ List(7,8,9): _*)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
| Found: List[Int]
| Required: Int
scala> xs.+=(1, 2, List(4,5,6) ++ List(7,8,9): _*)
1 |xs.+=(1, 2, List(4,5,6) ++ List(7,8,9): _*)
|^^^^^
|method += in trait Growable is deprecated since 2.13.0: Use `++=` aka `addAll` instead of varargs `+=`; infix operations with an operand of multiple args will be deprecated
val res0: scala.collection.mutable.ListBuffer[Int] = ListBuffer(1, 2, 4, 5, 6, 7, 8, 9)
Expectation
➜ dotty git:(master) scala
Welcome to Scala 2.13.3 (OpenJDK 64-Bit Server VM, Java 14.0.2).
Type in expressions for evaluation. Or try :help.
scala> List(1, List(2): _*)
^
error: no `: _*' annotation allowed here
(such annotations are only allowed in arguments to *-parameters)