This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-10-17
Channels
- # announcements (3)
- # babashka (3)
- # beginners (53)
- # biff (2)
- # calva (16)
- # cider (1)
- # clj-commons (1)
- # clj-kondo (97)
- # clj-on-windows (137)
- # clojure (49)
- # clojure-europe (63)
- # clojure-gamedev (1)
- # clojure-nl (2)
- # clojure-norway (50)
- # clojure-uk (4)
- # clojurescript (36)
- # core-async (28)
- # datomic (32)
- # emacs (22)
- # events (1)
- # graalvm (8)
- # honeysql (6)
- # jobs (2)
- # lambdaisland (5)
- # malli (6)
- # nbb (31)
- # off-topic (171)
- # pathom (14)
- # rdf (2)
- # reitit (4)
- # releases (2)
- # scittle (19)
- # shadow-cljs (46)
- # sql (6)
- # squint (6)
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 itoh 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