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

neil dep add crashes if there's metadata on the :deps map #239

Open
teodorlu opened this issue Aug 15, 2024 · 0 comments
Open

neil dep add crashes if there's metadata on the :deps map #239

teodorlu opened this issue Aug 15, 2024 · 0 comments

Comments

@teodorlu
Copy link
Contributor

teodorlu commented Aug 15, 2024

Reproduction

$ cat deps.edn 
{:deps ^{:teodor/nonsense :YES} {hiccup/hiccup {:mvn/version "1.0.5"}}}

clj appears to be fine with metadata on the deps map:

$ clj -e '{:ok true}'
WARNING: Implicit use of clojure.main with options is deprecated, use -M
{:ok true}

Expected

http-kit dep is added.

Actual

neil dep add crashes:

$ neil dep add http-kit
----- Error --------------------------------------------------------------------
Type:     java.lang.ClassCastException
Message:  clojure.lang.Symbol cannot be cast to java.lang.Number
Location: borkdude/rewrite_edn/impl.cljc:154:13

----- Context ------------------------------------------------------------------
150:                           (iterate z/right)
151:                           (take-while identity)
152:                           (remove #(or (node/whitespace-or-comment? %)
153:                                        (= :uneval (node/tag %)))))]
154:         (if (>= k (count coll))
                 ^--- clojure.lang.Symbol cannot be cast to java.lang.Number
155:           (node/coerce default)
156:           (node/coerce (first (nth coll k))))))))
157: 
158: (defn get-in [zloc ks not-found]
159:   (reduce (fn [zloc k]

----- Stack trace --------------------------------------------------------------
clojure.core/>=                  - <built-in>
borkdude.rewrite-edn.impl/get    - borkdude/rewrite_edn/impl.cljc:154:13
borkdude.rewrite-edn.impl/get    - borkdude/rewrite_edn/impl.cljc:119:1
borkdude.rewrite-edn.impl        - borkdude/rewrite_edn/impl.cljc:162:23
clojure.core/reduce              - <built-in>
... (run with --debug to see elided elements)
babashka.neil                    - /opt/homebrew/bin/neil:1294:27
babashka.neil/-main              - /opt/homebrew/bin/neil:1742:3
babashka.neil/-main              - /opt/homebrew/bin/neil:1741:1
babashka.neil                    - /opt/homebrew/bin/neil:1804:3
babashka.neil                    - /opt/homebrew/bin/neil:1803:1

Does the namespaced map matter?

I still get a crash without a namespaced map in the metadata:

$ cat deps.edn 
{:deps ^{:teodor-nonsense :YES} {hiccup/hiccup {:mvn/version "1.0.5"}}}
$ neil dep add http-kit
----- Error --------------------------------------------------------------------
Type:     java.lang.ClassCastException
Message:  clojure.lang.Symbol cannot be cast to java.lang.Number
Location: borkdude/rewrite_edn/impl.cljc:154:13

----- Context ------------------------------------------------------------------
150:                           (iterate z/right)
151:                           (take-while identity)
152:                           (remove #(or (node/whitespace-or-comment? %)
153:                                        (= :uneval (node/tag %)))))]
154:         (if (>= k (count coll))
                 ^--- clojure.lang.Symbol cannot be cast to java.lang.Number
155:           (node/coerce default)
156:           (node/coerce (first (nth coll k))))))))
157: 
158: (defn get-in [zloc ks not-found]
159:   (reduce (fn [zloc k]

----- Stack trace --------------------------------------------------------------
clojure.core/>=                  - <built-in>
borkdude.rewrite-edn.impl/get    - borkdude/rewrite_edn/impl.cljc:154:13
borkdude.rewrite-edn.impl/get    - borkdude/rewrite_edn/impl.cljc:119:1
borkdude.rewrite-edn.impl        - borkdude/rewrite_edn/impl.cljc:162:23
clojure.core/reduce              - <built-in>
... (run with --debug to see elided elements)
babashka.neil                    - /opt/homebrew/bin/neil:1294:27
babashka.neil/-main              - /opt/homebrew/bin/neil:1742:3
babashka.neil/-main              - /opt/homebrew/bin/neil:1741:1
babashka.neil                    - /opt/homebrew/bin/neil:1804:3
babashka.neil                    - /opt/homebrew/bin/neil:1803:1
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

1 participant