Welcome! Please see the About page for a little more info on how this works.

0 votes
in core.typed by

Applying keyword arguments doesn't work properly at the moment.

To reproduce:

`
(cf (ann fn2 [(HMap :mandatory {}) & {} -> '[] ]))
(cf (defn fn2 [m & args]

  []))

(cf (ann fn1 [(HMap :mandatory {}) & {} -> Boolean ]))
(cf (defn fn1 [m & args]

  (empty? (apply fn2 (cons m args)))))

;;This is how it's used:
(fn1 {} :a string? :b keyword? :c another-boolean-fn?)

;; And this is the type error:

;; Type Error (bouncer.core:2:28) Polymorphic function clojure.core/cons could not be applied to arguments:
;; Polymorphic Variables:
;; x

;; Domains:
;; x (Option (clojure.lang.Seqable x))

;; Arguments:
;; (HMap :mandatory {}) (KwArgsSeq)

;; Ranges:
;; (clojure.lang.ASeq x)

;; in: (clojure.core/cons m args)

;; in: (clojure.core/empty? (clojure.core/apply bouncer.core/fn2 (clojure.core/cons m args)))

;; [2 times]
;; [2 times]
;; Type Error (bouncer.core:2:17) Bad arguments to apply:

;; Target: (Fn [(HMap :mandatory {}) & {} -> []])

;; Arguments: Error

;; in: (clojure.core/empty? (clojure.core/apply bouncer.core/fn2 (clojure.core/cons m args)))

;; [2 times]
;; [2 times]
;; ExceptionInfo Type Checker: Found 2 errors clojure.core/ex-info (core.clj:4327)

;; Mark set
`

1 Answer

0 votes
by
Reference: https://clojure.atlassian.net/browse/CTYP-76 (reported by alex+import)
...