clj-commons / ordered

Ordered sets and maps, implemented in pure clojure
Eclipse Public License 1.0
258 stars 40 forks source link

Compilation error #6

Closed narkisr closed 12 years ago

narkisr commented 12 years ago

This produces itself when using AOT compilation :

Caused by: java.lang.ClassCastException: ordered.map.OrderedMap cannot be cast to ordered.map.OrderedMap at ordered.map$transient_ordered_map.invoke(map.clj:183)
at ordered.map.OrderedMap.asTransient(map.clj:121)
at clojure.core$transient.invoke(core.clj:2929)
at clojure.core$into.invoke(core.clj:6004)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.AFn.applyTo(AFn.java:151)
at clojure.lang.Compiler$InvokeExpr.eval(Compiler.java:3337)

narkisr commented 12 years ago

The code which triggers it is of the form:

(def foo (into (ordered-map) [[1 2] [3 4]])

amalloy commented 12 years ago

Closing this as an error in your AOT-compiled code: you shouldn't def complicated things at the top level when you're AOT-compiling, because the class that is used at compile time is different from the class that is used at runtime.