This will fail with a "Unable to resolve spec: :user/x" exception, but the def succeeded. Switching the deftype to defrecord fixes the problem.
Cause: The with-name function has cond options for ident?, regex?, and IObj. If none of these succeed, there is no fallthrough case and the s/def will silently return nil.
(deftype MySpec [] s/Spec (conform* [_ x] ::s/invalid)) (s/def ::x (MySpec.)) (s/explain ::x :foo)This will fail with a "Unable to resolve spec: :user/x" exception, but the
defsucceeded. Switching the deftype to defrecord fixes the problem.Cause: The
with-namefunction has cond options for ident?, regex?, and IObj. If none of these succeed, there is no fallthrough case and the s/def will silently return nil.Proposed: Throw an error in the fallthrough case.
Patch: clj-2135.patch