-
Notifications
You must be signed in to change notification settings - Fork 81
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
Remove unnecessary indentation from list comprehension #1119
Conversation
7f6ac41
to
1a09212
Compare
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.
Thanks!
This will change quite a lot of Ormolu-clean code in the wild (see eg for our hackageTests), but it is very innocent.
No strong opinion either way on the refactorings in the first few commits; based on your question/remark in one of the comments there, I even suggested a potentially different refactoring, see the corresponding review comment #1119 (comment).
3316a11
to
4a68831
Compare
4a68831
to
bba58da
Compare
Maybe stack this PR on top of #1121? |
9c965bb
to
c04cd9d
Compare
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.
Looks good from my side, I also updated the PR description to account for the commits that were moved to #1121.
c04cd9d
to
c3f2260
Compare
Applied as 5c816de. Thanks! |
just out of curiosity, is there a reason you didn't use github's squash and merge functionality? |
I just don't have the habit of using that, so I am always a little bit unsure whether it will create a merge commit or not. I do not like having merge commits. I usually first do a rebase to prepare "pretty history" and then I do "rebase and merge". Here, I wanted to do some tweaks in the changelog (I think I added the link to the issue) and remembering that you don't like your branch to be modified I decided to apply to master like this. I think I could as well push a commit on top and then do "squash and merge". |
Makes sense! If it's a small CHANGELOG commit, I'm fine with you pushing to my branch. FYI you can go to Settings and disable merge commits when merging PRs. You should be able to force PRs to merge with Squash + Merge |
Resolves #966.
List comprehensions have an extra indentation because the current implementation treats comprehensions the same as a normal list, so it treats the piped section as being inside the list.
The bulk of the change is simply to only
sitcc
the list comprehension whens == S
. This unindents list comprehensions in most circumstances. The remaining issue is list comprehensions on the RHS of a bind in a do-block; previously, all expressions in a do-block are marked asS
, but the RHS of a bind does not requireS
. To fix this, I updatedp_stmt'
to take inBracketStyle
so thatBindStmt
can explicitly switch it toN
.Semi-related to #1116, but an independent change. Additional context here: fourmolu/fourmolu#418 (comment)
Review instructions
Recommend reviewing commit-by-commit. There are a lot of commits, but they can broken down like this: