Commit c246ad3
authored
fix(interpreter): resolve namerefs in parameter expansion for assoc array subscripts (#869)
`resolve_param_expansion_name` didn't resolve namerefs before looking up
array names for subscript access and bulk operations (`[@]`, `[*]`).
This caused `${ref[key]:-default}` and `${ref[key]:+alt}` to always
treat the value as unset when `ref` was a nameref to an associative
array.
## Changes
- Resolve namerefs for `arr_name` in the `[@]`/`[*]` bulk access path
- Resolve namerefs for `arr_name` in the individual `[key]` subscript
path
- Add 4 spec tests covering `:-`, `:+`, and `[@]:-` through namerefs
## Test plan
- [x] 4 new spec tests in `nameref.test.sh` (3 were failing before fix,
all pass after)
- [x] All 1814 bash spec tests pass (0 failures, 23 skips)
- [x] Full harness compatibility suite: 98/98 pass
- [x] Issue #801 test cases: 16/16 pass
- [x] `cargo clippy --all-features -- -D warnings` clean
- [x] `cargo fmt --check` clean
Closes #8011 parent db454e5 commit c246ad3
File tree
2 files changed
+62
-4
lines changed- crates/bashkit
- src/interpreter
- tests/spec_cases/bash
2 files changed
+62
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6312 | 6312 | | |
6313 | 6313 | | |
6314 | 6314 | | |
| 6315 | + | |
| 6316 | + | |
6315 | 6317 | | |
6316 | 6318 | | |
6317 | 6319 | | |
6318 | 6320 | | |
6319 | 6321 | | |
6320 | | - | |
| 6322 | + | |
6321 | 6323 | | |
6322 | 6324 | | |
6323 | 6325 | | |
6324 | 6326 | | |
6325 | 6327 | | |
6326 | 6328 | | |
6327 | 6329 | | |
6328 | | - | |
| 6330 | + | |
6329 | 6331 | | |
6330 | 6332 | | |
6331 | 6333 | | |
| |||
6343 | 6345 | | |
6344 | 6346 | | |
6345 | 6347 | | |
| 6348 | + | |
| 6349 | + | |
6346 | 6350 | | |
6347 | | - | |
| 6351 | + | |
6348 | 6352 | | |
6349 | 6353 | | |
6350 | 6354 | | |
6351 | 6355 | | |
6352 | 6356 | | |
6353 | 6357 | | |
6354 | | - | |
| 6358 | + | |
6355 | 6359 | | |
6356 | 6360 | | |
6357 | 6361 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
264 | 264 | | |
265 | 265 | | |
266 | 266 | | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
0 commit comments