signatures: reject BreakpointRef and stray nothing program counters - #168
Merged
Merged
Conversation
`step_expr!` and `next_until!` return a `BreakpointRef` when a
breakpoint
is hit or when `JuliaInterpreter.break_on(:error)`/`break_on(:throw)` is
active and a statement throws. The method-definition walkers in
signatures.jl never handled that case (nor, on some paths, `nothing`),
so `pc` was inferred as `Union{Int,Nothing,BreakpointRef}` and, when it
did happen, failed later with an unrelated error. Concretely, with
`break_on(:error)` enabled (e.g. via Debugger.jl) Revise reported
`ArgumentError: invalid index: breakpoint(...)` instead of the actual
`UndefVarError` for a typo in a method signature, because Revise's
`disablebp` only disables breakpoint instances, not `break_on`.
Add `throw_if_breakpoint`, which rethrows the error carried by the
`BreakpointRef` (what would have propagated without `break_on`) or
raises an error otherwise, and narrows `pc` to `Union{Int,Nothing}`.
Wrap every `step_expr!`/`next_until!` call site with it, handle the
remaining `nothing` cases explicitly (`step_through_methoddef`,
`get_running_name`, the inner-method loop of `methoddef!`), and let
`_methoddefs!` accept `nothing`.
Along the way: assert the `MethodInfoKey` returned by `signature` for a
3-arg `:method`, drop the redundant trailing `frame.pc = pc` (both
`step_expr!` and `next_or_nothing!` already advance it, and it would
throw for `nothing`), and report the "no method found" warning at the
`:method` statement `pc3` rather than the statement after it.
JET no longer reports any `pc`-related issue in signatures.jl; the
LoweredCodeUtils and Revise test suites pass.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
aviatesk
force-pushed
the
avi/handle-breakpointrefs
branch
from
September 16, 2026 06:13
dd1d785 to
c2cce1d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
step_expr!andnext_until!return aBreakpointRefwhen a breakpoint is hit or whenJuliaInterpreter.break_on(:error)/break_on(:throw)is active and a statement throws. The method-definition walkers in signatures.jl never handled that case (nor, on some paths,nothing), sopcwas inferred asUnion{Int,Nothing,BreakpointRef}and, when it did happen, failed later with an unrelated error. Concretely, withbreak_on(:error)enabled (e.g. via Debugger.jl) Revise reportedArgumentError: invalid index: breakpoint(...)instead of the actualUndefVarErrorfor a typo in a method signature, because Revise'sdisablebponly disables breakpoint instances, notbreak_on.Add
throw_if_breakpoint, which rethrows the error carried by theBreakpointRef(what would have propagated withoutbreak_on) or raises an error otherwise, and narrowspctoUnion{Int,Nothing}. Wrap everystep_expr!/next_until!call site with it, handle the remainingnothingcases explicitly (step_through_methoddef,get_running_name, the inner-method loop ofmethoddef!), and let_methoddefs!acceptnothing.Along the way: assert the
MethodInfoKeyreturned bysignaturefor a 3-arg:method, drop the redundant trailingframe.pc = pc(bothstep_expr!andnext_or_nothing!already advance it, and it would throw fornothing), and report the "no method found" warning at the:methodstatementpc3rather than the statement after it.JET(LS) no longer reports any
pc-related issue in signatures.jl; the LoweredCodeUtils and Revise test suites pass.