Apply stroustrup bracket style to object expressions - #3450
Merged
Conversation
Object expressions were printed by the aligned branch whatever
MultilineBracketStyle said, so `{ new T with` stayed on one line and
stroustrup was the only bracket style that did not reach every bracket it
names. They now have a branch of their own, and Expr.ObjExpr counts as a
stroustrup-style expression, so the brace stays on the line that opens the
binding and `new T with` moves below it. This is the form the Microsoft
style guide writes out under "Formatting object expressions". It was left
alone in the belief that the layout produced an offside error, which no
compiler back to F# 6 agrees with.
Two places that were overriding stroustrup are lifted along with it, for
every bracket kind rather than for object expressions alone. A match clause
governed by ExperimentalKeepIndentInBranch no longer takes the decision away
from a stroustrup body, and a binding whose signature broke across lines now
gets the stroustrup body layout that the single-line path already had.
The closing bracket of a stroustrup body in a match clause stays two columns
right of the bar. On the bar's own column the `|` of the next clause no
longer parses, and giving only the last clause the bar's column would leave
two columns in one match; a comment records both.
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.
Object expressions were printed by the aligned branch whatever MultilineBracketStyle said, so
{ new T withstayed on one line and stroustrup was the only bracket style that did not reach every bracket it names. They now have a branch of their own, and Expr.ObjExpr counts as a stroustrup-style expression, so the brace stays on the line that opens the binding andnew T withmoves below it. This is the form the Microsoft style guide writes out under "Formatting object expressions". It was left alone in the belief that the layout produced an offside error, which no compiler back to F# 6 agrees with.Two places that were overriding stroustrup are lifted along with it, for every bracket kind rather than for object expressions alone. A match clause governed by ExperimentalKeepIndentInBranch no longer takes the decision away from a stroustrup body, and a binding whose signature broke across lines now gets the stroustrup body layout that the single-line path already had.
The closing bracket of a stroustrup body in a match clause stays two columns right of the bar. On the bar's own column the
|of the next clause no longer parses, and giving only the last clause the bar's column would leave two columns in one match; a comment records both.Fixes #2990