core.match

AppPattern with single wildcard throws exception

Details

  • Type: Defect Defect
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

Example:

user=> (require '[clojure.core.match :as m])
nil
user=> (m/match [[1 2 3]] [(x :<< first)] x)
IllegalArgumentException No method in multimethod 'to-source' for dispatch value: null  clojure.lang.MultiFn.getFn (MultiFn.java:156)

It seems this can be fixed by adding a dummy to-source for wildcards:

user=> (defmethod m/to-source nil [pattern ocr]
  (if (m/wildcard-pattern? pattern)
    true
    (throw (AssertionError. (str "Don't know how to emit code for: " pattern)))))
#object[clojure.lang.MultiFn 0x4bb9f7d4 "clojure.lang.MultiFn@4bb9f7d4"]
user=> (m/match [[1 2 3]] [(x :<< first)] x)
1

Activity

There are no comments yet on this issue.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated: