Skip to content

update nonlocal-returns.md - add a note about -source:future compiler option #15298

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 27, 2022

Conversation

unkarjedy
Copy link
Contributor

No description provided.

@bishabosha
Copy link
Member

bishabosha commented May 27, 2022

I tested this now and it seems strange that no deprecation warning is produced at all, only an error with future (or migration warning with future-migration).

@bishabosha bishabosha merged commit d0182b4 into scala:language-reference-stable May 27, 2022
@unkarjedy
Copy link
Contributor Author

FTR The warning doesn't appear in Scala 2 by default as well, until Xlint:nonlocal-return compiler option is provided

https://discord.com/channels/632150470000902164/632628489719382036/979406519659532298

@som-snytt
Copy link
Contributor

som-snytt commented May 27, 2022

It was deprecated 4c813c1

      if (!ctx.scala2Mode)
        ctx.strictWarning("Non local returns are deprecated; use scala.util.control.NonLocalReturns instead", tree.sourcePos)

but the mechanism is now errorOrMigration(from = future). Maybe that should be gradualErrorOrMigration(warnFrom = 3.0, errorFrom = 3.2).

Maybe because

[error] -- Error: .../dotty/compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala:265:35
[error] 265 |            case info: PolyType => return toTextMethodAsFunction(info)
[error]     |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error]     |Non local returns are no longer supported; use scala.util.control.NonLocalReturns instead
[error] one error found
[error] (scala3-compiler-bootstrapped / Compile / compileIncremental) Compilation failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants