@@ -359,13 +359,11 @@ object Parsers {
359359 recur(false , false )
360360 end statSepOrEnd
361361
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)
366364
367365 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)
369367
370368 def rewriteToNewSyntax (span : Span = Span (in.offset)): Boolean = {
371369 if (in.newSyntax) {
@@ -2084,7 +2082,7 @@ object Parsers {
20842082 in.nextToken()
20852083 if isVarargSplice then
20862084 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` )}" ,
20882086 in.sourcePos(uscoreStart),
20892087 future)
20902088 if sourceVersion == `future-migration` then
@@ -2160,7 +2158,7 @@ object Parsers {
21602158 val t =
21612159 if (in.token == COLON && location == Location .InBlock ) {
21622160 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` )}" ,
21642162 source.atSpan(Span (start, in.lastOffset)),
21652163 from = future)
21662164 in.nextToken()
@@ -3186,7 +3184,7 @@ object Parsers {
31863184 def wildcardSelector () =
31873185 if in.token == USCORE && sourceVersion.isAtLeast(future) then
31883186 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` )}" ,
31903188 in.sourcePos(),
31913189 from = future)
31923190 patch(source, Span (in.offset, in.offset + 1 ), " *" )
@@ -3205,7 +3203,7 @@ object Parsers {
32053203 if in.token == ARROW || isIdent(nme.as) then
32063204 if in.token == ARROW && sourceVersion.isAtLeast(future) then
32073205 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` )}" ,
32093207 in.sourcePos(),
32103208 from = future)
32113209 patch(source, Span (in.offset, in.offset + 2 ),
0 commit comments