Skip to content

[5.9][Parser] Accept 'self' after 'each' #1898

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

Conversation

rintaro
Copy link
Member

@rintaro rintaro commented Jul 11, 2023

Cherry-pick #1895 (and #1668) into release/5.9
swift repo change swiftlang/swift#67232

  • Explanation: Since SE-0398, sub expression of 'each' can be property of self, so if the parse see each self token sequence, the parser should parse it as a PackElementExpr. Also, move repeat, each, and any expression parsing logic to parseExprSequenceElement because all other <keyword> <subexpr> parsing are there.
  • Scope: Expression parsing
  • Risk: Low-Mid. This changes how 'each' expression are parsed. But since it's a new feature, breakage should be minimal (if exist)
  • Testing: Added each self. test case. Passed compatibility test suite
  • Issue: rdar://107450487
  • Reviewer: Alex Hoppen (@ahoppen)

ahoppen and others added 2 commits July 11, 2023 15:17
Since we started modelling keywords as a single `RawTokenKind` there hasn’t been an `ifKeyword` etc. anymore. Instead we always refered to them as `Keyword.if` or `.if` everywhere. We should be consistent about this in `TokenSpecSet` as well, which also shouldn’t have a `Keyword` suffix on the cases.
Also move 'repeat', 'each', and 'any' expression parsing to
'parseSequenceExpressionElement'.

rdar://107450487
@rintaro
Copy link
Member Author

rintaro commented Jul 11, 2023

swiftlang/swift#67232
@swift-ci Please test

@rintaro rintaro merged commit 4679895 into swiftlang:release/5.9 Jul 13, 2023
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