Fork me on GitHub
#malli
<
2022-10-17
>
skynet21:10:06

I'm seeing a bug in malli 0.9.0 and 0.9.1, and I'm trying to get a minimal reproduction of this issue but I can't. the error I'm getting is:

Exception: java.lang.ClassCastExcetpion: class clojure.lang.Symbol cannot be cast to class java.lang.String (clojure.lang.Symbol is in unnamed module of loader 'app'; java.lang.String is in module java.base of loader 'bootstrap')
 at clojure.core$symbol.invokeStatic (core.clj:591)
    ...
    malli.instrument$_strument_BANG_$fn__24440$fn__24441.invoke (instrument.clj:23)
    malli.core$_instrument$fn__21304.doInvoke (core.cljc:2480)
    ...
    <my code>
this occurs in a test after doing !. there are some functions in the project with :malli/gen true in function metadata, and some with that set to false. malli is started with:
(malli.dev/start!
  {::m/function-checker mg/function-checker
   :report (pretty/reporter)
   :gen mg/generate})
this all works on 0.8.9. unfortunately I can't share the code, but I'm not sure this is enough for someone to fix it

skynet22:10:56

oh actually I figured it out, I was redefining a fn that was instrumented, and had it returning invalid data, like this https://github.com/skynet-gh/2022-10-17-malli-instrument-bug then malli calls (symbol n s) in that case https://github.com/metosin/malli/blob/master/src/malli/instrument.clj#L23 and n and s are symbols in that case, which doesn't work for multi-arity https://clojuredocs.org/clojure.core/symbol so changing it to (symbol (name n) (name s)) works

skynet22:10:52

ok I over-complicated it. I think it will break after ! with :report whenever you have any invalid input/output on an instrumented function

dvingo22:10:52

Oh shoot, I just touched that code recently, I can take a look

🙏 1
dvingo23:10:15

https://github.com/metosin/malli/pull/768 TIL - that code works in cljs !

👍 1
skynet13:10:39

that's tricky, I didn't know that either