Browse files

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...
1 parent f61d515 commit babb964413c2dc0058b4bb36f9a903a9de74f755 @swannodette swannodette committed Jun 19, 2013
Showing with 5 additions and 4 deletions.
  1. +5 −4 src/main/clojure/clojure/core/match.clj
@@ -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]
@@ -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)

0 comments on commit babb964

Please sign in to comment.