(来自
https://groups.google.com/d/msg/clojure-core-typed/4z_7WnqZsyI/53jlUHQfWhEJ)
以下代码:
(t/ann new-ar (t/All [[m :< (t/Map t/Any t/Any)]] [m -> (t/Assoc m ':id Number ':version Number)]))
(defn new-ar
[detail]
{:post [(not (nil? (:id %)))
(zero? (:version %))]}
(assoc detail :id 10 :version 0))
抛出以下错误
类型错误(qfi/health/core/domain/model/common.clj:40:3)在m上无法关联参数 `[(clojure.core.typed/Val :id) {:then tt, :else ff}] [(clojure.core.typed/Val 10) {:then tt, :else ff}] [(clojure.core.typed/Val :version) {:then tt, :else ff}] [(clojure.core.typed/Val 0) {:then tt, :else ff}]`
在: (assoc detail :id 10 :version 0)