Skip to content

Commit 2964880

Browse files
committed
Introduce gradualErrorOrMigrationWarning
1 parent bc459d2 commit 2964880

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ object report:
7272
if sourceVersion.isMigrating && sourceVersion.ordinal <= from.ordinal then migrationWarning(msg, pos)
7373
else error(msg, pos)
7474

75+
def gradualErrorOrMigrationWarning(msg: Message, pos: SrcPos = NoSourcePosition, warnFrom: SourceVersion, errorFrom: SourceVersion)(using Context): Unit =
76+
if sourceVersion.isAtLeast(errorFrom) then errorOrMigrationWarning(msg, pos, errorFrom)
77+
else if sourceVersion.isAtLeast(warnFrom) then warning(msg, pos)
78+
7579
def restrictionError(msg: Message, pos: SrcPos = NoSourcePosition)(using Context): Unit =
7680
error(msg.mapMsg("Implementation restriction: " + _), pos)
7781

0 commit comments

Comments
 (0)