feat(formatter): place multiline method return types - #3138
Draft
floitsch wants to merge 1 commit into
Draft
Conversation
floitsch
force-pushed
the
floitsch/formatter-rewrite.30-expression-lowering
branch
from
August 4, 2026 23:24
3ba2486 to
be63648
Compare
floitsch
force-pushed
the
floitsch/formatter-rewrite.40-return-type-placement
branch
from
August 4, 2026 23:24
fa1440e to
9f37ac8
Compare
floitsch
force-pushed
the
floitsch/formatter-rewrite.30-expression-lowering
branch
from
August 4, 2026 23:27
be63648 to
8866616
Compare
floitsch
force-pushed
the
floitsch/formatter-rewrite.40-return-type-placement
branch
from
August 4, 2026 23:27
9f37ac8 to
d0524c0
Compare
floitsch
force-pushed
the
floitsch/formatter-rewrite.30-expression-lowering
branch
from
August 5, 2026 01:08
8866616 to
a642314
Compare
floitsch
force-pushed
the
floitsch/formatter-rewrite.40-return-type-placement
branch
from
August 5, 2026 01:08
d0524c0 to
59ca8f4
Compare
floitsch
force-pushed
the
floitsch/formatter-rewrite.40-return-type-placement
branch
from
August 5, 2026 01:12
59ca8f4 to
7cb7be5
Compare
floitsch
force-pushed
the
floitsch/formatter-rewrite.30-expression-lowering
branch
from
August 5, 2026 01:12
a642314 to
1ddf42e
Compare
floitsch
changed the base branch from
floitsch/formatter-rewrite.30-expression-lowering
to
floitsch/formatter-rewrite.35-method-headers
August 5, 2026 01:13
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.
Part 5 of the formatter rewrite stack. Based on #3139.
This isolates the formatter's one token-order exception in
format_return_type.cc.Generic method lowering still constructs and first selects the ordinary source-order header. Only when the selected parameter span is multiline does this pass construct the explicit return-first order:
Flat parameters retain the ordinary form:
The exception consumes private semantic method pieces through the single
select_method_headerentry point. No general Layout, SelectedPlan, or repair API gains a relocation operation, and no other formatter component can assemble an alternative method-header order.The method tests reparse both ordinary and reordered headers, compare their semantic header trees, and format them a second time to verify idempotence. Compiler analysis also passes for both formatter fixtures.
Stack: 5/5.