@@ -359,13 +359,11 @@ object Parsers {
359
359
recur(false , false )
360
360
end statSepOrEnd
361
361
362
- def rewriteNotice (version : String = " 3.0" , additionalOption : String = " " ) = {
363
- val optionStr = if (additionalOption.isEmpty) " " else " " ++ additionalOption
364
- i " \n This construct can be rewritten automatically under $optionStr -rewrite -source $version-migration. "
365
- }
362
+ def rewriteNotice (version : SourceVersion = `3.0-migration`, additionalOption : String = " " ) =
363
+ Message .rewriteNotice(" This construct" , version, additionalOption)
366
364
367
365
def syntaxVersionError (option : String , span : Span ) =
368
- syntaxError(em """ This construct is not allowed under $option. ${rewriteNotice(" 3.0" , option)}""" , span)
366
+ syntaxError(em """ This construct is not allowed under $option. ${rewriteNotice(` 3.0-migration` , option)}""" , span)
369
367
370
368
def rewriteToNewSyntax (span : Span = Span (in.offset)): Boolean = {
371
369
if (in.newSyntax) {
@@ -2084,7 +2082,7 @@ object Parsers {
2084
2082
in.nextToken()
2085
2083
if isVarargSplice then
2086
2084
report.errorOrMigrationWarning(
2087
- em " The syntax `x: _*` is no longer supported for vararg splices; use `x*` instead ${rewriteNotice(" future" )}" ,
2085
+ em " The syntax `x: _*` is no longer supported for vararg splices; use `x*` instead ${rewriteNotice(` future-migration` )}" ,
2088
2086
in.sourcePos(uscoreStart),
2089
2087
future)
2090
2088
if sourceVersion == `future-migration` then
@@ -2160,7 +2158,7 @@ object Parsers {
2160
2158
val t =
2161
2159
if (in.token == COLON && location == Location .InBlock ) {
2162
2160
report.errorOrMigrationWarning(
2163
- s " This syntax is no longer supported; parameter needs to be enclosed in (...) ${rewriteNotice(" future" )}" ,
2161
+ s " This syntax is no longer supported; parameter needs to be enclosed in (...) ${rewriteNotice(` future-migration` )}" ,
2164
2162
source.atSpan(Span (start, in.lastOffset)),
2165
2163
from = future)
2166
2164
in.nextToken()
@@ -3186,7 +3184,7 @@ object Parsers {
3186
3184
def wildcardSelector () =
3187
3185
if in.token == USCORE && sourceVersion.isAtLeast(future) then
3188
3186
report.errorOrMigrationWarning(
3189
- em " `_` is no longer supported for a wildcard import; use `*` instead ${rewriteNotice(" future" )}" ,
3187
+ em " `_` is no longer supported for a wildcard import; use `*` instead ${rewriteNotice(` future-migration` )}" ,
3190
3188
in.sourcePos(),
3191
3189
from = future)
3192
3190
patch(source, Span (in.offset, in.offset + 1 ), " *" )
@@ -3205,7 +3203,7 @@ object Parsers {
3205
3203
if in.token == ARROW || isIdent(nme.as) then
3206
3204
if in.token == ARROW && sourceVersion.isAtLeast(future) then
3207
3205
report.errorOrMigrationWarning(
3208
- em " The import renaming `a => b` is no longer supported ; use `a as b` instead ${rewriteNotice(" future" )}" ,
3206
+ em " The import renaming `a => b` is no longer supported ; use `a as b` instead ${rewriteNotice(` future-migration` )}" ,
3209
3207
in.sourcePos(),
3210
3208
from = future)
3211
3209
patch(source, Span (in.offset, in.offset + 2 ),
0 commit comments