Skip to content

Commit a156cbe

Browse files
committed
More errorOrMigrationWarnings cleanups
1 parent 792b9f7 commit a156cbe

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

compiler/src/dotty/tools/dotc/transform/NonLocalReturns.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,10 @@ class NonLocalReturns extends MiniPhase {
8989

9090
override def transformReturn(tree: Return)(using Context): Tree =
9191
if isNonLocalReturn(tree) then
92-
if sourceVersion.isAtLeast(future) then
93-
report.errorOrMigrationWarning("Non local returns are no longer supported; use scala.util.control.NonLocalReturns instead", tree.srcPos)
92+
report.errorOrMigrationWarning(
93+
"Non local returns are no longer supported; use scala.util.control.NonLocalReturns instead",
94+
tree.srcPos,
95+
from = future)
9496
nonLocalReturnThrow(tree.expr, tree.from.symbol).withSpan(tree.span)
9597
else tree
9698
}

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2472,8 +2472,11 @@ class Typer extends Namer
24722472
def remedy =
24732473
if ((prefix ++ suffix).isEmpty) "simply leave out the trailing ` _`"
24742474
else s"use `$prefix<function>$suffix` instead"
2475-
report.errorOrMigrationWarning(i"""The syntax `<function> _` is no longer supported;
2476-
|you can $remedy""", tree.srcPos, future)
2475+
report.errorOrMigrationWarning(
2476+
i"""The syntax `<function> _` is no longer supported;
2477+
|you can $remedy""",
2478+
tree.srcPos,
2479+
from = future)
24772480
if sourceVersion.isMigrating then
24782481
patch(Span(tree.span.start), prefix)
24792482
patch(Span(qual.span.end, tree.span.end), suffix)

0 commit comments

Comments
 (0)