mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-29 23:04:49 +00:00
Fix some inlining logic
This commit is contained in:
parent
426531cf59
commit
319da4141e
2 changed files with 13 additions and 5 deletions
|
@ -1031,7 +1031,8 @@ pub fn inline_calls(var_store: &mut VarStore, scope: &mut Scope, expr: Expr) ->
|
||||||
| other @ EmptyRecord
|
| other @ EmptyRecord
|
||||||
| other @ Accessor { .. }
|
| other @ Accessor { .. }
|
||||||
| other @ Update { .. }
|
| other @ Update { .. }
|
||||||
| other @ Var(_) => other,
|
| other @ Var(_)
|
||||||
|
| other @ RunLowLevel { .. } => other,
|
||||||
|
|
||||||
List {
|
List {
|
||||||
elem_var,
|
elem_var,
|
||||||
|
@ -1194,7 +1195,14 @@ pub fn inline_calls(var_store: &mut VarStore, scope: &mut Scope, expr: Expr) ->
|
||||||
|
|
||||||
match loc_expr.value {
|
match loc_expr.value {
|
||||||
Var(symbol) if symbol.is_builtin() => match builtin_defs(var_store).get(&symbol) {
|
Var(symbol) if symbol.is_builtin() => match builtin_defs(var_store).get(&symbol) {
|
||||||
Some(Closure(_var, _, recursive, params, boxed_body)) => {
|
Some(Def {
|
||||||
|
loc_expr:
|
||||||
|
Located {
|
||||||
|
value: Closure(_var, _, recursive, params, boxed_body),
|
||||||
|
..
|
||||||
|
},
|
||||||
|
..
|
||||||
|
}) => {
|
||||||
debug_assert_eq!(*recursive, Recursive::NotRecursive);
|
debug_assert_eq!(*recursive, Recursive::NotRecursive);
|
||||||
|
|
||||||
// Since this is a canonicalized Expr, we should have
|
// Since this is a canonicalized Expr, we should have
|
||||||
|
|
|
@ -53,7 +53,7 @@ mod can_inline {
|
||||||
Box::new(Def {
|
Box::new(Def {
|
||||||
loc_pattern: Located {
|
loc_pattern: Located {
|
||||||
region: Region::zero(),
|
region: Region::zero(),
|
||||||
value: Pattern::Identifier(Symbol::INT_IS_ZERO_ARG),
|
value: Pattern::Identifier(Symbol::ARG_1),
|
||||||
},
|
},
|
||||||
pattern_vars: SendMap::default(),
|
pattern_vars: SendMap::default(),
|
||||||
loc_expr: Located {
|
loc_expr: Located {
|
||||||
|
@ -70,7 +70,7 @@ mod can_inline {
|
||||||
unsafe { Variable::unsafe_test_debug_variable(138) },
|
unsafe { Variable::unsafe_test_debug_variable(138) },
|
||||||
Located {
|
Located {
|
||||||
region: Region::zero(),
|
region: Region::zero(),
|
||||||
value: Expr::Var(Symbol::INT_EQ_I64),
|
value: Expr::Var(Symbol::BOOL_EQ),
|
||||||
},
|
},
|
||||||
unsafe { Variable::unsafe_test_debug_variable(139) },
|
unsafe { Variable::unsafe_test_debug_variable(139) },
|
||||||
)),
|
)),
|
||||||
|
@ -79,7 +79,7 @@ mod can_inline {
|
||||||
unsafe { Variable::unsafe_test_debug_variable(140) },
|
unsafe { Variable::unsafe_test_debug_variable(140) },
|
||||||
Located {
|
Located {
|
||||||
region: Region::zero(),
|
region: Region::zero(),
|
||||||
value: Var(Symbol::INT_IS_ZERO_ARG),
|
value: Var(Symbol::ARG_1),
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue