<< Back to previous view

[MATCH-115] AppPattern with single wildcard throws exception Created: 29/Jul/16  Updated: 29/Jul/16

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

Type: Defect Priority: Minor
Reporter: Greg Chapman Assignee: David Nolen
Resolution: Unresolved Votes: 0
Labels: None



user=> (require '[clojure.core.match :as m])
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)
    (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)

Generated at Sat Jul 30 02:38:43 CDT 2016 using JIRA 4.4#649-r158309.