<< Back to previous view

[MATCH-16] Empty Vector Patterns Fail to Match Created: 25/Sep/11  Updated: 28/Jul/13  Resolved: 25/Sep/11

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

Type: Defect Priority: Major
Reporter: Ambrose Bonnaire-Sergeant Assignee: David Nolen
Resolution: Completed Votes: 0
Labels: None


 Description   

(match [[]]
[[]] "asdf")
#<RuntimeException java.lang.RuntimeException: java.lang.Exception: No match found. Followed 0 branches. Breadcrumbs: []>

Macro-expand'd:

(let*
[ocr-4856 []]
(clojure.core/cond
(clojure.core/and
(clojure.core/instance? clojure.lang.IPersistentVector ocr-4856)
(clojure.core/= (clojure.core/count ocr-4856) 1)) (clojure.core/let
[ocr-4856_0__4857
(clojure.core/nth
ocr-4856
0)]
(clojure.core/cond
(clojure.core/=
ocr-4856_0__4857
nil)
"asdf"
:else
(throw
(java.lang.Exception.
(clojure.core/str
"No match found. "
"Followed "
1
" branches."
" Breadcrumbs: "
'[(clojure.core/and
(clojure.core/instance?
clojure.lang.IPersistentVector
ocr-4856)
(clojure.core/=
(clojure.core/count
ocr-4856)
1))])))))
:else (throw
(java.lang.Exception.
(clojure.core/str
"No match found. "
"Followed "
0
" branches."
" Breadcrumbs: "
'[])))))

Clearly this test is the issue: (clojure.core/= (clojure.core/count ocr-4856) 1))



 Comments   
Comment by Ambrose Bonnaire-Sergeant [ 25/Sep/11 5:15 AM ]

Bah, I'll try again:

(match [[]] 
         [[]] "asdf")
#<RuntimeException java.lang.RuntimeException: java.lang.Exception: No match found. Followed 0 branches. Breadcrumbs: []>
(let*
  [ocr-4856 []]
  (clojure.core/cond
    (clojure.core/and
      (clojure.core/instance? clojure.lang.IPersistentVector ocr-4856)
      (clojure.core/= (clojure.core/count ocr-4856) 1)) (clojure.core/let 
                                                          [ocr-4856_0__4857
                                                           (clojure.core/nth
                                                             ocr-4856
                                                             0)]
                                                          (clojure.core/cond
                                                            (clojure.core/=
                                                              ocr-4856_0__4857
                                                              nil)
                                                            "asdf"
                                                            :else
                                                            (throw
                                                              (java.lang.Exception.
                                                                (clojure.core/str
                                                                  "No match found. "
                                                                  "Followed "
                                                                  1
                                                                  " branches."
                                                                  " Breadcrumbs: "
                                                                  '[(clojure.core/and
                                                                      (clojure.core/instance?
                                                                        clojure.lang.IPersistentVector
                                                                        ocr-4856)
                                                                      (clojure.core/=
                                                                        (clojure.core/count
                                                                          ocr-4856)
                                                                        1))])))))
    :else (throw
            (java.lang.Exception.
              (clojure.core/str
                "No match found. "
                "Followed "
                0
                " branches."
                " Breadcrumbs: "
                '[])))))
Comment by David Nolen [ 25/Sep/11 5:53 PM ]

Fixed, https://github.com/clojure/core.match/commit/9ba924ddd4e8cf9f08d44f2362bf04add1b69ae1

Generated at Mon Sep 01 09:10:03 CDT 2014 using JIRA 4.4#649-r158309.