Skip to content

Trailing comma not supported in tuple types or closure types despite SE-0439 #81485

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

Closed
calda opened this issue May 13, 2025 · 2 comments · Fixed by #81612
Closed

Trailing comma not supported in tuple types or closure types despite SE-0439 #81485

calda opened this issue May 13, 2025 · 2 comments · Fixed by #81612
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself function types Feature → types: function types parser Area → compiler: The legacy C++ parser swift 6.2 tuple types Feature → types: Tuple types types Feature: types unexpected error Bug: Unexpected error

Comments

@calda
Copy link
Contributor

calda commented May 13, 2025

Description

In Swift 6.1, trailing commas are unexpectedly not supported in tuple types or closures types, despite being supported in tuple and closure values.

let foo: (
  bar: String,
  quux: String // trailing comma not supported
)

let closure: (
  String,
  String // trailing comma not supported
) -> (
  bar: String,
  quux: String // trailing comma not supported
)


func method(
    bar: String,
    quux: String, // trailing comma supported
) {}

let bar = (
  foo: "foo",
  baaz: "Baaz", // trailing comma supported
)

let closureWithParams = { (
  foo: String,
  bar: String, // trailing comma supported
) in
  print(foo, bar)
}

Reproduction

Compile the above code using Swift 6.1 or later. e.g. https://swiftfiddle.com/727fq4hkxzbcrojuf7e6lpkevu

Expected behavior

The code should compile without errors.

Environment

Swift version 6.2-dev (LLVM a3e32cdaae72f3d, Swift fa86097)

Additional information

No response

@calda calda added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels labels May 13, 2025
@calda calda changed the title Trailing comma not supported in tuples or closures despite SE-0439 Trailing comma not supported in tuples or closure types despite SE-0439 May 13, 2025
@calda
Copy link
Contributor Author

calda commented May 13, 2025

fyi @mateusrodriguesxyz

@calda
Copy link
Contributor Author

calda commented May 19, 2025

Fixed in #81612

@calda calda changed the title Trailing comma not supported in tuples or closure types despite SE-0439 Trailing comma not supported in tuple types or closure types despite SE-0439 May 19, 2025
@AnthonyLatsis AnthonyLatsis added parser Area → compiler: The legacy C++ parser compiler The Swift compiler itself unexpected error Bug: Unexpected error swift 6.2 and removed triage needed This issue needs more specific labels labels May 26, 2025
@AnthonyLatsis AnthonyLatsis added function types Feature → types: function types types Feature: types tuple types Feature → types: Tuple types labels May 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself function types Feature → types: function types parser Area → compiler: The legacy C++ parser swift 6.2 tuple types Feature → types: Tuple types types Feature: types unexpected error Bug: Unexpected error
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants