@@ -2603,30 +2603,28 @@ object Parsers {
26032603 deprecationWarning(s " `@` bindings have been deprecated; use `as` instead " , in.offset)
26042604
26052605 val offset = in.skipToken()
2606-
26072606 infixPattern() match {
26082607 case pt @ Ident (tpnme.WILDCARD_STAR ) => // compatibility for Scala2 `x @ _*` syntax
2609- if sourceVersion.isAtLeast(`3.1`) then
2610- report.errorOrMigrationWarning(
2611- " The syntax `x @ _*` is no longer supported; use `x : _*` instead" ,
2612- in.sourcePos(startOffset(p)))
2608+ warnMigration(p)
26132609 atSpan(startOffset(p), offset) { Typed (p, pt) }
26142610 case pt @ Bind (nme.WILDCARD , pt1 : Typed ) if pt.mods.is(Given ) =>
26152611 atSpan(startOffset(p), 0 ) { Bind (name, pt1).withMods(pt.mods) }
26162612 case pt =>
26172613 atSpan(startOffset(p), 0 ) { Bind (name, pt) }
26182614 }
26192615 case p @ Ident (tpnme.WILDCARD_STAR ) =>
2620- // compatibility for Scala2 `_*` syntax
2621- if sourceVersion.isAtLeast(`3.1`) then
2622- report.errorOrMigrationWarning(
2623- " The syntax `_*` is no longer supported; use `x : _*` instead" ,
2624- in.sourcePos(startOffset(p)))
2616+ warnMigration(p)
26252617 atSpan(startOffset(p)) { Typed (Ident (nme.WILDCARD ), p) }
26262618 case p =>
26272619 p
26282620 }
26292621
2622+ private def warnMigration (p : Tree ) =
2623+ if sourceVersion.isAtLeast(`3.1`) then
2624+ report.errorOrMigrationWarning(
2625+ " The syntax `x @ _*` is no longer supported; use `x : _*` instead" ,
2626+ in.sourcePos(startOffset(p)))
2627+
26302628 /** InfixPattern ::= SimplePattern {id [nl] SimplePattern}
26312629 */
26322630 def infixPattern (): Tree =
0 commit comments