Skip to content

fix(interpreter): expand parameter operators inside arithmetic base# expressions#1039

Merged
chaliy merged 1 commit intomainfrom
fix/issue-944-arithmetic-base-expansion
Apr 3, 2026
Merged

fix(interpreter): expand parameter operators inside arithmetic base# expressions#1039
chaliy merged 1 commit intomainfrom
fix/issue-944-arithmetic-base-expansion

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Apr 3, 2026

Summary

  • Add expand_param_op_in_arithmetic to handle ${var%%-*}, ${var##prefix}, etc. inside arithmetic
  • Detect parameter operators in expand_brace_expr_in_arithmetic and delegate to new handler
  • Fixes $(( 10#${var%%-*} )) returning 0 instead of the correct base-10 value

Test plan

  • Spec tests: 4 cases (suffix removal, prefix removal, arithmetic, plain var)
  • Full test suite passes

Closes #944

@chaliy chaliy force-pushed the fix/issue-944-arithmetic-base-expansion branch from d8c1aa1 to dbbac83 Compare April 3, 2026 10:53
@chaliy chaliy merged commit 0e6f906 into main Apr 3, 2026
27 checks passed
@chaliy chaliy deleted the fix/issue-944-arithmetic-base-expansion branch April 3, 2026 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Arithmetic base# prefix does not work with inline parameter expansion

1 participant