Skip to content

[Parser][SR-698][Qol] add diagnostic for trailing ',' in lists #1265

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

Merged
merged 1 commit into from
Feb 11, 2016

Conversation

dduan
Copy link
Contributor

@dduan dduan commented Feb 11, 2016

f(a: Int, b: Int) {}
f(1, b: 2,) // this trailing comma now gets a proper diagnostic.

see https://bugs.swift.org/browse/SR-698

@slavapestov
Copy link
Contributor

@swift-ci Please test

@lattner
Copy link
Contributor

lattner commented Feb 11, 2016

Nice - I love the fix, nice and general!

@ddunbar
Copy link
Contributor

ddunbar commented Feb 11, 2016

Is this a situation we can safely emit a fixit for, if we know we are inside a method call and immediately followed by a ')'?

@dduan
Copy link
Contributor Author

dduan commented Feb 11, 2016

@ddunbar Is there any special about functions calls, in regard to fixits?

@ddunbar
Copy link
Contributor

ddunbar commented Feb 11, 2016

No, but I imagined that your improved diagnostic could fire in situations where the fixit would be very likely to be wrong. I'm not familiar enough with the Swift compiler internals to know more...

On Feb 10, 2016, at 8:29 PM, Daniel Duan [email protected] wrote:

@ddunbar https://github.com/ddunbar Is there any special about functions calls, in regard to fixits?


Reply to this email directly or view it on GitHub #1265 (comment).

@dduan
Copy link
Contributor Author

dduan commented Feb 11, 2016

Ah, as in, when the user is typing in Xcode, and the ) has been inserted ahead of time?

This may need some testing. Hmm...

@jrose-apple
Copy link
Contributor

I think it's still a net improvement over what we have now. It's going to diagnose either way, and the user doesn't have to accept the fix-it.

@dduan
Copy link
Contributor Author

dduan commented Feb 11, 2016

I struggle to come up any edge cases. So if any of core team member thinks this is good enough, feel free to merge.

lattner added a commit that referenced this pull request Feb 11, 2016
[Parser][SR-698][Qol] add diagnostic for trailing ',' in lists
@lattner lattner merged commit 63e367e into swiftlang:master Feb 11, 2016
@dduan dduan deleted the SR698 branch December 23, 2019 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants