-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Add trailing comma support in cases missing from Swift 6.1 #81612
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
base: main
Are you sure you want to change the base?
Conversation
ea63030
to
1a3d71c
Compare
Thank you Cal for looking into this! I think builtin attributes (and availability spec list?) were deliberately NOT implemented in the original PR ( #74522 (comment) .) @xwu What was the verdict for this? Should the compiler accept them? |
Thanks for the link, @xwu's here discussion make sense:
As I was working through the changes it was indeed unclear which attributes should support trailing commas vs which attributes shouldn't. Excluding all built-in attributes appears to be an intentional decision as a part of the acceptance. I removed that part from the PR. The other cases are more clearly just bugs that should be fixed. |
6492aaf
to
9072d86
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code changes look good to me. Thank you!
T1, | ||
T2, | ||
Bool, | ||
> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind adding test cases for generic arguments in expression positions to prevent future regressions? Like let _ = Generic<Int, Bool,>.self
and let _ = Generic<Int, Bool,>()
. It also uses parseGenericArguments()
(currently) so it should work with your changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for remembering to check that! It didn't work originally, we also had to update the lookahead code that disambiguated the <
between a generic list and a less than operator. Updated, working now :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah canParseGenericArguments()
. That makes sense. Thank you for fixing it!
ac24f18
to
9a3f33d
Compare
@swift-ci Please smoke test |
@calda Thanks for fixing these cases that I missed! |
The CI job failed with:
@rintaro, can you trigger CI again with the Swift Syntax changes from swiftlang/swift-syntax#3080 included? Thanks! |
swiftlang/swift-syntax#3080 |
(closed/reopened by mistake) |
swiftlang/swift-syntax#3080 |
swiftlang/swift-syntax#3080 |
@calda Everything LGTM, and I will merge this and the swift-syntax PR as soon as the CI passes. |
swiftlang/swift-syntax#3080 |
swiftlang/swift-syntax#3080 |
swiftlang/swift-syntax#3080 |
1 similar comment
swiftlang/swift-syntax#3080 |
@swift-ci Please smoke test macOS |
Corresponding swift-syntax PR: swiftlang/swift-syntax#3080
In Swift 6.1, there are many cases where trailing commas should be supported but currently are not:
This includes cases like: