mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 14:54:47 +00:00
Admit tag destructuring in definitions
This commit is contained in:
parent
6a38a2948f
commit
0c81302d29
5 changed files with 46 additions and 1 deletions
|
@ -791,6 +791,10 @@ impl<'a> Expr<'a> {
|
|||
value: self,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_tag(&self) -> bool {
|
||||
matches!(self, Expr::GlobalTag(_) | Expr::PrivateTag(_))
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! impl_extract_spaces {
|
||||
|
|
|
@ -410,7 +410,7 @@ impl<'a> ExprState<'a> {
|
|||
let fail = EExpr::BadOperator(opchar, loc_op.region.start());
|
||||
|
||||
Err(fail)
|
||||
} else if !self.arguments.is_empty() {
|
||||
} else if !self.expr.value.is_tag() && !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