Commit 79bfe6b
authored
fix(interpreter): apply word splitting for unquoted expansions in array assignments (#1025)
## Summary
- `arr=($x)` now correctly word-splits unquoted variable expansions into
multiple elements
- Quoted words (e.g., `arr=("a b")`) are kept as single elements
- Uses existing `expand_word_to_fields` for proper IFS-based splitting
## Why
`x="hello world"; arr=($x)` produced a single-element array instead of
splitting into two elements. This is a standard bash pattern for
creating arrays from whitespace-separated strings.
## Tests
- Added spec tests: `unquoted_expansion_word_split_in_array`,
`unquoted_expansion_custom_ifs_in_array`
- 100% bash comparison match (1701/1701)
Closes #9691 parent af74d2d commit 79bfe6b
File tree
2 files changed
+43
-17
lines changed- crates/bashkit
- src/interpreter
- tests/spec_cases/bash
2 files changed
+43
-17
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3147 | 3147 | | |
3148 | 3148 | | |
3149 | 3149 | | |
3150 | | - | |
| 3150 | + | |
| 3151 | + | |
| 3152 | + | |
| 3153 | + | |
3151 | 3154 | | |
3152 | | - | |
3153 | | - | |
3154 | | - | |
3155 | | - | |
3156 | | - | |
3157 | | - | |
| 3155 | + | |
| 3156 | + | |
| 3157 | + | |
| 3158 | + | |
| 3159 | + | |
| 3160 | + | |
| 3161 | + | |
| 3162 | + | |
| 3163 | + | |
| 3164 | + | |
| 3165 | + | |
| 3166 | + | |
| 3167 | + | |
| 3168 | + | |
| 3169 | + | |
| 3170 | + | |
| 3171 | + | |
| 3172 | + | |
3158 | 3173 | | |
3159 | 3174 | | |
3160 | 3175 | | |
| |||
3167 | 3182 | | |
3168 | 3183 | | |
3169 | 3184 | | |
3170 | | - | |
3171 | | - | |
3172 | | - | |
3173 | | - | |
3174 | | - | |
3175 | | - | |
3176 | | - | |
3177 | | - | |
3178 | | - | |
3179 | | - | |
| 3185 | + | |
| 3186 | + | |
| 3187 | + | |
3180 | 3188 | | |
3181 | 3189 | | |
3182 | 3190 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
235 | 235 | | |
236 | 236 | | |
237 | 237 | | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
0 commit comments