Fork me on GitHub
#cljs-dev
<
2020-02-16
>
borkdude20:02:30

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.

borkdude20:02:02

can test later with the newest self-hosted

borkdude20:02:58

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

borkdude20:02:51

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