mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
recursive functions cannot capture other recursive functions from their LetRec
This commit is contained in:
parent
54de538952
commit
063492680f
2 changed files with 7 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue