I found a minimal case:


(defprotocol A (f [x]))

(deftype T [ ^{:unsynchronized-mutable true} ^int a] A
               (f [x] (loop [c 0]
                           (set! a c))))

(class: user/T, method: f signature: ()Ljava/lang/Object;) Expecting
to find integer on stack

The problem disappear with let instead of loop.

It seems that Clojure creates c as a long a long and do not put a
conversion before setting to the int variable.
(deftype T [ ^{:unsynchronized-mutable true} ^int a] A
               (f [x] (loop [c 0]
                           (set! a (int c)))))

works without trouble.

Notably, doing (loop [c (int 0)] .... does not help.

Is it known or should I report the bug?
(I don't mind casting by hand for this case, but at least the error
message should be clearer)

Best,

Nicolas.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to