Skip to content

Commit

Permalink
Add support for syn 2.0.40's new Expr::Group to dsl::auto_type
Browse files Browse the repository at this point in the history
This expression may get yielded when parsing `$a: expr` from other macros.
  • Loading branch information
Ten0 committed Dec 11, 2023
1 parent ce16e91 commit acc3811
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions dsl_auto_type/src/auto_type/expression_type_inference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ impl TypeInferrer<'_> {
expr,
type_hint.filter(|h| !matches!(h, syn::Type::Infer(_))),
) {
(syn::Expr::Group(syn::ExprGroup { expr, .. }), type_hint) => {
return self.try_infer_expression_type(expr, type_hint)
}
(
syn::Expr::Tuple(syn::ExprTuple {
elems: expr_elems, ..
Expand Down Expand Up @@ -236,10 +239,10 @@ impl TypeInferrer<'_> {
))
}
},
(_, None) => {
(e, None) => {
return Err(syn::Error::new(
expr.span(),
"unsupported expression for auto_type",
format_args!("unsupported expression for auto_type: {e:?}"),
))
}
(_, Some(type_hint)) => type_hint.clone(),
Expand Down

0 comments on commit acc3811

Please sign in to comment.