Treat comments as whitespace for operator arity rules, implementing SE-0037#1732
Treat comments as whitespace for operator arity rules, implementing SE-0037#1732lattner merged 4 commits intoswiftlang:masterfrom
Conversation
Previously, comments were treated as non-whitespace. Operators also checked for right-boundedness before detecting comments which start in the middle of an operator. This resolves both of these issues so that comments are consistently treated as whitespace when determining whether operators are left- or right-bound. Fixes SR-186 and SR-960 (SE-0037)
|
Not a review, just triggering the CI. @swift-ci Please test |
|
@swift-ci Please test |
|
@DougGregor Please review. |
|
@lattner Please review. |
| return false; | ||
| } | ||
| } | ||
|
|
There was a problem hiding this comment.
This logic looks correct, but for better efficiency, please put this into the default case in the switch below. That way it isn't run in the common case where a token is preceded by whitespace.
There was a problem hiding this comment.
OK, I've moved it to a separate case, which I think reads better than in the default case since it also depends on tokBegin[-1].
|
Looking good, just a few comments on the patch. |
|
Thanks for the review, @lattner! I think this is ready for another look. |
|
Looks great! Thank you again. Please send a PR for the changelog to mention this (referencing the SE) and a PR for the swift-evolution repo to move it into the "implemented" category. If you'd prefer me to take care of this, just let me know. Thanks again! |
What's in this pull request?
Implements SE-0037, "Clarify interaction between comments & operators" by treating comments as whitespace in isRightBound and isLeftBound, and fixing up right-boundedness after splitting a token at a comment start.
Also removes a test which can no longer parse. I can't see the underlying radar ( rdar://problem/18662272), so if someone at Apple could take a look and see if there's an alternative to just deleting it wholesale, that'd be great.
Resolved bug number: (SR-186, SR-960)
Before merging this pull request to apple/swift repository:
Triggering Swift CI
The swift-ci is triggered by writing a comment on this PR addressed to the GitHub user @swift-ci. Different tests will run depending on the specific comment that you use. The currently available comments are:
Smoke Testing
Validation Testing
Note: Only members of the Apple organization can trigger swift-ci.