That looks like a bug to me.
The = function in clojure delegates to Util.equiv(), which delegates
to the .equiv() method if present. The problem with sets is that
equiv() simply delegates to equals() when it should have a distinct
implementation (see vector for an example)
Clojure has two different equality relations: equals() & hashCode(),
which consider (Long. -1) and (Integer.-1) to be distinct, and equiv()
& hashEq(), which consider (Integer. -1) and (Long. -1) to be equal.
Clojure's persistent collections also implement these two different
equalities, so that [(Long. -1)] is equiv() but not equals() to
[(Integer. -1)].
user=> (def v [(Long. -1)])
#'user/v
user=> (def v* [(Integer. -1)])
#'user/v*
user=> (= v v*)
true
user=> (.equals v v*)
false
The same behaviour should occur for sets, but it doesn't, because
equiv() delegates to equals():
user=> (def s #{(Long. -1)})
#'user/s
user=> (def s* #{(Integer. -1)})
#'user/s*
user=> (= s s*)
false ;;; should be true here, this is the bug
user=> (.equals s s*)
false ;;; this is correct
so definitely file a bug. I hope this helps you file a patch, too.
Phil