<< Back to previous view

[MATCH-35] Bug in seq pattern matching Created: 27/Oct/11  Updated: 28/Jul/13  Resolved: 16/Jun/13

Status: Closed
Project: core.match
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Critical
Reporter: David Nolen Assignee: David Nolen
Resolution: Completed Votes: 0
Labels: None


 Description   
(let [l '(1 2 3)]
    (match [l]
      [([a & [b & [c d]]] :seq)] :a0
      :else :a1))

Matches when it shouldn't.



 Comments   
Comment by Greg Chapman [ 11/Jan/12 10:24 AM ]

Another example of (I think) the same issue:

user=> (let [x ()] (match [x] [([h & t] :seq)] [h t] [_] :a1))
[nil ()]

Perhaps SeqPattern's IPatternCompile should call seq in order to filter empty seqs? (e.g.:

(to-source* [this ocr]
`(and (or (seq? ~ocr) (sequential? ~ocr)) (seq ~ocr)))

Comment by David Nolen [ 16/Jun/13 10:38 PM ]

fixed, http://github.com/clojure/core.match/commit/37564e32d34547e7d8a71f7abc631cce9585dd4e

Generated at Sun Sep 21 21:25:33 CDT 2014 using JIRA 4.4#649-r158309.