Skip to content

Commit

Permalink
Prevent refs from being expanded (fixes #107)
Browse files Browse the repository at this point in the history
  • Loading branch information
weavejester committed Jan 20, 2024
1 parent d2a3f93 commit cb17d44
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/integrant/core.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@
(let [m (expand-key k v)
override? (:override (meta m))]
(letfn [(gen-expansions [idx [kn vn] override?]
(if (and (map? vn) (seq vn))
(if (and (map? vn) (not (reflike? vn)) (seq vn))
(let [override? (or override? (:override (meta vn)))]
(mapcat #(gen-expansions (conj idx kn) % override?) vn))
(list {:key k
Expand Down
7 changes: 6 additions & 1 deletion test/integrant/core_test.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,12 @@
(is (= (ig/expand {[::one ::mod-c] 1
[::two ::mod-c] 2
::c ^:override {:x {:y {:z 3}}}})
{::c {:x {:y {:z 3}}}}))))
{::c {:x {:y {:z 3}}}})))
(testing "expand with refs"
(let [m {::a (ig/ref ::b) ::b 1}]
(is (= m (ig/expand m))))
(let [m {::a (ig/refset ::b) ::b 1}]
(is (= m (ig/expand m))))))

(deftest init-test
(testing "without keys"
Expand Down

0 comments on commit cb17d44

Please sign in to comment.