-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[SR-510][Parser] complain for invalid enum raw value #955
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
Conversation
Instead of fail silently, issue a diagosis when a valid expression can not be parsed for enum raw value. This resolves [SR-510](https://bugs.swift.org/browse/SR-510).
This seems reasonable, but (a) is it possible to use the loc of the first token after the equal sign instead, and (b) what happened to the other issue about parsing a closure? That still seems like a better fix for this particular unparseable expression. |
Hi @jrose-apple,
done.
I agree with your verdict. #934 could fix a number of unforeseen issues (wherever a closure is defined without a context). That said, this approach has a similar benefit: it catches all cases where the |
Didn't notice this one util now. Done.
None to the best of my knowledge.
That makes an argument for this type of catch-all fix IMO. It's always hard to prove something doesn't exist 😛. (it's still valuable to find all edge cases. If the context-less closure parsing causes other bugs, we would fix it then). |
This looks good to me. Please email swift-dev to see if Ted will approve pulling this into Swift 2.2, thanks! |
[SR-510][Parser] complain for invalid enum raw value
fix raw value error test introduced in #955
I'd argue that this diagnostic should be an assertion, then, not a separate diagnostic. In the common case here, we'll get duplicate error messages, and this one doesn't add any value. |
Fair. To avoid the duplicate message, we could do one of the following:
On Fri, Jan 15, 2016 at 8:41 AM -0800, "Jordan Rose" notifications@github.com wrote: I'd argue that this diagnostic should be an assertion, then, not a separate diagnostic. In the common case here, we'll get duplicate error messages, and this one doesn't add any value. — |
I really just want to parse the closure successfully and then error successfully, as discussed in #934. |
@dduan Are you still working on this? If so, let me know and I will assign the bug to you. FWIW, I think this can also happen for at least a couple other cases:
and
|
Hi, @jder. @jrose-apple has been helping me with #987. But from what you posted here, that fix may not be general enough. |
@dduan OK, I'm going to assign you the bug and stop working on it, then. My WIP is here, if you'd like to grab anything from it: master...jder:parse-closures-dummy-localcontext. It catches some cases but still not all of them. |
Resolve conflicts with master
Instead of fail silently, issue a diagosis when a valid expression can not
be parsed for enum raw value.
Resolves SR-510.