julia
c9efeef0 - lowering: fix @goto into while loop causing UndefVarError (#61148)

Commit
19 days ago
lowering: fix @goto into while loop causing UndefVarError (#61148) When `@goto` jumps into a while loop body, the initialization of the `loop_exit_result` variable at the top of the symbolicblock is skipped. When `break` then jumps to the end of the symbolicblock, the uninitialized variable is read, causing an UndefVarError. Fix this by replacing the upfront initialization with an `isdefined` check at the symbolicblock exit. If the result variable was never assigned (because the entry was skipped via `@goto`), it falls back to `nothing`. Fixes #61129 --------- Co-authored-by: Keno Fischer <Keno@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Author
Parents
Loading