`parseMacroRoleArguments` should allow trailing commas

Open Beginner friendly
#3,306 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
swift
Domain
compilers

Research direction

Start in Sources/SwiftParser/Attributes.swift at parseMacroRoleArguments, linked from the issue. Review how trailing-comma support is configured for macro role and custom attributes, then verify that macro role argument lists accept a trailing comma and are represented as a regular LabeledExprListSyntax.

Written by the indexing model from the issue text.

Description

Description

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

parseMacroRoleArguments 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

Dominant language
Swift
Stars
3.7k
Forks
554
Avg merge
6d 8h
Merged PRs (30d)
22

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from swiftlang/swift-syntax

All issues in swiftlang/swift-syntax

Similar issues

More Swift issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.