From ce38883e64ed6b8c5d5f574ede4367aac4d9af67 Mon Sep 17 00:00:00 2001 From: Nathan Marz Date: Sat, 29 Oct 2016 16:02:56 -0400 Subject: [PATCH] fix flattening/type-conversion of sequential params during inline caching --- src/clj/com/rpl/specter/impl.cljc | 4 +++- test/com/rpl/specter/core_test.cljc | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/clj/com/rpl/specter/impl.cljc b/src/clj/com/rpl/specter/impl.cljc index aea582a..1e255e7 100644 --- a/src/clj/com/rpl/specter/impl.cljc +++ b/src/clj/com/rpl/specter/impl.cljc @@ -604,7 +604,9 @@ (defn- magic-precompilation* [o] (cond (sequential? o) - (flatten (map magic-precompilation* o)) + (if (list? o) + (map magic-precompilation* o) + (into (empty o) (map magic-precompilation* o))) (instance? VarUse o) (if (dynamic-var? (:var o)) diff --git a/test/com/rpl/specter/core_test.cljc b/test/com/rpl/specter/core_test.cljc index 2e23cc5..aa51079 100644 --- a/test/com/rpl/specter/core_test.cljc +++ b/test/com/rpl/specter/core_test.cljc @@ -1302,3 +1302,6 @@ (let [res (setval [s/ALL s/FIRST] "a" {:a 1 :b 2})] (is (= {"a" 2} res)) (is (= 1 (count res))))) + +(deftest inline-caching-vector-params-test + (is (= [10 [11]] (multi-transform (s/terminal-val [10 [11]]) :a))))