Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow a factory constructor with metadata before it to split. #1580

Merged
merged 1 commit into from
Oct 15, 2024

Conversation

munificent
Copy link
Member

Prior to this PR, if there was metadata before a constructor, it would be attached to the "header" piece of the constructor -- the leading keywords and name -- instead of the entire constructor piece.

That in turn meant that the newline after the metadata would lead the formatter to think a split had occurred inside the header itself, instead of before the entire constructor. That would in turn confuse the solver and it ended up trying to disallow splitting anywhere in the constructor, even if that led to an overflowing line.

This fixes that so that the metadata is attached to the entire constructor piece, not just the nested header part.

Prior to this PR, if there was metadata before a constructor, it would
be attached to the "header" piece of the constructor -- the leading
keywords and name -- instead of the entire constructor piece.

That in turn meant that the newline after the metadata would lead the
formatter to think a split had occurred inside the header itself,
instead of before the entire constructor. That would in turn confuse
the solver and it ended up trying to disallow splitting anywhere in the
constructor, even if that led to an overflowing line.

This fixes that so that the metadata is attached to the entire
constructor piece, not just the nested header part.
@munificent munificent merged commit 89577e7 into main Oct 15, 2024
7 checks passed
@munificent munificent deleted the metadata-before-factory-constructor branch October 15, 2024 22:35
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.

2 participants