mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
Fix desugar step for pizza operator
This commit is contained in:
parent
f28bbecccb
commit
6031c0cc9f
4 changed files with 63 additions and 14 deletions
|
@ -288,7 +288,7 @@ pub fn desugar_expr<'a>(arena: &'a Bump, loc_expr: &'a Loc<Expr<'a>>) -> &'a Loc
|
|||
|
||||
break builder_arg.closure;
|
||||
}
|
||||
SpaceBefore(expr, _) | SpaceAfter(expr, _) | ParensAround(expr) => {
|
||||
SpaceBefore(expr, _) | SpaceAfter(expr, _) => {
|
||||
current = *expr;
|
||||
}
|
||||
_ => break loc_arg,
|
||||
|
@ -382,7 +382,7 @@ pub fn desugar_expr<'a>(arena: &'a Bump, loc_expr: &'a Loc<Expr<'a>>) -> &'a Loc
|
|||
region: loc_expr.region,
|
||||
})
|
||||
}
|
||||
SpaceBefore(expr, _) | SpaceAfter(expr, _) | ParensAround(expr) => {
|
||||
SpaceBefore(expr, _) | SpaceAfter(expr, _) => {
|
||||
// Since we've already begun canonicalization, spaces and parens
|
||||
// are no longer needed and should be dropped.
|
||||
desugar_expr(
|
||||
|
@ -393,6 +393,20 @@ pub fn desugar_expr<'a>(arena: &'a Bump, loc_expr: &'a Loc<Expr<'a>>) -> &'a Loc
|
|||
}),
|
||||
)
|
||||
}
|
||||
ParensAround(expr) => {
|
||||
let desugared = desugar_expr(
|
||||
arena,
|
||||
arena.alloc(Loc {
|
||||
value: **expr,
|
||||
region: loc_expr.region,
|
||||
}),
|
||||
);
|
||||
|
||||
arena.alloc(Loc {
|
||||
value: ParensAround(&desugared.value),
|
||||
region: loc_expr.region,
|
||||
})
|
||||
}
|
||||
If(if_thens, final_else_branch) => {
|
||||
// If does not get desugared into `when` so we can give more targeted error messages during type checking.
|
||||
let desugared_final_else = &*arena.alloc(desugar_expr(arena, final_else_branch));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue