From 20cf0abbcc01d5734ffcfca4c4533d7c72f3a821 Mon Sep 17 00:00:00 2001 From: Jacob Lifshay Date: Wed, 30 Oct 2024 20:46:11 -0700 Subject: [PATCH] fix using #[hdl] types like S<{ 1 + 2 }> --- crates/fayalite-proc-macros-impl/src/hdl_type_common.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/crates/fayalite-proc-macros-impl/src/hdl_type_common.rs b/crates/fayalite-proc-macros-impl/src/hdl_type_common.rs index 506c153..3f3f817 100644 --- a/crates/fayalite-proc-macros-impl/src/hdl_type_common.rs +++ b/crates/fayalite-proc-macros-impl/src/hdl_type_common.rs @@ -4163,7 +4163,13 @@ impl MakeHdlTypeExpr for ParsedExpr { match self { ParsedExpr::Delimited(expr) => expr.make_hdl_type_expr(context), ParsedExpr::NamedParamConst(expr) => expr.make_hdl_type_expr(context), - ParsedExpr::Other(expr) => (**expr).clone(), + ParsedExpr::Other(expr) => { + let span = expr.span(); + let const_usize = known_items::ConstUsize(span); + parse_quote_spanned! {expr.span()=> + #const_usize::<{ #expr }> + } + } } } }