I found a bug in Clojurescript 1.12.38, note the var with a -, and the var with an _
If I destructure it differently, ie. {pid :product_uuid} it does work, also if you run the code below in a Clojure REPL it also works.
(defn f [product-uuid]
(mapv (fn [{:keys [product_uuid] :as x}]
(when (= product-uuid product_uuid)
x))
[{:product_uuid 1}]))
(f 1) ;; => [{:product_uuid 1}]
;; should be [nil]
(f 2) ;; actually is => [{:product_uuid 1}](let [a-b 1
a_b 2
c-d 3
c_d 4
_ 5
- 6]
[a-b a_b c-d c_d _ -])
=> [2 2 4 4 6 6]seems to work in squint: https://squint-cljs.github.io/squint/?src=KGRlZm4gZiBbcHJvZHVjdC11dWlkXQogICAgKG1hcHYgKGZuIFt7OmtleXMgW3Byb2R1Y3RfdXVpZF0gOmFzIHh9XQogICAgICAgICAgICAod2hlbiAoPSBwcm9kdWN0LXV1aWQgcHJvZHVjdF91dWlkKQogICAgICAgICAgICAgIHgpKQogICAgICBbezpwcm9kdWN0X3V1aWQgMX1dKSkKCihmIDIp https://squint-cljs.github.io/squint/?src=KGxldCBbYS1iIDEKICAgICAgYV9iIDIKICAgICAgYy1kIDMKICAgICAgY19kIDQKICAgICAgXyA1CiAgICAgIC0gNl0KICBbYS1iIGFfYiBjLWQgY19kIF8gLV0p ;P
amazing
It's a known thing.
FWIW I don't seem to have that issue with 1.12.42.
🤔
I'm very confused: I can reproduce the [2 2 4 4 6 6] result in a repl, but not when I put the same code in my source files.
This might be https://clojure.atlassian.net/browse/CLJS-3426 ?
yeah that’s the same,.. ok
This is probably the worst place to post this, but it was a confusing 30 minutes before I figured out what was going on :-)
tldr; _ = -