Capture params in nested defs

This commit is contained in:
Agus Zubiaga 2024-08-17 16:13:44 -03:00
parent c85c634387
commit 50887e6265
No known key found for this signature in database
9 changed files with 35 additions and 7 deletions

View file

@ -1569,6 +1569,9 @@ fn canonicalize_closure_body<'a>(
// filter out functions that don't close over anything
.filter(|s| !new_output.non_closures.contains(s))
.filter(|s| !output.non_closures.contains(s))
// module params are not captured by top-level defs, because they are passed in as arguments
// nested defs, however, do capture them
.filter(|s| scope.depth > 1 || !env.home_param_symbols.contains(s))
.map(|s| (s, var_store.fresh()))
.collect();