Fix optimizer slot clash during inlining and correct closure reduction

order

   - Add new_for_inlining to SubstitutionMap to preserve the next_slot
     counter, preventing local slot collisions when merging
     scopes.
   - Update Inliner to request fresh slots for parameters during beta
     reduction instead of forcing identity mappings.
   - Fix execution order in Optimizer::visit_node for closure inlining
     to run prepare_beta_reduction before visiting the function
     body, preventing corrupted upvalue captures.
   - Fix CLI --no-opt flag to correctly disable the optimizer in the ast
     binary.
   - Add integration test to prevent future slot clash regressions.
This commit is contained in:
Michael Schimmel
2026-03-06 11:58:28 +01:00
parent 3ded62d836
commit 1342c7ca8e
3 changed files with 12 additions and 13 deletions
+1 -2
View File
@@ -128,8 +128,7 @@ impl<'a> Inliner<'a> {
}
if let Address::Local(slot) = addr {
sub.slot_mapping.insert(*slot, *slot);
sub.next_slot = sub.next_slot.max(slot.0 + 1);
sub.map_slot(*slot);
}
*offset += 1;
}