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

Unnecessary split in switch expression after comment #1215

Closed
munificent opened this issue May 7, 2023 · 0 comments · Fixed by #1219
Closed

Unnecessary split in switch expression after comment #1215

munificent opened this issue May 7, 2023 · 0 comments · Fixed by #1219

Comments

@munificent
Copy link
Member

A line comment before a case in a switch expression seems to force it to split when it otherwise wouldn't need to. The formatter currently produces:

    return switch (level) {
      0 => a,
      // Comment.
      1
          when flag =>
        b,
    };

    return switch (level) {
      0 => a,
      1 when flag => b,
    };

Both should have the same formatting for the 1 when flag => b case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant