julia> using Mocking
julia> struct A
a
end
julia> @patch function (a::A)(b) 1 end
ERROR: UndefVarError: a not defined
Stacktrace:
[1] top-level scope
@ REPL[4]:1
Note that ExprTools.jl does handle functors properly:
julia> using ExprTools
julia> splitdef(:(function (a::A)(b) 1 end))
Dict{Symbol, Any} with 4 entries:
:args => Any[:b]
:body => quote…
:name => :(a::A)
:head => :function