[MATCH-63] IllegalArgumentException when AOT compiling namespace using clojure.core.match since alpha10 Created: 08/Aug/12 Updated: 26/Feb/13 |
|
| Status: | Open |
| Project: | core.match |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Major |
| Reporter: | Paudi Moriarty | Assignee: | David Nolen |
| Resolution: | Unresolved | Votes: | 3 |
| Labels: | None | ||
| Environment: |
core.match 0.2.0-alpha10 and 0.2.0-alpha11-SNAPSHOT (git 7ad66cc) |
||
| Attachments: |
|
| Description |
|
Getting this when AOT compiling a trivial project (attached) using alpha10: (works fine with alpha9) Caused by: java.lang.IllegalArgumentException: No method in multimethod 'to-source' for dispatch value: class clojure.core.match.WildcardPattern
at clojure.lang.MultiFn.getFn(MultiFn.java:121)
at clojure.lang.MultiFn.invoke(MultiFn.java:167)
at clojure.core.match$dag_clause_to_clj.invoke(match.clj:424)
at clojure.lang.AFn.applyToHelper(AFn.java:167)
at clojure.lang.AFn.applyTo(AFn.java:151)
at clojure.core$apply.invoke(core.clj:602)
at clojure.lang.AFn.applyToHelper(AFn.java:167)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.core$apply.invoke(core.clj:604)
at clojure.core$partial$fn__3796.doInvoke(core.clj:2343)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.core$map$fn__3811.invoke(core.clj:2430)
at clojure.lang.LazySeq.sval(LazySeq.java:42)
at clojure.lang.LazySeq.seq(LazySeq.java:60)
at clojure.lang.RT.seq(RT.java:466)
at clojure.core$seq.invoke(core.clj:133)
at clojure.core$apply.invoke(core.clj:600)
at clojure.core$mapcat.doInvoke(core.clj:2459)
at clojure.lang.RestFn.invoke(RestFn.java:423)
at clojure.core.match.SwitchNode.n_to_clj(match.clj:446)
at clojure.core.match.BindNode.n_to_clj(match.clj:411)
at clojure.core.match$executable_form.invoke(match.clj:1713)
at clojure.core.match$clj_form.invoke(match.clj:1721)
at clojure.core.match$match.doInvoke(match.clj:1750)
|
| Comments |
| Comment by Frederik De Bleser [ 20/Nov/12 4:18 PM ] |
|
I can confirm the same issue on alpha11. |
| Comment by David Nolen [ 23/Nov/12 4:52 PM ] |
|
I believe I may have found the cause and have fixed master - if someone can confirm I'll happily cut another release. http://github.com/clojure/core.match/commit/cbcc6e5fa070a7025e72f5eab4e83eaec100332b |
| Comment by Paudi Moriarty [ 15/Jan/13 9:42 AM ] |
|
Thanks David, That change has not fixed the issue for me. |
| Comment by Paudi Moriarty [ 15/Jan/13 9:56 AM ] |
|
So the pattern parameter being passed to dag-clause-to-clj: (defn dag-clause-to-clj [occurrence pattern action]
(let [test (if (instance? clojure.core.match.IPatternCompile pattern)
(to-source* pattern occurrence)
(to-source pattern occurrence))]
...
is a WildcardPattern which doesn't implement IPatternCompile and doesn't have a to-source method. So it seems it shouldn't be passed at all. Indeed, in normal usage it isn't. ;; ## Wildcard Pattern ;; ;; A wildcard pattern accepts any value. ;; ;; In practice, the DAG compilation eliminates any wildcard patterns. (defprotocol IWildcardPattern (sym [this])) (deftype WildcardPattern [sym _meta] IWildcardPattern (sym [_] sym) clojure.lang.IObj (meta [_] _meta) (withMeta [_ new-meta] (WildcardPattern. sym new-meta)) Object (toString [_] (str sym))) |
| Comment by David Nolen [ 15/Jan/13 11:17 AM ] |
|
Can you include an example pattern which works under normal circumstances but fails under AOT? This must meant that WildcardPatterns are making it through under AOT and getting to the multimethod case but not under incremental compilation at the REPL. |
| Comment by Paudi Moriarty [ 16/Jan/13 9:34 AM ] |
|
This seems to do it: (match {}
{:a :x :b b} :dummy
:else :dummy)
|
| Comment by Tim Olsen [ 26/Feb/13 1:55 PM ] |
|
I've seen this problem as well. If I try to compile a second time, however, without running lein clean, the compilation succeeds. Maybe it's a bootstrapping problem? |