Skip to content

Commit

Permalink
fix issue when using an atomic literal to short-circuit an if-some
Browse files Browse the repository at this point in the history
  • Loading branch information
cgrand committed Nov 30, 2023
1 parent 1883100 commit 7c98a84
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions clj/src/cljd/core.cljd
Original file line number Diff line number Diff line change
Expand Up @@ -600,11 +600,12 @@
(nil? oldform) "1 or 2 forms after binding vector"
(= 2 (count bindings)) "exactly 2 forms in binding vector")
(let [form (bindings 0) tst (bindings 1)
temp `some#]
`(let [~temp ~(vary-meta tst dissoc :tag)]
temp `some#
tag (:tag (meta tst))]
`(let [~temp ~(cond-> tst tag (vary-meta dissoc :tag))]
(if (nil? ~temp)
~else
(let [~form ~(vary-meta temp assoc :tag (:tag (meta tst)))]
(let [~form ~(vary-meta temp assoc :tag tag)]
~then))))))

(defmacro when-some
Expand Down

0 comments on commit 7c98a84

Please sign in to comment.