core.typed

select-keys on HMap returns Map with union key and value types

Details

  • Type: Defect Defect
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Environment:
    core.typed 0.2.40

Description

Currently select-keys on an HMap returns a Map with unions for keys and values.

=> (t/cf {:foo 1, :bar "2", :baz \3})
[(HMap :mandatory {:baz (Value \3), :bar (Value "2"), :foo (Value 1)} :complete? true) {:then tt, :else ff}]

=> (t/cf (select-keys {:foo 1, :bar "2", :baz \3}
                      [:foo :bar]))
(t/Map (U (Value :baz) (Value :foo) (Value :bar)) (U (Value 1) (Value \3) (Value "2")))

This results in type errors when select-keys is used to remove extra keys from an HMap.

Expected behaviour: select-keys should return an HMap with a subset of the :mandatory keys of its input HMap.

Activity

There are no comments yet on this issue.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated: