fix: absorb glued quote tail in assignment RHS#1425
Merged
Conversation
A quoted segment or bare word glued to an assignment value with no separating space continues the same word in zsh (`x='b'cd` assigns `bcd`). The parser stopped at the closing quote and orphaned the tail into a second statement, so a glued `cd`/`rm` parsed as a real command and drew a spurious ZC1044 warning on a plain string assignment. The RHS tail absorber now consumes the glued word. The space-guarded env-prefix form (`x='b' cd`) is unchanged: a space still marks the following word as a real command. Signed-off-by: afadesigns <afadesign.official@gmail.com>
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.
What: the assignment right-hand-side absorber now consumes a quoted segment or bare word glued with no separating space, so
expansion='b'cdparses as one concatenated word (bcd) instead of orphaningcdinto a second statement.Why: in zsh, adjacent words with no space concatenate. The parser stopped at the closing quote, so the trailing
cdparsed as a real command and drew a spurious ZC1044 cd-failure warning on a plain string assignment. The zsh-abbr quote-handling tests exercise every glue position.Guard: the leading
HasPrecedingSpacecheck preserves the env-prefix formx='b' cd— a space still marks the following word as a real command (two statements).Tests: new
TestParseAssignmentGluedQuoteTailpins statement counts for the four glue forms and the two spaced forms. Violation baseline drops the twozsh-abbr/tests/_add.ztr.zshZC1044 false positives; no other corpus drift across 402 files.Severity: Warning (false positive removed).