From a37e9d0d4e3fd5a9bfb79b81bd17b2235dca5ac0 Mon Sep 17 00:00:00 2001 From: Sam Schweigel Date: Thu, 5 Feb 2026 20:13:06 -0800 Subject: [PATCH] Fix destructuring signature() return value before nothing check In 3b60b6a32cfd5803341f7e791683c53be0631d2b, the return type of signature() was changed from `Tuple{Union{Nothing, Type}, PC}` to `Tuple{Union{Nothing, MethodInfoKey}, PC}`:(where PC = `Union{Int, BreakpointRef}`), but the check for `nothing` wasn't moved before the destructuring of the `MethodInfoKey`. This cuased the (caught) exception described intimholy/Revise.jl#1002. --- src/signatures.jl | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/signatures.jl b/src/signatures.jl index 5b8132a..6fe00ac 100644 --- a/src/signatures.jl +++ b/src/signatures.jl @@ -446,8 +446,9 @@ function get_running_name(interp::Interpreter, frame::Frame, pc::Int, name::Glob pctop -= 1 stmt = pc_expr(frame, pctop) end # end fix - (mt, sigtparent), lastpcparent = signature(interp, frame, pctop) - sigtparent === nothing && return name, pc, lastpcparent + methinfo, lastpcparent = signature(interp, frame, pctop) + methinfo === nothing && return name, pc, lastpcparent + mt, sigtparent = methinfo methparent = whichtt(sigtparent, mt) methparent === nothing && return name, pc, lastpcparent # caller isn't defined, no correction is needed if isgen @@ -598,7 +599,7 @@ function methoddef!(interp::Interpreter, signatures::Vector{MethodInfoKey}, fram end found || return nothing while true # methods containing inner methods may need multiple trips through this loop - (mt, sigt), pc = signature(interp, frame, stmt, pc) + methinfo, pc = signature(interp, frame, stmt, pc) stmt = pc_expr(frame, pc) while !isexpr(stmt, :method, 3) pc = next_or_nothing(interp, frame, pc) # this should not check define, we've probably already done this once @@ -608,7 +609,8 @@ function methoddef!(interp::Interpreter, signatures::Vector{MethodInfoKey}, fram pc3 = pc stmt = stmt::Expr name3 = normalize_defsig(stmt.args[1], frame) - sigt === nothing && (error("expected a signature"); return next_or_nothing(interp, frame, pc)), pc3 + methinfo === nothing && (error("expected a signature"); return next_or_nothing(interp, frame, pc)), pc3 + mt, sigt = methinfo # Methods like f(x::Ref{<:Real}) that use gensymmed typevars will not have the *exact* # signature of the active method. So let's get the active signature. frame.pc = pc