plumatic / schema

Clojure(Script) library for declarative data description and validation
Other
2.4k stars 256 forks source link

`resolve-tag` should ignore local environment #455

Open frenchy64 opened 4 months ago

frenchy64 commented 4 months ago

AFAIK a tag is resolved from the global environment, not local scope. For example this works fine even though we shadow Class with a local.

(let [Class nil] ((fn [^Class a] (.getName a)) Integer))

(resolve {'Class true} 'Class) ;; emulating Schema's tag inference
;=> nil

(resolve 'Class) ;; what I suspect is more correct
;=> java.lang.Class

Relevant line:

https://github.com/plumatic/schema/blob/8fcb57f87ffe74185e1f1da72be4933bd4aad4d2/src/clj/schema/macros.clj#L121