Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Functors are not valid targets for @patch #84

Open
omus opened this issue Mar 29, 2021 · 0 comments
Open

Functors are not valid targets for @patch #84

omus opened this issue Mar 29, 2021 · 0 comments

Comments

@omus
Copy link
Member

omus commented Mar 29, 2021

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant