ClojureScript

clojure.data/diff throws an exception when comparing map keys of different types when used on sorted maps

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Declined
  • Affects Version/s: 1.9.76
  • Fix Version/s: None
  • Component/s: None
  • Labels:

Description

e.g.
(clojure.data/diff (sorted-map :foo 42) (sorted-map 1 42))
(clojure.data/diff (sorted-map :foo 42) (sorted-map "x" 42))
(clojure.data/diff (hash-map :foo 42) (sorted-map 1 42))
(clojure.data/diff (hash-map :foo 42) (sorted-map "x" 42))
will throw e.g.
Error: Cannot compare :foo to 1
while e.g.
(clojure.data/diff (hash-map :foo 42) (hash-map 1 42))
(clojure.data/diff (hash-map :foo 42) (hash-map "x" 2))
(clojure.data/diff (sorted-map :foo 42) (sorted-map :bar 42))
will not.

The same applies to Clojure with a different exception (e.g. "java.lang.Long cannot be cast to clojure.lang.Keyword")

Activity

Hide
David Nolen added a comment -

The behavior is based on Clojure, so this issue should be brought up there first.

Show
David Nolen added a comment - The behavior is based on Clojure, so this issue should be brought up there first.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: