@@ -3419,7 +3419,7 @@ object Parsers {
34193419 */
34203420 def importOrExportClause (leading : Token , mkTree : ImportConstr ): List [Tree ] = {
34213421 val offset = accept(leading)
3422- commaSeparated(importExpr(mkTree)) match {
3422+ commaSeparated(importExpr(leading, mkTree)) match {
34233423 case t :: rest =>
34243424 // The first import should start at the start offset of the keyword.
34253425 val firstPos =
@@ -3474,13 +3474,18 @@ object Parsers {
34743474 * NamedSelector ::= id [‘as’ (id | ‘_’)]
34753475 * WildCardSelector ::= ‘*' | ‘given’ [InfixType]
34763476 */
3477- def importExpr (mkTree : ImportConstr ): () => Tree =
3477+ def importExpr (leading : Token , mkTree : ImportConstr ): () => Tree =
3478+
3479+ def exprName =
3480+ (leading : @ unchecked) match
3481+ case EXPORT => " export"
3482+ case IMPORT => " import"
34783483
34793484 /** ‘*' | ‘_' */
34803485 def wildcardSelector () =
34813486 if in.token == USCORE && sourceVersion.isAtLeast(future) then
34823487 report.errorOrMigrationWarning(
3483- em " `_` is no longer supported for a wildcard import ; use `*` instead ${rewriteNotice(`future-migration`)}" ,
3488+ em " `_` is no longer supported for a wildcard $exprName ; use `*` instead ${rewriteNotice(`future-migration`)}" ,
34843489 in.sourcePos(),
34853490 from = future)
34863491 patch(source, Span (in.offset, in.offset + 1 ), " *" )
@@ -3499,7 +3504,7 @@ object Parsers {
34993504 if in.token == ARROW || isIdent(nme.as) then
35003505 if in.token == ARROW && sourceVersion.isAtLeast(future) then
35013506 report.errorOrMigrationWarning(
3502- em " The import renaming `a => b` is no longer supported ; use `a as b` instead ${rewriteNotice(`future-migration`)}" ,
3507+ em " The $exprName renaming `a => b` is no longer supported ; use `a as b` instead ${rewriteNotice(`future-migration`)}" ,
35033508 in.sourcePos(),
35043509 from = future)
35053510 patch(source, Span (in.offset, in.offset + 2 ),
@@ -3519,7 +3524,7 @@ object Parsers {
35193524 case _ =>
35203525 if isIdent(nme.raw.STAR ) then wildcardSelector()
35213526 else
3522- if ! idOK then syntaxError(em " named imports cannot follow wildcard imports " )
3527+ if ! idOK then syntaxError(em " named ${exprName} s cannot follow wildcard ${exprName} s " )
35233528 namedSelector(termIdent())
35243529 }
35253530
0 commit comments