Details
-
Type:
Defect
-
Status:
Closed
-
Priority:
Major
-
Resolution: Duplicate
-
Affects Version/s: Release 1.4
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
Description
The following code demonstrates the error in a minimal example:
(defprotocol IBlob (do-sth [this, x])) (deftype Blob [^{:volatile-mutable true} a] IBlob (do-sth [this, x] (try (/ 1 x) (catch Throwable t (set! a (inc a)))) (inc x))) (deftype Blob2 [^{:volatile-mutable true} a] IBlob (do-sth [this, x] (try (/ 1 x) (catch Throwable t (set! a (inc a))))))
Compiling Blob results in the following exception:
CompilerException java.lang.IllegalArgumentException: Cannot assign to non-mutable: a
Compiling Blob2 works as expected.