diff --git a/crates/compiler/mono/src/inc_dec.rs b/crates/compiler/mono/src/inc_dec.rs index 9b421b77e72..139303dc0cc 100644 --- a/crates/compiler/mono/src/inc_dec.rs +++ b/crates/compiler/mono/src/inc_dec.rs @@ -1094,7 +1094,7 @@ fn insert_refcount_operations_binding<'a>( } } Expr::Reset { .. } | Expr::ResetRef { .. } => { - unreachable!("Reset(ref) and reuse should not exist at this point") + unreachable!("Reset(ref) should not exist at this point") } } } diff --git a/crates/compiler/mono/src/ir.rs b/crates/compiler/mono/src/ir.rs index 7a135dd3a17..8ef7a13e27d 100644 --- a/crates/compiler/mono/src/ir.rs +++ b/crates/compiler/mono/src/ir.rs @@ -7583,7 +7583,7 @@ fn substitute_in_expr<'a>( NullPointer => None, Reset { .. } | ResetRef { .. } => { - unreachable!("reset/resetref/reuse have not been introduced yet") + unreachable!("reset(ref) has not been introduced yet") } Struct(args) => { diff --git a/crates/compiler/mono/src/tail_recursion.rs b/crates/compiler/mono/src/tail_recursion.rs index 074843fc7b7..bb7680a5033 100644 --- a/crates/compiler/mono/src/tail_recursion.rs +++ b/crates/compiler/mono/src/tail_recursion.rs @@ -1089,7 +1089,12 @@ fn expr_contains_symbol(expr: &Expr, needle: Symbol) -> bool { match expr { Expr::Literal(_) => false, Expr::Call(call) => call.arguments.contains(&needle), - Expr::Tag { arguments, .. } => arguments.contains(&needle), + Expr::Tag { + arguments, reuse, .. + } => match reuse { + None => arguments.contains(&needle), + Some(ru) => ru.symbol == needle || arguments.contains(&needle), + }, Expr::Struct(fields) => fields.contains(&needle), Expr::NullPointer => false, Expr::StructAtIndex { structure, .. }