Merge pull request #3615 from rtfeldman/3198

Support parsing opaque destructures as first item in nested body
This commit is contained in:
Folkert de Vries 2022-07-25 19:32:57 +02:00 committed by GitHub
commit 50021a65cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 82 additions and 1 deletions

View file

@ -1045,6 +1045,10 @@ impl<'a> Expr<'a> {
pub fn is_tag(&self) -> bool {
matches!(self, Expr::Tag(_))
}
pub fn is_opaque(&self) -> bool {
matches!(self, Expr::OpaqueRef(_))
}
}
macro_rules! impl_extract_spaces {

View file

@ -444,7 +444,10 @@ impl<'a> ExprState<'a> {
let fail = EExpr::BadOperator(opchar, loc_op.region.start());
Err(fail)
} else if !self.expr.value.is_tag() && !self.arguments.is_empty() {
} else if !self.expr.value.is_tag()
&& !self.expr.value.is_opaque()
&& !self.arguments.is_empty()
{
let region = Region::across_all(self.arguments.iter().map(|v| &v.region));
Err(argument_error(region, loc_op.region.start()))