Skip to content

trailingCommas false positives for parenthesized expressions (IMO) #2653

Description

@rgoldberg

If a parenthetical expression contains multiple values, it is a tuple; if it contains only one value, it is a parenthesized expression, not a tuple.

I think trailingCommas reports false positives for parenthesized expressions:

func f() {
	_ = (
		[1] + [2] // error: (trailingCommas) Add or remove trailing commas in comma-separated lists.
	)
	.map(String.init)
}

Shouldn't there not be a trailing comma for parenthesized expressions?

Maybe this could be configurable by an option, but it could be hardcoded to not requiring commas there.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions