Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch x: _* into x* (not x *) #18814

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions compiler/src/dotty/tools/dotc/parsing/Parsers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2344,7 +2344,7 @@ object Parsers {
in.sourcePos(uscoreStart),
future)
if sourceVersion == `future-migration` then
patch(source, Span(t.span.end, in.lastOffset), " *")
patch(source, Span(t.span.end, in.lastOffset), "*")
else if opStack.nonEmpty then
report.errorOrMigrationWarning(
em"""`_*` can be used only for last argument of method application.
Expand Down Expand Up @@ -2973,12 +2973,6 @@ object Parsers {
case p =>
p

private def warnStarMigration(p: Tree) =
report.errorOrMigrationWarning(
em"The syntax `x: _*` is no longer supported for vararg splices; use `x*` instead",
in.sourcePos(startOffset(p)),
from = future)

/** InfixPattern ::= SimplePattern {id [nl] SimplePattern}
*/
def infixPattern(): Tree =
Expand Down
10 changes: 10 additions & 0 deletions tests/rewrites/rewrites3x.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import scala.{collection as coll, runtime as _, *}
import coll.*

def f(xs: Int*) = xs.sum
def test =
f(List(1, 2, 3)*)

def g = { implicit (x: Int) =>
x + 1
}