-
Notifications
You must be signed in to change notification settings - Fork 46
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
Fix: Properly format switch expressions #1069
Conversation
@@ -63,6 +63,7 @@ void reformat_a_subpath_of_a_git_directory_for_only_changed_lines() throws IOExc | |||
runCommandInRepo("git", "init"); | |||
runCommandInRepo("git", "config", "user.name", "Test User"); | |||
runCommandInRepo("git", "config", "user.email", "[email protected]"); | |||
runCommandInRepo("git", "config", "commit.gpgsign", "false"); |
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.
Drive-by improvement: Didn't see it as necessary to sign the commits made by the test
int x = | ||
switch (y) { | ||
case 1 -> 1; | ||
case 2 -> throw new IllegalArgumentException(); | ||
default -> throw new IllegalStateException(); | ||
}; |
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.
Would like to fix this in the future FWIW to instead be:
int x = switch (y) {
case 1 -> 1;
case 2 -> throw new IllegalArgumentException();
default -> throw new IllegalStateException();
};
But that requires more complicated changes to happen to the visitAssignment
method which should be left to a separate PR
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.
tyvm!
Released 2.42.0 |
Before this PR
Fixes #1025 where before this change, we'd format switch expressions used in an assignment to yield the following:
After this PR
==COMMIT_MSG==
Properly format switch expressions
==COMMIT_MSG==
and now we generate this:
Possible downsides?