Skip to content

Commit bb82d4c

Browse files
Patch x: _* into x* (not x *) (#18814)
2 parents afeb541 + e06022f commit bb82d4c

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2344,7 +2344,7 @@ object Parsers {
23442344
in.sourcePos(uscoreStart),
23452345
future)
23462346
if sourceVersion == `future-migration` then
2347-
patch(source, Span(t.span.end, in.lastOffset), " *")
2347+
patch(source, Span(t.span.end, in.lastOffset), "*")
23482348
else if opStack.nonEmpty then
23492349
report.errorOrMigrationWarning(
23502350
em"""`_*` can be used only for last argument of method application.
@@ -2973,12 +2973,6 @@ object Parsers {
29732973
case p =>
29742974
p
29752975

2976-
private def warnStarMigration(p: Tree) =
2977-
report.errorOrMigrationWarning(
2978-
em"The syntax `x: _*` is no longer supported for vararg splices; use `x*` instead",
2979-
in.sourcePos(startOffset(p)),
2980-
from = future)
2981-
29822976
/** InfixPattern ::= SimplePattern {id [nl] SimplePattern}
29832977
*/
29842978
def infixPattern(): Tree =

tests/rewrites/rewrites3x.check

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import scala.{collection as coll, runtime as _, *}
2+
import coll.*
3+
4+
def f(xs: Int*) = xs.sum
5+
def test =
6+
f(List(1, 2, 3)*)
7+
8+
def g = { implicit (x: Int) =>
9+
x + 1
10+
}

0 commit comments

Comments
 (0)