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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "CodeTracking"
uuid = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2"
authors = ["Tim Holy <tim.holy@gmail.com>"]
version = "2.0.0"
version = "2.0.1"

[deps]
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
Expand Down
3 changes: 2 additions & 1 deletion src/CodeTracking.jl
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ function definition(::Type{String}, method::Method)
p = Base.unwrap_unionall(method.sig).parameters
for i = 2:length(p)
T = p[i]
isa(T, Core.TypeofVararg) && break # it's not our target, and there are no more arguments after this
if T <: Function
mstring = string(nameof(T))
if startswith(mstring, '#')
Expand All @@ -237,7 +238,7 @@ function definition(::Type{String}, method::Method)
end
end
end
methodname == :kwcall && error("could not identify method name in `Core.kwcall`")
methodname == :kwcall && error("could not identify method name in `Core.kwcall` (signature: $(method.sig))")
end
file, line = whereis(method)
line == 0 && return nothing
Expand Down
5 changes: 5 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,11 @@ isdefined(Main, :Revise) ? Main.Revise.includet("script.jl") : include("script.j
src, line = definition(String, m)
@test occursin("::Type{P}", src)
@test line == 148

# Graceful handling of `kwcall` definition lookup failure
m = @which Core.kwcall(NamedTuple(), Union{})
@test_throws "could not identify method name in `Core.kwcall`" definition(String, m)
@test_throws "signature: Tuple{typeof(Core.kwcall), Any, Type{Union{}}, Vararg{Any}}" definition(String, m)
end

@testset "With Revise" begin
Expand Down
Loading