Skip to content

fix: absorb glued quote tail in assignment RHS#1425

Merged
afadesigns merged 1 commit into
mainfrom
fix/glued-rhs-quote-tail
Jun 25, 2026
Merged

fix: absorb glued quote tail in assignment RHS#1425
afadesigns merged 1 commit into
mainfrom
fix/glued-rhs-quote-tail

Conversation

@afadesigns

Copy link
Copy Markdown
Owner

What: the assignment right-hand-side absorber now consumes a quoted segment or bare word glued with no separating space, so expansion='b'cd parses as one concatenated word (bcd) instead of orphaning cd into a second statement.

Why: in zsh, adjacent words with no space concatenate. The parser stopped at the closing quote, so the trailing cd parsed 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 HasPrecedingSpace check preserves the env-prefix form x='b' cd — a space still marks the following word as a real command (two statements).

Tests: new TestParseAssignmentGluedQuoteTail pins statement counts for the four glue forms and the two spaced forms. Violation baseline drops the two zsh-abbr/tests/_add.ztr.zsh ZC1044 false positives; no other corpus drift across 402 files.

Severity: Warning (false positive removed).

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>
@github-actions github-actions Bot added ci CI/CD and workflow changes test Adding or correcting tests area/parser pkg/lexer + pkg/parser + pkg/ast labels Jun 25, 2026

@redteamx redteamx left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved on review.

@afadesigns afadesigns merged commit 36b392e into main Jun 25, 2026
28 of 30 checks passed
@afadesigns afadesigns deleted the fix/glued-rhs-quote-tail branch June 25, 2026 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/parser pkg/lexer + pkg/parser + pkg/ast ci CI/CD and workflow changes test Adding or correcting tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants