Skip to content
Browse files

* src/main/clojure/clojure/core/match/core.clj: MATCH-22: fix boolean…

… match expression case
  • Loading branch information...
1 parent b2505af commit 66a36260eb77c1920f9db011cdb612d4797665a7 @swannodette swannodette committed Oct 2, 2011
View
5 src/main/clojure/clojure/core/match/core.clj
@@ -508,7 +508,7 @@
(letfn [(expression?
;; Returns true if occurance ocr is an expression
[ocr]
- (-> ocr meta :ocr-expr))
+ (contains? (meta ocr) :ocr-expr))
(bind-variables
;; Return bindings usable by bind-node
[ocrs]
@@ -585,8 +585,7 @@
(and (not (nil? ps))
(empty? ps))))
(has-ocr-expr? [ocrs]
- (some (fn [ocr]
- (-> ocr meta :ocr-expr))
+ (some #(contains? (meta %) :ocr-expr)
ocrs))]
(cond
(empty? rows) (empty-rows-case)
View
5 src/test/clojure/clojure/core/match/test/core.clj
@@ -395,6 +395,11 @@
:else 2)
0)))
+(deftest match-expr-2
+ (is (= (match [false]
+ [false] true)
+ true)))
+
(comment
;; TODO: should not match - David
(let [l '(1 2 3)]

0 comments on commit 66a3626

Please sign in to comment.
Something went wrong with that request. Please try again.