ClojureScript

Setting :arglists metadata when vararg is present

Details

  • Type: Defect Defect
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: 1.9.908
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Environment:
    I'm running cljs 1.9.909 with figwheel and lumo 1.7, bug is present in both environments.
  • Approval:
    Vetted

Description

consider function with no parameters

(defn aarg {:arglists '([fake])} [])
=> {:ns cljs.user,
 :name aarg,
 :file nil,
 :end-column 11,
 :column 1,
 :line 1,
 :end-line 1,
 :arglists ([fake]),
 :doc nil,
 :test nil}

All works as expected, but with the introduction of a vararg

(defn aarg {:arglists '([fake])} [& env])
(meta #'aarg)
=> {:ns cljs.user,
 :name aarg,
 :file nil,
 :end-column 11,
 :top-fn {:variadic true,
          :max-fixed-arity 0,
          :method-params [(env)],
          :arglists ([& env]),
          :arglists-meta (nil)},
 :column 1,
 :line 1,
 :end-line 1,
 :arglists ([& env]),
 :doc nil,
 :test nil}

:arglists does not get affected.

Activity

Hide
Hlöðver Sigurðsson added a comment -

I just submitted a patch, never used jira patch system before, that aside, the patch will make the compiler respect :arglists metadata when the user provdes one. Hope to get feedback and merge on this

Show
Hlöðver Sigurðsson added a comment - I just submitted a patch, never used jira patch system before, that aside, the patch will make the compiler respect :arglists metadata when the user provdes one. Hope to get feedback and merge on this
Hide
David Nolen added a comment -

Thanks have you submitted your Clojure CA?

Show
David Nolen added a comment - Thanks have you submitted your Clojure CA?
Hide
David Nolen added a comment -

Patch review, I don't really understand the purpose the changing arity of variadic-fn and adding this new flag. Just put the logic directly into variadic-fn no?

Show
David Nolen added a comment - Patch review, I don't really understand the purpose the changing arity of variadic-fn and adding this new flag. Just put the logic directly into variadic-fn no?
Hide
Hlöðver Sigurðsson added a comment -

Yes, I'll find a better solution to my patch, just that the `m` symbol in the let binding on line 3176

m (conj {:arglists (core/list 'quote (sigs fdecl))} m)

Merges the arglists and there's after this point no way to know if the :arglists came from a provided metadata or not. But I'll rename the let symbols and it's easy to avoid adding arity, I'll do another patch later today.

No haven't submitted my Clojure Contibutor Agreement, I'm filling it out now...

Show
Hlöðver Sigurðsson added a comment - Yes, I'll find a better solution to my patch, just that the `m` symbol in the let binding on line 3176
m (conj {:arglists (core/list 'quote (sigs fdecl))} m)
Merges the arglists and there's after this point no way to know if the :arglists came from a provided metadata or not. But I'll rename the let symbols and it's easy to avoid adding arity, I'll do another patch later today. No haven't submitted my Clojure Contibutor Agreement, I'm filling it out now...

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated: