mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-02 11:22:19 +00:00
Merge pull request #3615 from rtfeldman/3198
Support parsing opaque destructures as first item in nested body
This commit is contained in:
commit
50021a65cf
5 changed files with 82 additions and 1 deletions
|
@ -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 {
|
||||
|
|
|
@ -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()))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue