Skip to content

track doesn't work anymore due to non-local returns #6934

Closed
@anatoliykmetyuk

Description

@anatoliykmetyuk

If you set this flag to true and try to compile the compiler, you'll get a bunch of errors as follows:

[error] -- Error: /Users/anatolii/Projects/dotty/dotty/compiler/src/dotty/tools/dotc/typer/Applications.scala:944:6
[error] 944 |      return errorTree(tree, "invalid pattern")
[error]     |      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error]     |Non local returns are deprecated; use scala.util.control.NonLocalReturns instead
[error]     |(This would be an error under strict mode)

Context:

  def typedTypeApply(tree: untpd.TypeApply, pt: Type)(implicit ctx: Context): Tree = track("typedTypeApply") {
    if (ctx.mode.is(Mode.Pattern)) {
      return errorTree(tree, "invalid pattern")
    }
   /*...*/

track is defined as follows.

7 errors of this kind overall
[error] -- Error: /Users/anatolii/Projects/dotty/dotty/compiler/src/dotty/tools/dotc/typer/Applications.scala:944:6
[error] 944 |      return errorTree(tree, "invalid pattern")
[error]     |      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error]     |Non local returns are deprecated; use scala.util.control.NonLocalReturns instead
[error]     |(This would be an error under strict mode)
[error] -- Error: /Users/anatolii/Projects/dotty/dotty/compiler/src/dotty/tools/dotc/typer/Typer.scala:374:8
[error] 374 |        return tree.withType(pt)
[error]     |        ^^^^^^^^^^^^^^^^^^^^^^^^
[error]     |Non local returns are deprecated; use scala.util.control.NonLocalReturns instead
[error]     |(This would be an error under strict mode)
[error] -- Error: /Users/anatolii/Projects/dotty/dotty/compiler/src/dotty/tools/dotc/typer/Typer.scala:376:8
[error] 376 |        return typed(desugar.patternVar(tree), pt)
[error]     |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error]     |Non local returns are deprecated; use scala.util.control.NonLocalReturns instead
[error]     |(This would be an error under strict mode)
[error] -- Error: /Users/anatolii/Projects/dotty/dotty/compiler/src/dotty/tools/dotc/typer/Typer.scala:382:6
[error] 382 |      return tree.withType(defn.RootPackage.termRef)
[error]     |      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error]     |Non local returns are deprecated; use scala.util.control.NonLocalReturns instead
[error]     |(This would be an error under strict mode)
[error] -- Error: /Users/anatolii/Projects/dotty/dotty/compiler/src/dotty/tools/dotc/typer/Typer.scala:412:8
[error] 412 |        return ref(defn.XMLTopScopeModule.termRef)
[error]     |        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error]     |Non local returns are deprecated; use scala.util.control.NonLocalReturns instead
[error]     |(This would be an error under strict mode)
[error] -- Error: /Users/anatolii/Projects/dotty/dotty/compiler/src/dotty/tools/dotc/typer/Typer.scala:1510:6
[error] 1510 |      return EmptyTree
[error]      |      ^^^^^^^^^^^^^^^^
[error]      |Non local returns are deprecated; use scala.util.control.NonLocalReturns instead
[error]      |(This would be an error under strict mode)
[error] -- Error: /Users/anatolii/Projects/dotty/dotty/compiler/src/dotty/tools/dotc/typer/Typer.scala:1582:43
[error] 1582 |    if (!cls.info.isInstanceOf[ClassInfo]) return EmptyTree.assertingErrorsReported
[error]      |                                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[error]      |Non local returns are deprecated; use scala.util.control.NonLocalReturns instead
[error]      |(This would be an error under strict mode)
[error] 7 errors found

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions