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.

  1. CLJS-2351.patch
    09/Dec/17 8:52 PM
    2 kB
    Hlöðver Sigurðsson
  2. CLJS-2351-1.patch
    12/Dec/17 1:46 PM
    3 kB
    Hlöðver Sigurðsson

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...
Hide
Hlöðver Sigurðsson added a comment -

Yesterday I signed the Clojure CA
"Clojure CA between Rich Hickey and Hlöðver Sigurðsson is Signed and Filed!"

The code:
The symbol name m (for metadata) is already not very good, but I just added a comma to differentiate between vararg-fn case and the other cases.

I found as I was testing this that multi-arity-fn arglist metadata does not work with or without specifically adding arglists. If so, I can open another jira ticket for that.

Show
Hlöðver Sigurðsson added a comment - Yesterday I signed the Clojure CA "Clojure CA between Rich Hickey and Hlöðver Sigurðsson is Signed and Filed!" The code: The symbol name m (for metadata) is already not very good, but I just added a comma to differentiate between vararg-fn case and the other cases. I found as I was testing this that multi-arity-fn arglist metadata does not work with or without specifically adding arglists. If so, I can open another jira ticket for that.

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated: