[CLJ-1039] Using 'def with metadata {:type :anything} throws ClassCastException Created: 09/Aug/12 Updated: 10/Aug/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | Release 1.4 |
| Fix Version/s: | None |
| Type: | Defect | Priority: | Minor |
| Reporter: | Gunnar Völkel | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Ubuntu, lein 1.7.1 - lein repl |
||
| Approval: | Vetted |
| Description |
|
In lein 1.7.1 (and CCW) the form (def ^{:type :anything} mydef 1) throws "ClassCastException clojure.lang.Var cannot be cast to clojure.lang.IObj clojure.core/with-meta (core.clj:211)". If it is intended to forbid setting the :type metadata, then there should be an appropriate error message instead of the ClassCastException In lein2 repl which is using "REPL-y 0.1.0-beta8" the exception does not occur. Full stacktrace: |
| Comments |
| Comment by Stuart Halloway [ 10/Aug/12 1:40 PM ] |
|
This is caused by the printer dispatch function (defmulti print-method (fn [x writer]
(let [t (get (meta x) :type)]
(if (keyword? t) t (class x)))))
which ends up calling the default dispatch, which tries to vary-meta. |