Skip to content

fix(postprocess): suppress single-child wrappers with trailing delimiters - #168

Merged
HarshK97 merged 1 commit into
mainfrom
fix/wrapper-suppression-trailing-delim
Sep 20, 2026
Merged

HarshK97 merged 1 commit into
mainfrom
fix/wrapper-suppression-trailing-delim

Conversation

@HarshK97

Copy link
Copy Markdown
Owner

Problem

  1. When a single-child statement (like an assignment or call ending with a semicolon) moves, suppressCoextensiveWrappers required an exact EndByte match before suppressing the parent wrapper.
  2. Because the statement wrapper includes the semicolon and the child expression doesn't, parent.EndByte was always larger than node.EndByte. So the wrapper was never suppressed, leaving phantom insert and delete boxes around lines that just moved.

What Changed

  • Relaxed the check in suppressCoextensiveWrappers so single-child and scaffolding wrappers get suppressed if they share StartByte with the child, without needing exact EndByte equality.
  • Updated internal/postprocess/collapsing_test.go to verify that statement wrappers with trailing semicolons are properly dropped when their child moves.
  • Updated golden actions and UI fixtures for 5 Zig test cases where statement wrappers were previously surviving.

…ters

Single-child statement wrappers ending in a semicolon were never
suppressed because suppression required exact EndByte equality.
Relax the check to cover single-child and scaffolding wrappers,
removing phantom insert and delete boxes on moved lines.
@HarshK97
HarshK97 merged commit 88f4780 into main Sep 20, 2026
17 checks passed
@HarshK97
HarshK97 deleted the fix/wrapper-suppression-trailing-delim branch September 20, 2026 06:36
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.

1 participant