core.typed

assoc derives imprecise type when optional attributes present

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

"Real world" use case, removing the optional forename makes things work as expected:

Unable to find source-code formatter for language: clojure. Available languages are: javascript, sql, xhtml, actionscript, none, html, xml, java
(def-alias TUser (HMap :mandatory {:group String}
                       :optional {:forename String}
                  ))
(def-alias TAdmin (HMap :mandatory {:group (Value "admin")}
                        :optional {:forename String}
                  ))

(ann my-user TUser)
(def my-user {:group "whee"})

(ann my-admin TAdmin)
(def my-admin (assoc my-user :group "admin"))

Smaller test case:

Unable to find source-code formatter for language: clojure. Available languages are: javascript, sql, xhtml, actionscript, none, html, xml, java
(cf (assoc
      (ann-form {} (HMap :optional {:a Any}))
      :b "v")
    (HMap :mandatory {:b (Value "v")} :optional {:a Any}))

Activity

Ambrose Bonnaire-Sergeant made changes -
Field Original Value New Value
Resolution Completed [ 1 ]
Status Open [ 1 ] Resolved [ 5 ]
Ambrose Bonnaire-Sergeant made changes -
Status Resolved [ 5 ] Closed [ 6 ]

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: