Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Closed
MarkSwanson opened this Issue · 3 comments

3 participants

@MarkSwanson

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?

@josephwilk

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]))
@marick
Owner

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

@marick
Owner

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

@marick marick closed this
@josephwilk josephwilk referenced this issue from a commit in josephwilk/Midje
@marick 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
Something went wrong with that request. Please try again.