clj-commons / potemkin

some ideas which are almost good
572 stars 53 forks source link

`def-map-type` breaks in namespaces that shadow core Clojure methods like `instance?` #70

Open camsaul opened 1 year ago

camsaul commented 1 year ago

If you have a namespace that does something like :refer-clojure :exclude [instance?] and use def-map-type in it,

(merge instance-of-my-map-type nil)

will break because

def-map-type uses the def-abstract-type AbstractMap which defines cons like this:

https://github.com/clj-commons/potemkin/blob/f22d9725a2203f9c5cab90fc3459da78e7229956/src/potemkin/collections.clj#L68-L79

and the ultimate macroexpansion copies that call to instance? directly, rather than qualifying it as clojure.core/instance?.