core.typed

merge doesn't seem to like records

Details

  • Type: Defect Defect
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 0.2, 0.3.0
  • Fix Version/s: Backlog
  • Component/s: Core type system
  • Labels:
    None

Description

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

Activity

Ambrose Bonnaire-Sergeant made changes -
Field Original Value New Value
Component/s Core type system [ 10006 ]
Description 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
I'm pretty sure this should pass

{code}
(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}))
{code}

but it gives

{code}
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
{code}
Affects Version/s Release 0.3 [ 10553 ]
Fix Version/s Backlog [ 10554 ]

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated: