Fix some inlining logic

This commit is contained in:
Richard Feldman 2020-07-04 10:35:37 -04:00
parent 426531cf59
commit 319da4141e
2 changed files with 13 additions and 5 deletions

View file

@ -1031,7 +1031,8 @@ pub fn inline_calls(var_store: &mut VarStore, scope: &mut Scope, expr: Expr) ->
| other @ EmptyRecord
| other @ Accessor { .. }
| other @ Update { .. }
| other @ Var(_) => other,
| other @ Var(_)
| other @ RunLowLevel { .. } => other,
List {
elem_var,
@ -1194,7 +1195,14 @@ pub fn inline_calls(var_store: &mut VarStore, scope: &mut Scope, expr: Expr) ->
match loc_expr.value {
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);
// Since this is a canonicalized Expr, we should have

View file

@ -53,7 +53,7 @@ mod can_inline {
Box::new(Def {
loc_pattern: Located {
region: Region::zero(),
value: Pattern::Identifier(Symbol::INT_IS_ZERO_ARG),
value: Pattern::Identifier(Symbol::ARG_1),
},
pattern_vars: SendMap::default(),
loc_expr: Located {
@ -70,7 +70,7 @@ mod can_inline {
unsafe { Variable::unsafe_test_debug_variable(138) },
Located {
region: Region::zero(),
value: Expr::Var(Symbol::INT_EQ_I64),
value: Expr::Var(Symbol::BOOL_EQ),
},
unsafe { Variable::unsafe_test_debug_variable(139) },
)),
@ -79,7 +79,7 @@ mod can_inline {
unsafe { Variable::unsafe_test_debug_variable(140) },
Located {
region: Region::zero(),
value: Var(Symbol::INT_IS_ZERO_ARG),
value: Var(Symbol::ARG_1),
},
),
(