Skip to content

Commit 8092951

Browse files
authored
Force fresh lookup of methods defined at the REPL (fixes #38) (#39)
The signature is the same, but the "file" may be different. Consequently we shouldn't do signature-based lookup, we should simply look it up again.
1 parent a408c96 commit 8092951

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/CodeTracking.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ Return the file and line of the definition of `method`. `line`
4848
is the first line of the method's body.
4949
"""
5050
function whereis(method::Method)
51+
file, line = String(method.file), method.line
52+
startswith(file, "REPL[") && return file, line
5153
lin = get(method_info, method.sig, nothing)
5254
if lin === nothing
5355
f = method_lookup_callback[]
@@ -60,7 +62,6 @@ function whereis(method::Method)
6062
end
6163
end
6264
if lin === nothing || ismissing(lin)
63-
file, line = String(method.file), method.line
6465
else
6566
file, line = fileline(lin[1])
6667
end
@@ -224,7 +225,8 @@ end
224225
Return an expression that defines `method`.
225226
"""
226227
function definition(::Type{Expr}, method::Method)
227-
def = get(method_info, method.sig, nothing)
228+
file = String(method.file)
229+
def = startswith(file, "REPL[") ? nothing : get(method_info, method.sig, nothing)
228230
if def === nothing
229231
f = method_lookup_callback[]
230232
if f !== nothing

0 commit comments

Comments
 (0)