Skip to content

Commit afeb541

Browse files
Only apply future patches on future-migration (#18820)
Align patch behavior with other migrations warning/errors of `future-migration`/`future` .
2 parents e2b38f9 + 0c66054 commit afeb541

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3525,7 +3525,8 @@ object Parsers {
35253525
em"`_` is no longer supported for a wildcard $exprName; use `*` instead${rewriteNotice(`future-migration`)}",
35263526
in.sourcePos(),
35273527
from = future)
3528-
patch(source, Span(in.offset, in.offset + 1), "*")
3528+
if sourceVersion == `future-migration` then
3529+
patch(source, Span(in.offset, in.offset + 1), "*")
35293530
ImportSelector(atSpan(in.skipToken()) { Ident(nme.WILDCARD) })
35303531

35313532
/** 'given [InfixType]' */
@@ -3544,9 +3545,10 @@ object Parsers {
35443545
em"The $exprName renaming `a => b` is no longer supported ; use `a as b` instead${rewriteNotice(`future-migration`)}",
35453546
in.sourcePos(),
35463547
from = future)
3547-
patch(source, Span(in.offset, in.offset + 2),
3548-
if testChar(in.offset - 1, ' ') && testChar(in.offset + 2, ' ') then "as"
3549-
else " as ")
3548+
if sourceVersion == `future-migration` then
3549+
patch(source, Span(in.offset, in.offset + 2),
3550+
if testChar(in.offset - 1, ' ') && testChar(in.offset + 2, ' ') then "as"
3551+
else " as ")
35503552
atSpan(startOffset(from), in.skipToken()) {
35513553
val to = if in.token == USCORE then wildcardIdent() else termIdent()
35523554
ImportSelector(from, if to.name == nme.ERROR then EmptyTree else to)

0 commit comments

Comments
 (0)