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

0 votes
in core.typed by
I'm pretty sure this should pass


(ns moonrise
  (:require [clojure.core.typed :refer :all]))

(ann-record X [a :- Number])
(defrecord X [a])

(ann x X)
(def x (merge (X. 3) {:z 4}))


but it gives


Type Error (moonrise:8:8) Polymorphic function clojure.core/merge could not be applied to arguments:
Polymorphic Variables:
    k
    v

Domains:
    nil *
    (clojure.lang.IPersistentMap k v) (clojure.lang.IPersistentMap k v) *
    (Option (clojure.lang.IPersistentMap k v)) *

Arguments:
    moonrise.X (HMap :mandatory {:z (Value 4)} :complete? true)

Ranges:
    nil
    (clojure.lang.IPersistentMap k v)
    (Option (clojure.lang.IPersistentMap k v))

with expected type:
    moonrise.X

in: (clojure.core/merge (new moonrise.X 3) (quote {:z 4}))
in: (def x (clojure.core/merge (new moonrise.X 3) (quote {:z 4})))


Type Checker: Found 1 error

1 Answer

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