swiftlang / swiftlang/swift-syntax

`parseMacroRoleArguments` should allow trailing commas

Open
#3,306 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
Swift
Stars
3.7k
Forks
553
Avg merge
5d 13h
Merged PRs (30d)
16

Description

### Description

Discovered via https://github.com/swiftlang/swift-format/issues/1178.

[`parseMacroRoleArguments`](https://github.com/swiftlang/swift-syntax/blob/e9b514360b46276ea54e535fddf4cb1ae2942c44/Sources/SwiftParser/Attributes.swift#L409) explicitly disallows trailing commas, but that seems like an oversight; as far as the user is concerned, that looks (and is represented in the AST) as a regular `LabeledExprListSyntax`, and the intent of SE-0439 was that the language would support trailing commas in those kinds of lists.

From what I can tell in the Git history, as trailing comma support was rolled out, the argument was added and defaulted to false and then it was updated for custom attributes but not for macro role attributes.

### Steps to Reproduce

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.