mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
Define inline expects defs in their definition order
When we transform a top-level expect into an inline expect, we collect all intermediate defs before the expect condition, then layer the defs back on. Because the layering procedure builds an expression bottom-up, we must layer on defs in reverse definition order. Closes #4705
This commit is contained in:
parent
935255d06b
commit
42fe19541e
2 changed files with 18 additions and 1 deletions
|
@ -2995,7 +2995,7 @@ fn toplevel_expect_to_inline_expect_help(mut loc_expr: Loc<Expr>, has_effects: b
|
|||
|
||||
let mut loc_expr = Loc::at(expect_region, expect);
|
||||
|
||||
for stored in stack {
|
||||
for stored in stack.into_iter().rev() {
|
||||
match stored {
|
||||
StoredDef::NonRecursive(region, boxed_def) => {
|
||||
loc_expr = Loc::at(region, Expr::LetNonRec(boxed_def, Box::new(loc_expr)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue