Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
MATCH-71: map patterns don't exhibit as much test sharing as expected
Was missing a `groupable?` implementation for map patterns, remove
throw logic from `val-at*`, unneeded.
  • Loading branch information
swannodette committed Jun 19, 2013
1 parent f61d515 commit babb964
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/main/clojure/clojure/core/match.clj
Expand Up @@ -101,10 +101,7 @@
(.valAt this k not-found)))

(defn val-at*
([m k] (let [val (val-at m k ::not-found)]
(if (= val ::not-found)
(throw backtrack)
val)))
([m k] (val-at m k ::not-found))
([m k not-found] (val-at m k not-found)))

(defn val-at-expr [& args]
Expand Down Expand Up @@ -1576,6 +1573,10 @@ col with the first column and compile the result"
(defmethod groupable? [PredicatePattern PredicatePattern]
[a b] (= (:gs a) (:gs b)))

(defmethod groupable? [MapPattern MapPattern]
[a b]
(= (-> a meta :only) (-> b meta :only)))

(defmethod groupable? [OrPattern OrPattern]
[a b]
(let [as (:ps a)
Expand Down

0 comments on commit babb964

Please sign in to comment.