Repository navigation
fix(arith): assign to array elements in ((...)), let and $((...)) - #2558
Merged
Merged
Conversation
chaliy
force-pushed
the
claude/fidelity-array-arith
branch
from
October 7, 2026 11:53
bbd9f62 to
d083b51
Compare
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
bashkit | df75976 | Commit Preview URL Branch Preview URL |
Oct 07 2026, 12:09 PM |
((a[i]++)), ((c[$k]+=n)), ((a[2]=5)), let a[1]++ now update the element instead of losing the write. Indexed subscripts are arithmetic (negative allowed); associative keys are literal with $name expanded and quotes dropped. Writes stay on the budgeted array writers. Claude-Session: https://claude.ai/code/session_019aFikmptPc91Fj4N2iDXQA
chaliy
force-pushed
the
claude/fidelity-array-arith
branch
from
October 7, 2026 12:09
d083b51 to
df75976
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Михайло · project thread
What changed
Arithmetic can assign to array elements:
((a[i]++)),((c[$k]+=3)),((a[2]=5)),((--a[0])),let a[1]++,$((c[x]--)). Indexed subscripts are evaluated arithmetically (negative indexes count from the end). Associative keys are literal, with$name/${name}expanded and quotes dropped (c["x y"],c[k$i]).Why
Counting with
((count[$word]++))is a very common agent idiom. Gap telemetry showed it silently produced empty or stale values.Before
After
arith-array-lvalue.test.sh(14 cases) matches real bash 5.2 on every case.Risk
Low. Writes go through the same budgeted array writers as
${a[i]:=v}; new testtm_dos_060_arithmetic_array_writes_respect_budgetchecksmax_array_entriesstill caps them.((...))now drops lexer quote markers from words (bash removes quotes there too).Checklist
cargo test -p bashkit --lib --tests, clippy, fmthttps://claude.ai/code/session_019aFikmptPc91Fj4N2iDXQA
Generated by Claude Code