From 49f9e60b11fed39cdd41e721bb04bb6be20be999 Mon Sep 17 00:00:00 2001 From: Joshua Suskalo Date: Mon, 10 Jan 2022 13:34:58 -0600 Subject: [PATCH] Allow expressions that evaluate to types in defalias --- src/clj/coffi/mem.clj | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/clj/coffi/mem.clj b/src/clj/coffi/mem.clj index 5095a59..201f39e 100644 --- a/src/clj/coffi/mem.clj +++ b/src/clj/coffi/mem.clj @@ -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?))