-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfgenericsFeature: generic declarations and typesFeature: generic declarations and typesparserArea → compiler: The legacy C++ parserArea → compiler: The legacy C++ parserswift 6.2unexpected errorBug: Unexpected errorBug: Unexpected error
Description
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
ivan-gaydamakin, MaksimBezdrobnoi, dfed and miguel-jimenez-0529
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfgenericsFeature: generic declarations and typesFeature: generic declarations and typesparserArea → compiler: The legacy C++ parserArea → compiler: The legacy C++ parserswift 6.2unexpected errorBug: Unexpected errorBug: Unexpected error