2024 Clojure 状况调查! 中分享您的想法。

欢迎!请查看关于页面以获取更多关于如何操作的信息。

0
core.typed
(from 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) Cannot assoc args `[(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}]` on m
在: (assoc detail :id 10 :version 0)

1 答案

0
参考:https://clojure.atlassian.net/browse/CTYP-204 (由alex+import报告)
...