Skip to content

Commit 4248321

Browse files
committed
Handle 2.13 specially for migration warnings and errors
Move 2.13 back to its original place in front of future, but disable all migration warnings and errors for it.
1 parent b5d20c8 commit 4248321

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

compiler/src/dotty/tools/dotc/config/SourceVersion.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import Feature.isPreviewEnabled
88
import util.Property
99

1010
enum SourceVersion:
11-
case `2.13`
1211

1312
case `3.0-migration`, `3.0`
1413
case `3.1-migration`, `3.1`
@@ -22,6 +21,7 @@ enum SourceVersion:
2221
case `3.9-migration`, `3.9`
2322
// Add 3.x-migration and 3.x here
2423
// !!! Keep in sync with scala.runtime.stdlibPatches.language !!!
24+
case `2.13`
2525
case `future-migration`, `future`
2626

2727
case `never` // needed for MigrationVersion.errorFrom if we never want to issue an error

compiler/src/dotty/tools/dotc/report.scala

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,12 @@ object report:
9898
ctx.reporter.report(new Error(fullMsg, NoSourcePosition))
9999

100100
def errorOrMigrationWarning(msg: Message, pos: SrcPos, migrationVersion: MigrationVersion)(using Context): Unit =
101-
if sourceVersion.isAtLeast(migrationVersion.errorFrom) then
102-
if sourceVersion != migrationVersion.errorFrom.prevMigrating then error(msg, pos)
103-
else if ctx.settings.rewrite.value.isEmpty then migrationWarning(msg, pos)
104-
else if sourceVersion.isAtLeast(migrationVersion.warnFrom) then warning(msg, pos)
101+
if sourceVersion != SourceVersion.`2.13` then
102+
// ignore errors or warningsfor Scala 2 stdlib sources
103+
if sourceVersion.isAtLeast(migrationVersion.errorFrom) then
104+
if sourceVersion != migrationVersion.errorFrom.prevMigrating then error(msg, pos)
105+
else if ctx.settings.rewrite.value.isEmpty then migrationWarning(msg, pos)
106+
else if sourceVersion.isAtLeast(migrationVersion.warnFrom) then warning(msg, pos)
105107

106108
def restrictionError(msg: Message, pos: SrcPos = NoSourcePosition)(using Context): Unit =
107109
error(msg.mapMsg("Implementation restriction: " + _), pos)

0 commit comments

Comments
 (0)