mirror of
https://github.com/roc-lang/roc.git
synced 2024-09-22 08:17:40 +03:00
parent
1b664741db
commit
543ca97a1c
@ -170,7 +170,10 @@ pub fn desugar_expr<'a>(arena: &'a Bump, loc_expr: &'a Loc<Expr<'a>>) -> &'a Loc
|
||||
}),
|
||||
|
||||
RecordUpdate { fields, update } => {
|
||||
// NOTE the `update` field is always a `Var { .. }` and does not need to be desugared
|
||||
// NOTE the `update` field is always a `Var { .. }`, we only desugar it to get rid of
|
||||
// any spaces before/after
|
||||
let new_update = desugar_expr(arena, update);
|
||||
|
||||
let new_fields = fields.map_items(arena, |field| {
|
||||
let value = desugar_field(arena, &field.value);
|
||||
Loc {
|
||||
@ -182,7 +185,7 @@ pub fn desugar_expr<'a>(arena: &'a Bump, loc_expr: &'a Loc<Expr<'a>>) -> &'a Loc
|
||||
arena.alloc(Loc {
|
||||
region: loc_expr.region,
|
||||
value: RecordUpdate {
|
||||
update: *update,
|
||||
update: new_update,
|
||||
fields: new_fields,
|
||||
},
|
||||
})
|
||||
|
@ -1063,6 +1063,22 @@ mod test_can {
|
||||
assert_eq!(problems, Vec::new());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn issue_2534() {
|
||||
let src = indoc!(
|
||||
r#"
|
||||
x = { a: 1 }
|
||||
{
|
||||
x & a: 2
|
||||
}
|
||||
"#
|
||||
);
|
||||
let arena = Bump::new();
|
||||
let CanExprOut { problems, .. } = can_expr_with(&arena, test_home(), src);
|
||||
|
||||
assert_eq!(problems, Vec::new());
|
||||
}
|
||||
|
||||
//#[test]
|
||||
//fn closing_over_locals() {
|
||||
// // "local" should be used, because the closure used it.
|
||||
|
Loading…
Reference in New Issue
Block a user