Skip to content

Trailing comma not allowed in generic argument lists despite SE-0439 #81474

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

Open
calda opened this issue May 13, 2025 · 2 comments
Open

Trailing comma not allowed in generic argument lists despite SE-0439 #81474

calda opened this issue May 13, 2025 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels

Comments

@calda
Copy link
Contributor

calda commented May 13, 2025

Description

Trailing commas are supported in some of the following generic argument lists, but not all of them:

struct Foo<
  T1,
  T2,
  T3, // allowed
> { }

typealias Bar<
  T1,
  T2, // allowed
> = Foo<
  T1,
  T2,
  Bool, // trailing comma not allowed here
>

let foo: Foo<
  String,
  Int,
  Bool, // trailing comma not allowed here
>

func bar() -> Foo<
  String,
  Int,
  Bool, // trailing comma not allowed here
> {
  Foo()
}

I would expect trailing commas to be supported in all of these places given SE-0439.

Reproduction

Run the above code using a Swift 6.1 compiler, e.g. https://swiftfiddle.com/w2lk6nc4bvar7fwiwonknrlq6a

Expected behavior

The code should compile, but doesn't.

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
Copy link
Contributor Author

calda commented May 13, 2025

fyi @mateusrodriguesxyz

@calda
Copy link
Contributor Author

calda commented May 19, 2025

Fixed in #81612

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. triage needed This issue needs more specific labels
Projects
None yet
Development

No branches or pull requests

1 participant