@@ -3111,6 +3111,11 @@ object Parsers {
31113111
31123112 /** ‘*' | ‘_' */
31133113 def wildcardSelector () =
3114+ if in.token == USCORE && sourceVersion.isAtLeast(`3.1`) then
3115+ report.errorOrMigrationWarning(
3116+ em " `_` is no longer supported for a wildcard import; use `*` instead ${rewriteNotice(" 3.1" )}" ,
3117+ in.sourcePos())
3118+ patch(source, Span (in.offset, in.offset + 1 ), " *" )
31143119 ImportSelector (atSpan(in.skipToken()) { Ident (nme.WILDCARD ) })
31153120
31163121 /** 'given [InfixType]' */
@@ -3124,6 +3129,13 @@ object Parsers {
31243129 /** id [‘as’ (id | ‘_’) */
31253130 def namedSelector (from : Ident ) =
31263131 if in.token == ARROW || isIdent(nme.as) then
3132+ if in.token == ARROW && sourceVersion.isAtLeast(`3.1`) then
3133+ report.errorOrMigrationWarning(
3134+ em " The import renaming `a => b` is no longer supported ; use `a as b` instead ${rewriteNotice(" 3.1" )}" ,
3135+ in.sourcePos())
3136+ patch(source, Span (in.offset, in.offset + 2 ),
3137+ if testChar(in.offset - 1 , ' ' ) && testChar(in.offset + 2 , ' ' ) then " as"
3138+ else " as " )
31273139 atSpan(startOffset(from), in.skipToken()) {
31283140 val to = if in.token == USCORE then wildcardIdent() else termIdent()
31293141 ImportSelector (from, if to.name == nme.ERROR then EmptyTree else to)
0 commit comments