Skip to content

Commit 67df21d

Browse files
committed
Fix a missing metheval if define
Fixes timholy/Revise.jl#568
1 parent c1143d6 commit 67df21d

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/signatures.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ function methoddef!(@nospecialize(recurse), signatures, frame::Frame, @nospecial
436436
sigt, pc = signature(recurse, frame, stmt, pc)
437437
meth = whichtt(sigt)
438438
if isa(meth, Method) && (meth.sig <: sigt && sigt <: meth.sig)
439-
pc = next_or_nothing!(frame)
439+
pc = define ? step_expr!(recurse, frame, stmt, true) : next_or_nothing!(frame)
440440
elseif define
441441
pc = step_expr!(recurse, frame, stmt, true)
442442
meth = whichtt(sigt)

test/signatures.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -398,6 +398,22 @@ bodymethtest5(x, y=Dict(1=>2)) = 5
398398
@test !isempty(signatures) # really we just need to know that `methoddefs!` completed without getting stuck
399399
end
400400

401+
# Scoped names (https://github.com/timholy/Revise.jl/issues/568)
402+
ex = :(f568() = -1)
403+
Core.eval(Lowering, ex)
404+
@test Lowering.f568() == -1
405+
empty!(signatures)
406+
ex = :(f568() = -2)
407+
frame = Frame(Lowering, ex)
408+
pcstop = findfirst(LoweredCodeUtils.ismethod3, frame.framecode.src.code)
409+
pc = 1
410+
while pc < pcstop
411+
pc = JuliaInterpreter.step_expr!(finish_and_return!, frame, true)
412+
end
413+
pc = methoddef!(finish_and_return!, signatures, frame, pc; define=true)
414+
@test Tuple{typeof(Lowering.f568)} signatures
415+
@test Lowering.f568() == -2
416+
401417
# Undefined names
402418
# This comes from FileWatching; WindowsRawSocket is only defined on Windows
403419
ex = quote

0 commit comments

Comments
 (0)