Skip to content

fix(interpreter): expand assoc array keys with command substitutions#878

Merged
chaliy merged 5 commits intomainfrom
fix/872-assoc-key-command-sub
Mar 27, 2026
Merged

fix(interpreter): expand assoc array keys with command substitutions#878
chaliy merged 5 commits intomainfrom
fix/872-assoc-key-command-sub

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Mar 27, 2026

Summary

  • Add async expand_assoc_key() that uses full word expansion (parse_word_string + expand_word) for associative array keys containing $() or backtick substitutions
  • Replaces the sync-only expand_variable_or_literal() call in process_command_assignments(), which could only handle $var/${var} but not command substitutions

Fixes #872

Test plan

  • assoc_key_command_substitutionm["$(echo hello)"]="world" expands key to hello
  • assoc_key_variable_expansionm[$key] still works
  • assoc_key_literal_unchanged — bare literal keys unchanged
  • Full test suite passes

chaliy added 5 commits March 27, 2026 22:49
Add async expand_assoc_key() that uses full word expansion
(parse_word_string + expand_word) for associative array keys containing
$() or backtick substitutions. Replaces the sync-only
expand_variable_or_literal() call in process_command_assignments().

Fixes #872
@chaliy chaliy merged commit b372d61 into main Mar 27, 2026
23 checks passed
@chaliy chaliy deleted the fix/872-assoc-key-command-sub branch March 27, 2026 23:38
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.

Associative array keys with command substitutions expand to empty string

1 participant