@@ -2603,30 +2603,28 @@ object Parsers {
2603
2603
deprecationWarning(s " `@` bindings have been deprecated; use `as` instead " , in.offset)
2604
2604
2605
2605
val offset = in.skipToken()
2606
-
2607
2606
infixPattern() match {
2608
2607
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)
2613
2609
atSpan(startOffset(p), offset) { Typed (p, pt) }
2614
2610
case pt @ Bind (nme.WILDCARD , pt1 : Typed ) if pt.mods.is(Given ) =>
2615
2611
atSpan(startOffset(p), 0 ) { Bind (name, pt1).withMods(pt.mods) }
2616
2612
case pt =>
2617
2613
atSpan(startOffset(p), 0 ) { Bind (name, pt) }
2618
2614
}
2619
2615
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)
2625
2617
atSpan(startOffset(p)) { Typed (Ident (nme.WILDCARD ), p) }
2626
2618
case p =>
2627
2619
p
2628
2620
}
2629
2621
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
+
2630
2628
/** InfixPattern ::= SimplePattern {id [nl] SimplePattern}
2631
2629
*/
2632
2630
def infixPattern (): Tree =
0 commit comments