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

FormatOps: check for left brace in multistat block #3279

Merged
merged 3 commits into from
Jul 26, 2022

Conversation

kitbellew
Copy link
Collaborator

Depending on how scalameta parses the code, the left brace could be just before the multistat block (previously covered) or at the head of it. Fixes #3276.

Comment on lines +3486 to +3489
def notOK: Boolean =
if (1 == 1) { c; a + b }.foo
else
false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def notOK: Boolean =
if (1 == 1) { c; a + b }.foo
else
false
def notOK: Boolean =
if (1 == 1) { c; a + b }.foo
else false

why only fold thenp ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

else part uses the existing newline. and the then part uses an old rule about {. i will copy the same tests into scala2, they are formatted exactly the same.

i will try to address that rule separately.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tgodzik addressed in #3282, ptal.

Sometimes it starts a smaller region and shouldn't be skipped.
Depending on how scalameta parses the code, the left brace could be just
before the multistat block (previously covered) or at the head of it.
Copy link
Contributor

@tgodzik tgodzik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM then!

@kitbellew kitbellew merged commit 63d5b37 into scalameta:master Jul 26, 2022
@kitbellew kitbellew deleted the 3276 branch July 26, 2022 13:40
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.

Conditional statements can get a different format when moving to scala3 dialect
2 participants