Skip to content

Fix formatter abort on line-continuation before aligned ports - #2546

Open
kbrunham-intel wants to merge 3 commits into
chipsalliance:masterfrom
kbrunham-intel:fix/2539
Open

Fix formatter abort on line-continuation before aligned ports#2546
kbrunham-intel wants to merge 3 commits into
chipsalliance:masterfrom
kbrunham-intel:fix/2539

Conversation

@kbrunham-intel

@kbrunham-intel kbrunham-intel commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #2539

Test plan

Skip alignment for partitions where non-tree tokens precede a forced
wrap (e.g. // comment then `\`), and stop CHECK-failing in align.h so
formatting no longer aborts (issue chipsalliance#2539).
Comment thread verible/common/formatting/align.h Outdated
// }
CHECK(leading_tokens.empty() || first_tree_token_it == ftokens.end() ||
first_tree_token_it->before.break_decision !=
SpacingOptions::kMustWrap);

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.

This was already addressed in
#2530 so creates a merge conflict here.

It is solved there slightly differently (just returning column entries) so double check and settle on the best solution

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I can confirm my test still fails after #2530. I will therefore merge and refactor.

@hzeller hzeller 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.

Thanks!
Sorry this confliced with some earlier change (there were a bunch of PRs that I only just now get to looking at).
The CHECK-fail in align.h was handled slightly differently there, so double checking and verifying with tests and refine if needed.

Keep PortListCommentWithLineContinuationDoesNotAbort and drop this
branch's production alignment changes in favor of master's chipsalliance#2530 fix.
When a // comment and line-continuation `\` precede an aligned port,
skip tabular alignment and preserve original spacing in ApplyAlignment
so the comment is not glued onto the following declaration (issue chipsalliance#2539).
@kbrunham-intel

Copy link
Copy Markdown
Contributor Author

Hi @hzeller, I've updated this PR and it is ready for review. The test still fails after #2530 so I believe this change is still needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants