-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Closed
Copy link
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 itselffunction typesFeature → types: function typesFeature → types: function typesparserArea → compiler: The legacy C++ parserArea → compiler: The legacy C++ parserswift 6.2tuple typesFeature → types: Tuple typesFeature → types: Tuple typestypesFeature: typesFeature: typesunexpected errorBug: Unexpected errorBug: Unexpected error
Description
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
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 itselffunction typesFeature → types: function typesFeature → types: function typesparserArea → compiler: The legacy C++ parserArea → compiler: The legacy C++ parserswift 6.2tuple typesFeature → types: Tuple typesFeature → types: Tuple typestypesFeature: typesFeature: typesunexpected errorBug: Unexpected errorBug: Unexpected error