metosin / malli

High-performance data-driven data specification library for Clojure/Script.
Eclipse Public License 2.0
1.46k stars 208 forks source link

Malli generates incorrect clj-kondo spec for `:fn` schemas #836

Closed camsaul closed 7 months ago

camsaul commented 1 year ago

Contrived example:

(mx/defn x [y :- [:fn vector?]]
  y)

(x [:x])
;; => Expected function, received vector

The generated Kondo fig is incorrect:

{x {:arities {1 {:args [:fn], :ret :any}}}}

Related: #826

opqdonut commented 1 year ago

This should get fixed by #851

Yutsa commented 1 year ago

I think I have an issue related to this, I tried to specify data with a predicate and clj-kondo believes I should provide a function but my predicate checks if it is a string starting with "SKU-". If it can't infer that the type is a string it could at least type it to any right ?

image

juszczakn commented 7 months ago

FYI ran into this myself lately, took a stab at fixing this w/ #987 .