Skip to content

Fix source version in migration message #11517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler/src/dotty/tools/dotc/parsing/Parsers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3119,7 +3119,7 @@ object Parsers {
def wildcardSelector() =
if in.token == USCORE && sourceVersion.isAtLeast(future) then
report.errorOrMigrationWarning(
em"`_` is no longer supported for a wildcard import; use `*` instead${rewriteNotice("3.1")}",
em"`_` is no longer supported for a wildcard import; use `*` instead${rewriteNotice("future")}",
in.sourcePos())
patch(source, Span(in.offset, in.offset + 1), "*")
ImportSelector(atSpan(in.skipToken()) { Ident(nme.WILDCARD) })
Expand All @@ -3137,7 +3137,7 @@ object Parsers {
if in.token == ARROW || isIdent(nme.as) then
if in.token == ARROW && sourceVersion.isAtLeast(future) then
report.errorOrMigrationWarning(
em"The import renaming `a => b` is no longer supported ; use `a as b` instead${rewriteNotice("3.1")}",
em"The import renaming `a => b` is no longer supported ; use `a as b` instead${rewriteNotice("future")}",
in.sourcePos())
patch(source, Span(in.offset, in.offset + 2),
if testChar(in.offset - 1, ' ') && testChar(in.offset + 2, ' ') then "as"
Expand Down
5 changes: 5 additions & 0 deletions tests/neg/i11487.check
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- Error: tests/neg/i11487.scala:2:13 ----------------------------------------------------------------------------------
2 |import scala._ // error
| ^
| `_` is no longer supported for a wildcard import; use `*` instead
| This construct can be rewritten automatically under -rewrite -source future-migration.
4 changes: 4 additions & 0 deletions tests/neg/i11487.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import language.future
import scala._ // error

object Test