deftype-openly : Unable to resolve symbol: toString in this context #198

MarkSwanson opened this Issue Mar 14, 2013 · 3 comments


None yet

3 participants

When I switch (deftype ... into (deftype-only
my working code starts to throw:

clojure.lang.Compiler$CompilerException: java.lang.RuntimeException: Unable to resolve symbol: toString in this context, compiling:(db/start.clj:29:1)
at clojure.lang.Compiler.analyze (

midje 1.5.0, clojure 1.5.1, java 7, ubuntu.

The cause is this snippet at the bottom of my deftype is:

(toString ; for debugging...

I find this snippet helpful and don't want to give it up.
Perhaps deftype-only needs a little tweak to support fns outside of the original defprotocol?


I think I've replicated something similar here:

git clone -b issue-198 && cd Midje && lein midje

Specially with the example:

(deftype-openly LongerRecord [a b c]
  (add-fields [this] (+ a b c))
  (add-fields-and [this x]
                  (+ (add-fields this) x))
  (toString [this]))
marick commented Mar 22, 2013

I see what's going on. Working on it.

marick commented Mar 22, 2013

Will be fixed in 1.5.1, which I might finish up today.

@marick marick closed this Mar 22, 2013
@josephwilk josephwilk added a commit to josephwilk/Midje that referenced this issue Mar 30, 2013
@marick @josephwilk + josephwilk Fixed #198: deftype-openly and Java classes 72cfd9c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment