Allow expressions that evaluate to types in defalias

This commit is contained in:
Joshua Suskalo 2022-01-10 13:34:58 -06:00
parent 95856cb4f3
commit 49f9e60b11

View file

@ -781,7 +781,8 @@
aliased type."
{:style/indent [:defn]}
[new-type aliased-type]
(if (primitive-type aliased-type)
(if (and (s/valid? ::type aliased-type)
(primitive-type aliased-type))
`(let [aliased# ~aliased-type]
(defmethod primitive-type ~new-type
[_type#]
@ -804,4 +805,4 @@
(deserialize-from segment# aliased#)))))
(s/fdef defalias
:args (s/cat :new-type qualified-keyword?
:aliased-type ::type))
:aliased-type any?))