Skip to content

Parser: properly handle token receiver in back tracking scopes #23172

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
Mar 8, 2019

Conversation

nkcsgexi
Copy link
Contributor

@nkcsgexi nkcsgexi commented Mar 7, 2019

Back tracking scope may lead to a same token to be consumed/received twice.
This patch introduces a DelayedTokenReceiver to temporarily store received
tokens during a back tracking scope. After the scope ends, the stored tokens
will be either transferred to the original token receiver in the parser or
be discarded, depending on whether the scope will actually back-track.

Fixing: rdar://42547871

@nkcsgexi nkcsgexi requested a review from rintaro March 7, 2019 23:46
@nkcsgexi
Copy link
Contributor Author

nkcsgexi commented Mar 7, 2019

@swift-ci please smoke test

@nkcsgexi
Copy link
Contributor Author

nkcsgexi commented Mar 8, 2019

@swift-ci Please smoke test OS X Platform

@nkcsgexi nkcsgexi force-pushed the token-receiver-back branch from 55a3b56 to 139d898 Compare March 8, 2019 07:46
@nkcsgexi
Copy link
Contributor Author

nkcsgexi commented Mar 8, 2019

@swift-ci Please smoke test

@nkcsgexi
Copy link
Contributor Author

nkcsgexi commented Mar 8, 2019

@swift-ci Please clean test Linux platform

@swift-ci
Copy link
Contributor

swift-ci commented Mar 8, 2019

Build failed
Swift Test Linux Platform
Git Sha - 55a3b56ababa3d3b41e3bd08b501c99c1c76e236

@rintaro
Copy link
Member

rintaro commented Mar 8, 2019

But what was the difference between "on the line" or not?

@nkcsgexi
Copy link
Contributor Author

nkcsgexi commented Mar 8, 2019

We only enter this back track scope when they are on the same line: https://github.com/apple/swift/blob/master/lib/Parse/ParseExpr.cpp#L1056.
This explains why the bug only manifests in that case.

@nkcsgexi
Copy link
Contributor Author

nkcsgexi commented Mar 8, 2019

@swift-ci please smoke test on Linux Platform

1 similar comment
@nkcsgexi
Copy link
Contributor Author

nkcsgexi commented Mar 8, 2019

@swift-ci please smoke test on Linux Platform

@nkcsgexi
Copy link
Contributor Author

nkcsgexi commented Mar 8, 2019

@swift-ci Please smoke test Linux platform

@nkcsgexi nkcsgexi merged commit f1ba7ef into swiftlang:master Mar 8, 2019
@nkcsgexi nkcsgexi deleted the token-receiver-back branch March 8, 2019 21:03
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.

3 participants