-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Format if
statements
#4961
Format if
statements
#4961
Conversation
Current dependencies on/for this PR:
This comment was auto-generated by Graphite. |
PR Check ResultsEcosystem✅ ecosystem check detected no changes. BenchmarkLinux
Windows
|
60dd48a
to
26a4a83
Compare
2fd8f14
to
b25a3ac
Compare
26a4a83
to
3be5049
Compare
b25a3ac
to
226aabf
Compare
dcb2aaa
to
3b8b3a9
Compare
226aabf
to
b9826c1
Compare
else_comments = trailing_alternate_comments; | ||
last_node_of_previous_body = body.last(); | ||
|
||
if let Some(elif) = else_if(orelse) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean there's no elif node, just if?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. elif
is represented as an else
body that contains a single if
statement. Rome (and Roslyn) model this very similarly where the alternate
(else) is either an if
statement (in which it is an else if
) or a block (an else).
Summary
This PR implements the formatting of
if
statements. I haven't verified if it covers all edge cases becausethat will be easier once we have better coverage (you can simply go througth the black differences), but I believe it covers most reasonable uses pretty well.
Test Plan
A few own unit tests and reviewed (as best as I can) the black differences