Commit 51a2d41
test: cover scope walks for lambdas inside unpack-target sub-expressions
Two tests added to `unpack__ops.py` that drive the cell-var and
referenced-name walks introduced for `Node::For` / `Node::With` targets:
- `_for_target_lambda` puts a closure-capturing lambda inside the
index of a for-loop subscript target. Without the walker added in
`collect_cell_vars_from_unpack_target` /
`collect_referenced_names_from_unpack_target`, the captured outer
local would be invisible to scope analysis when nothing else in the
enclosing function references it.
- `_for_target_tuple_lambda` wraps the same pattern in a nested tuple
target, exercising the `Tuple` recursion arm in both walkers.
Together these close the codecov gap on the defense-in-depth scope
walks that fire only when a subscript/attribute target's
sub-expression contains a closure.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 87ce0eb commit 51a2d41
1 file changed
Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
205 | 205 | | |
206 | 206 | | |
207 | 207 | | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
0 commit comments