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

Closed
MarkSwanson opened this Issue Mar 14, 2013 · 3 comments

Projects

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 (Compiler.java:6380)

midje 1.5.0, clojure 1.5.1, java 7, ubuntu.

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

Object
(toString ; for debugging...
this)

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?

Contributor

I think I've replicated something similar here:

git clone -b issue-198 git@github.com:josephwilk/Midje.git && cd Midje && lein midje

Specially with the example:

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

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

Owner
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