@@ -3115,6 +3115,11 @@ object Parsers {
3115
3115
3116
3116
/** ‘*' | ‘_' */
3117
3117
def wildcardSelector () =
3118
+ if in.token == USCORE && sourceVersion.isAtLeast(`3.1`) then
3119
+ report.errorOrMigrationWarning(
3120
+ em " `_` is no longer supported for a wildcard import; use `*` instead ${rewriteNotice(" 3.1" )}" ,
3121
+ in.sourcePos())
3122
+ patch(source, Span (in.offset, in.offset + 1 ), " *" )
3118
3123
ImportSelector (atSpan(in.skipToken()) { Ident (nme.WILDCARD ) })
3119
3124
3120
3125
/** 'given [InfixType]' */
@@ -3128,6 +3133,13 @@ object Parsers {
3128
3133
/** id [‘as’ (id | ‘_’) */
3129
3134
def namedSelector (from : Ident ) =
3130
3135
if in.token == ARROW || isIdent(nme.as) then
3136
+ if in.token == ARROW && sourceVersion.isAtLeast(`3.1`) then
3137
+ report.errorOrMigrationWarning(
3138
+ em " The import renaming `a => b` is no longer supported ; use `a as b` instead ${rewriteNotice(" 3.1" )}" ,
3139
+ in.sourcePos())
3140
+ patch(source, Span (in.offset, in.offset + 2 ),
3141
+ if testChar(in.offset - 1 , ' ' ) && testChar(in.offset + 2 , ' ' ) then " as"
3142
+ else " as " )
3131
3143
atSpan(startOffset(from), in.skipToken()) {
3132
3144
val to = if in.token == USCORE then wildcardIdent() else termIdent()
3133
3145
ImportSelector (from, if to.name == nme.ERROR then EmptyTree else to)
0 commit comments