Skip to content

Conversation

@IanButterworth
Copy link
Member

Add syntax errors when @goto is used to jump out of try, catch, or else blocks when a finally block is present.

Fixes #60972

@IanButterworth IanButterworth added the needs pkgeval Tests for all registered packages should be run with this change label Feb 10, 2026
@Keno
Copy link
Member

Keno commented Feb 10, 2026

In the unlikely event that pkgeval comes back negative, I will note that it is possible to use syntax evolution to detect the syntax version of the calling module.

@oscardssmith oscardssmith added the triage This should be discussed on a triage call label Feb 10, 2026
Add syntax errors when `@goto` is used to jump out of try, catch, or else blocks when a finally block is present.

Fixes JuliaLang#60972

Co-Authored-By: Claude <[email protected]>
@oscardssmith
Copy link
Member

oscardssmith commented Feb 12, 2026

Triage likes this (especially that it parallels goto within try with finally)

julia> function f()
           try
               @goto hi
           catch
               return 1
           finally
              return 3
           end
           @label hi
           return 2
       end
ERROR: syntax: goto from a try/finally block is not permitted around REPL[6]:2
Stacktrace:
 [1] top-level scope
   @ REPL[6]:1

Triage also thinks that this should probably done via syntax evolution (potentially with a deprecation warning). We built ourselves a mechanism for evolving the language syntax so we should be using it.

@oscardssmith oscardssmith removed the triage This should be discussed on a triage call label Feb 12, 2026
@oscardssmith
Copy link
Member

@nanosoldier runtests()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs pkgeval Tests for all registered packages should be run with this change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@goto in a catch skips finally

3 participants