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

Trailing comma on when-case should be followed by newline. #376

Open
plobsing opened this issue Jan 9, 2023 · 0 comments
Open

Trailing comma on when-case should be followed by newline. #376

plobsing opened this issue Jan 9, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@plobsing
Copy link

plobsing commented Jan 9, 2023

To be consistent with the handling of other constructs that support trailing commas. In particular the case of a trailing-comma followed by -> is also seen with lambdas where it does prompt the insertion of a newline.

val whenWithTrailingComma =
    when (someEnum) {
        A,
        B, -> caseBody() // Trailing comma does not prevent the elision of any newlines.
        else -> TODO("unhandled")
    }

val lambdaWithTrailingComma =
    { a, b, // Trailing comma leads to newline insertion.
        ->
        body()
    }
@hick209 hick209 added the bug Something isn't working label Sep 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants