ClojureScript

Sorted colls with default comparator don't check that first element is Comparable

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:
    {:deps {org.clojure/clojurescript {:mvn/version "1.10.339"}}}

Description

Like CLJ-2089 but for ClojureScript.

Repro, with ClojureScript:

$ clj -m cljs.main
ClojureScript 1.10.339
cljs.user=> (def s (sorted-set #{1}))
#'cljs.user/s
cljs.user=> (conj s #{2})
Error: Cannot compare #{2} to #{1}
	 cljs$core$compare (cljs/core.cljs:2380:13)
	 cljs.core/tree-map-add (cljs/core.cljs:28176:3)
	 cljs$core$IAssociative$_assoc$arity$3 (cljs/core.cljs:8734:18)
	 cljs.core/-assoc (cljs/core.cljs:630:17)
	 cljs$core$IFn$_invoke$arity$3 (cljs/core.cljs:1968:8)
	 cljs$core$ICollection$_conj$arity$2 (cljs/core.cljs:9231:31)
	 cljs.core/-conj (cljs/core.cljs:583:16)
	 cljs$core$IFn$_invoke$arity$2 (cljs/core.cljs:1781:8)
	 cljs$core$conj (cljs/core.cljs:1773:1)

If feasible, this ticket asks that ClojureScript be made to align with the solution in CLJ-2089 (in particular, with making code like (sorted-set #{1}) fail fast.)

Activity

There are no comments yet on this issue.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated: