Skip to content

[Syntax] Fix roundtrip test #13339

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 5 commits into from
Dec 11, 2017
Merged

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Dec 8, 2017

Previously, Lexer state hadn't been correctly restored beyond multiple parseIntoSourceFile() invocation. It used to result trivia loss between TopLevelCodeDecl.
This PR fixes that by holding exact ParserPosition (renamed from Parser::ParserPosition) in PersistentParserState.

Also, utils/round-trip-syntax-test used to always report "SUCCESS" because of a logic error in the script.

@rintaro
Copy link
Member Author

rintaro commented Dec 8, 2017

@akyrtzi You introduced PersistentParserState::ParserPos in 803ba0e.
Is there any particular reason not to hold Lexer/Parser state in PersistentParserState?

@rintaro
Copy link
Member Author

rintaro commented Dec 8, 2017

@swift-ci Please smoke test

@akyrtzi
Copy link
Contributor

akyrtzi commented Dec 8, 2017

With the caveat that it's been a long time since I introduced that so I'm likely lacking a lot of context, I can't think of a reason.

@rintaro rintaro force-pushed the syntax-parserposition branch from 9e4a08f to 5cd6a0b Compare December 9, 2017 04:59
Instead of re-lexing Trivias. Trivia might contain skipped garbage which
might be re-lexed as tokens.
was always success because of logic error in the script.
@rintaro rintaro force-pushed the syntax-parserposition branch from 5cd6a0b to 1615a67 Compare December 9, 2017 05:48
@rintaro
Copy link
Member Author

rintaro commented Dec 9, 2017

@swift-ci Please smoke test

@rintaro rintaro merged commit a0f49ca into swiftlang:master Dec 11, 2017
@rintaro rintaro deleted the syntax-parserposition branch December 11, 2017 07:09
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.

2 participants