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
1 change: 1 addition & 0 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ function checkname(fdef::Expr, name)
(fdef.head === :where || fdef.head == :(::)) && return checkname(fproto, name)
fdef.head === :call || return false
if fproto isa Expr
fproto.head == :(::) && return fproto.args[2] == name
# A metaprogramming-generated function
fproto.head === :$ && return true # uncheckable, let's assume all is well
# Is the check below redundant?
Expand Down
9 changes: 9 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -252,3 +252,12 @@ end
body, _ = CodeTracking.definition(String, @which Foo.Bar.fit(1, 2))
@test body == "Foo.Bar.fit(a, b) = a + b"
end

struct CallOverload
z
end
(f::CallOverload)(arg) = f.z + arg
@testset "call syntax" begin
body, _ = CodeTracking.definition(String, @which CallOverload(1)(1))
@test body == "(f::CallOverload)(arg) = f.z + arg"
end