Skip to content

fix(interpreter): short-circuit && and || inside [[ ]] for set -u#1035

Merged
chaliy merged 1 commit intomainfrom
fix/issue-939-conditional-short-circuit
Apr 3, 2026
Merged

fix(interpreter): short-circuit && and || inside [[ ]] for set -u#1035
chaliy merged 1 commit intomainfrom
fix/issue-939-conditional-short-circuit

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Apr 3, 2026

Summary

  • Add evaluate_conditional_words that operates on raw Word tokens with lazy expansion
  • && short-circuits: if left is false, right side is never expanded
  • || short-circuits: if left is true, right side is never expanded
  • Prevents spurious "unbound variable" errors under set -u

Test plan

  • Spec tests: 4 cases covering &&/|| short-circuit with set -u
  • Full test suite passes (2220 tests)

Closes #939

@chaliy chaliy force-pushed the fix/issue-939-conditional-short-circuit branch from 32b94f1 to a633cee Compare April 3, 2026 10:45
@chaliy chaliy merged commit aeb21c1 into main Apr 3, 2026
27 checks passed
@chaliy chaliy deleted the fix/issue-939-conditional-short-circuit branch April 3, 2026 10:59
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.

[[ ]] does not short-circuit && with set -u, causing unbound variable errors

1 participant