Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit babb964413c2dc0058b4bb36f9a903a9de74f755 1 parent f61d515
@swannodette swannodette authored
Showing with 5 additions and 4 deletions.
  1. +5 −4 src/main/clojure/clojure/core/match.clj
View
9 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)
Please sign in to comment.
Something went wrong with that request. Please try again.