Skip to content

Commit 6c019bc

Browse files
committed
Tighten requirements for migration mode
We now issue a migration warning only if the source version is migrating and exactly one before the current source. Previously, a migration warning intended for 3.0-migration would also have been issued for future-migration. Also, fix error message for viewbounds.
1 parent 98e3839 commit 6c019bc

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1824,7 +1824,7 @@ object Parsers {
18241824
} :: contextBounds(pname)
18251825
case VIEWBOUND =>
18261826
report.errorOrMigrationWarning(
1827-
"view bounds `<%' are deprecated, use a context bound `:' instead",
1827+
"view bounds `<%' are no longer supported, use a context bound `:' instead",
18281828
in.sourcePos())
18291829
atSpan(in.skipToken()) {
18301830
Function(Ident(pname) :: Nil, toplevelTyp())

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ object report:
7878
def errorOrMigrationWarning(msg: Message, pos: SrcPos = NoSourcePosition,
7979
from: SourceVersion = SourceVersion.defaultSourceVersion)(using Context): Unit =
8080
if sourceVersion.isAtLeast(from) then
81-
if sourceVersion.isMigrating then migrationWarning(msg, pos)
81+
if sourceVersion.ordinal < from.ordinal then migrationWarning(msg, pos)
8282
else error(msg, pos)
8383

8484
def restrictionError(msg: Message, pos: SrcPos = NoSourcePosition)(using Context): Unit =

tests/neg/i11567.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import language.`future-migration`
2+
class Test
3+
object Test {
4+
def foo[A <% Test](x: A) = x // error
5+
}

0 commit comments

Comments
 (0)