core.match

Empty Vector Patterns Fail to Match

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • 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))

Activity

Hide
Ambrose Bonnaire-Sergeant added a comment -

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: "
                '[])))))
Show
Ambrose Bonnaire-Sergeant added a comment - 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: "
                '[])))))
David Nolen made changes -
Field Original Value New Value
Status Open [ 1 ] Resolved [ 5 ]
Resolution Completed [ 1 ]
David Nolen made changes -
Status Resolved [ 5 ] Closed [ 6 ]

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: