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

Splitdef errors on anonymous function with a single varargs argument #185

Open
julbinb opened this issue May 29, 2022 · 1 comment
Open

Comments

@julbinb
Copy link

julbinb commented May 29, 2022

splitdef fails with an assertion on an anonymous function with a single varargs argument:

julia> splitdef(Meta.parse(" (args...) -> 0 "))
ERROR: ArgumentError: Not a function definition: :(args...->begin
          #= none:1 =#
          0
      end)
Stacktrace:
 [1] splitdef(fdef::Expr)
   @ MacroTools ~/.julia/packages/MacroTools/PP9IQ/src/utils.jl:317

Either adding another argument or using the long form of the definition is fine:

julia> splitdef(Meta.parse(" (x, args...) -> 0 "))
Dict{Symbol, Any} with 4 entries:
  :args        => Any[:x, :(args...)]
  :body        => quote
  :kwargs      => Any[]
  :whereparams => ()

julia> splitdef(Meta.parse(" function f(args...) 0 end "))
Dict{Symbol, Any} with 5 entries:
  :name        => :f
  :args        => Any[:(args...)]
  :kwargs      => Any[]
  :body        => quote
  :whereparams => ()
@cstjean
Copy link
Collaborator

cstjean commented Jun 2, 2022

PR welcome!

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

2 participants