recursive functions cannot capture other recursive functions from their LetRec

This commit is contained in:
Folkert 2020-11-09 15:01:21 +01:00
parent 54de538952
commit 063492680f
2 changed files with 7 additions and 1 deletions

View file

@ -304,6 +304,13 @@ fn fix_values_captured_in_closure_defs(
defs: &mut Vec<crate::def::Def>,
no_capture_symbols: &mut MutSet<Symbol>,
) {
// recursive defs cannot capture each other
for def in defs.iter() {
no_capture_symbols.extend(crate::pattern::symbols_from_pattern(&def.loc_pattern.value));
}
// TODO mutually recursive functions should both capture the union of both their capture sets
for def in defs.iter_mut() {
fix_values_captured_in_closure_def(def, no_capture_symbols);
}