diff --git a/compiler/src/dotty/tools/dotc/report.scala b/compiler/src/dotty/tools/dotc/report.scala index 1d8ca5f208fa..c77d4eb2fc7e 100644 --- a/compiler/src/dotty/tools/dotc/report.scala +++ b/compiler/src/dotty/tools/dotc/report.scala @@ -99,7 +99,7 @@ object report: def errorOrMigrationWarning(msg: Message, pos: SrcPos, migrationVersion: MigrationVersion)(using Context): Unit = if sourceVersion.isAtLeast(migrationVersion.errorFrom) then - if !sourceVersion.isMigrating then error(msg, pos) + if sourceVersion != migrationVersion.errorFrom.prevMigrating then error(msg, pos) else if ctx.settings.rewrite.value.isEmpty then migrationWarning(msg, pos) else if sourceVersion.isAtLeast(migrationVersion.warnFrom) then warning(msg, pos) diff --git a/tests/neg/migrate-once.scala b/tests/neg/migrate-once.scala new file mode 100644 index 000000000000..da5b76e4fb8c --- /dev/null +++ b/tests/neg/migrate-once.scala @@ -0,0 +1,5 @@ +//> using options -source:3.5-migration + +object Test: + for Some(x) <- Seq(Option(1)) yield x // error + // was warn before changes, but should warn only until 3.4-migration