Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/CodeTracking.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,13 @@ function whereis(method::Method)
file, line = fileline(lin[1])
end
if !isabspath(file)
# This is a Base or Core method
file = Base.find_source_file(file)
# This may be a Base or Core method
newfile = Base.find_source_file(file)
if isa(newfile, AbstractString)
file = normpath(newfile)
end
end
return normpath(file), line
return file, line
end

"""
Expand Down
6 changes: 6 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,10 @@ include("script.jl")

@test pkgfiles("ColorTypes") === nothing
@test_throws ErrorException pkgfiles("NotAPkg")

# Test that definitions at the REPL work with `whereis`
ex = Base.parse_input_line("replfunc(x) = 1"; filename="REPL[1]")
eval(ex)
m = first(methods(replfunc))
@test whereis(m) == ("REPL[1]", 1)
end