We're updating the issue view to help you get more done. 

deftype: compiler error on set! for mutable field

Description

The following code demonstrates the error in a minimal example:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 (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.

Environment

None

Status

Assignee

Unassigned

Reporter

import

Labels

None

Approval

None

Patch

None

Affects versions

Release 1.4

Priority

Major