@@ -3111,6 +3111,11 @@ object Parsers {
3111
3111
3112
3112
/** ‘*' | ‘_' */
3113
3113
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 ), " *" )
3114
3119
ImportSelector (atSpan(in.skipToken()) { Ident (nme.WILDCARD ) })
3115
3120
3116
3121
/** 'given [InfixType]' */
@@ -3124,6 +3129,13 @@ object Parsers {
3124
3129
/** id [‘as’ (id | ‘_’) */
3125
3130
def namedSelector (from : Ident ) =
3126
3131
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 " )
3127
3139
atSpan(startOffset(from), in.skipToken()) {
3128
3140
val to = if in.token == USCORE then wildcardIdent() else termIdent()
3129
3141
ImportSelector (from, if to.name == nme.ERROR then EmptyTree else to)
0 commit comments