cljs-dev

ClojureScript compiler & std lib dev, https://clojurescript.org/community/dev
borkdude 2020-02-16T20:01:30.014600Z

I'm experiencing a problem with multi-arity macros in self-hosted CLJS in 1.5.520 (planck and lumo):

cljs.user=> (defmacro foo [] '[1 2 3])
#'cljs.user/foo
cljs.user=> (foo)
[1 2 3]
cljs.user=> (defmacro foo ([x] '[1 2 3]) ([x y] '[1 2 3 4]))
#'cljs.user/foo
cljs.user=> (foo 1)
Invalid arity: -1
Could be that this is fixed in CLJS 1.5.597, but I haven't got a planck or lumo running that version.

borkdude 2020-02-16T20:18:02.014900Z

can test later with the newest self-hosted

borkdude 2020-02-16T20:35:58.015300Z

repro:

$ clj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version "1.10.597"}}}' -m cljs.main -re node
ClojureScript 1.10.597
cljs.user=> (require '[cljs.js :refer [eval-str]])
cljs.user=> (eval-str (cljs.js/empty-state) "(ns foo.bar) (defmacro foo ([x] 1) ([x y] 2)) (foo 1)" nil {:eval cljs.js/js-eval } prn)
{:error #error {:message "ERROR", :data {:tag :cljs/analysis-error}, :cause #object[Error Error: Invalid arity: -1]}}
nil

borkdude 2020-02-16T20:36:51.015700Z

if you want me to post an issue, let me know