From d43dc71e04c49316e8fd89b1d20026f400a93f99 Mon Sep 17 00:00:00 2001 From: Wes Morgan Date: Wed, 12 Apr 2023 11:09:12 -0600 Subject: [PATCH] Fix issue #775 --- src/malli/error.cljc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/malli/error.cljc b/src/malli/error.cljc index 2c3740885..6a666f4f4 100644 --- a/src/malli/error.cljc +++ b/src/malli/error.cljc @@ -146,9 +146,12 @@ (defn -fill [x i fill] (-concat x (repeat (- i (count x)) fill))) (defn -push [x k v fill] - (let [x' (cond-> x (and (int? k) (sequential? x) (> k (count x))) (-fill k fill))] - (cond (or (nil? x') (associative? x')) (assoc x' k v) - (set? x') (conj x' v) + (let [i (when (int? k) k) + x' (cond-> x (and i (sequential? x) (> k (count x))) (-fill k fill))] + (cond (nil? x') (assoc x' k v) + (and (associative? x') i) (assoc x' i v) + (or (set? x') (vector? x')) (conj x' v) + (associative? x') (assoc x' k v) :else (apply list (assoc (vec x') k v))))) (defn -push-in [a v [p & ps] e]