I've been testing clj-kondo + malli function specs And it seems clj-kondo assumes a key is not present in a map if not statically defined Or perhaps I'm doing something wrong?
It only complains if it can statically infer that the key isn't present
It won't complain on (assoc x :name "foo") if it doesn't know anything about x but with the empty map we know it doesn't have any keys
(assoc {} :name "string")
looks like a bug. can you make a repro using only clj-kondo? you can find the specs generated by malli in the imports directorythere might be a bug either in how malli generates stuff for clj-kondo or in clj-kondo. but let's start with reproing with clj-kondo only
I understand if we don't have flow sensitive typing that there's no way to know if :name is indeed in the map,
but I also wouldn't expect it to be an error in that case (perhaps a warning is justified)
Sorry for the late reply, I got around to making a minimal example of this. https://github.com/A-Helberg/demo I added the above code in https://github.com/A-Helberg/demo/blob/main/src/andre.clj Once http://malli.dev/start! is called, it outputs https://github.com/A-Helberg/demo/blob/main/.clj-kondo/imports/metosin/malli-types-clj/config.edn,
{:linters {:unresolved-symbol {:exclude [(malli.core/=>)]},
:type-mismatch
{:namespaces
{andre {myfn {:arities {1 {:args [{:op :keys, :req {:name :string}}],
:ret :string}}}}}}}}
This looks correct to me