Fix bug where two contiguous ignore-begin blocks results in an error#367
Merged
michalmuskala merged 1 commit intoWhatsApp:mainfrom Apr 25, 2025
Merged
Conversation
Member
|
Thank you! ❤️ The CI failing is due to ubuntu 20.04 deprecation, I'll fix that separately |
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.
Erlfmt currently can't parse two contiguous
erlfmt:ignore-begin/erlfmt:ignore-endblocks. When we parse the firstignore-endwe leave the formatter in an "end" state and don't clear it before the next "begin" since we don't runignore_state_preorignore_state_postuntil the next non-comment. erlfmt doesn't handle transitions fromendtobegin, resulting in an error.After checking the code, it's unclear to me why we need an
endstate in the first place - we always end up transforming it intofalsewhenever we start or finish processing a statement. On this PR I'm simplifying things by simply setting the state tofalseafter anerlfmt:ignore-endstatement.The unit test added fails in master and can be used to confirm the fix.