Skip to content

[5.3][CodeCompletion] Skip to '=' after completion in 'if'/'guard' pattern #32286

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 Jun 10, 2020

Cherry-pick of #32062 into release/5.3

  • Explanation: For case pattern in if or guard statement (e.g. if case .<HERE>(let foo) = something { ... }) the type of the pattern is determined by its initializer. Previously, the parser used to give up parsing the initializer, so it couldn't provide useful completions. This patch adds a parser recovery to skip to = after completion token so that it can type check the initializer expression.
  • Scope: Code completion in case pattern for if/guard statement
  • Risk: Low. It adds just a parser recovery logic in code completion specific code path
  • Testing: Added regression test cases
  • Issue: rdar://problem/56802036
  • Reviewers: Nathan Hawes (@nathawes)

So that the parser can parse the subject expresion which provides the
expected type of the pattern.

rdar://problem/56802036
(cherry picked from commit f107a15)
@rintaro rintaro requested a review from a team as a code owner June 10, 2020 01:46
@rintaro
Copy link
Member Author

rintaro commented Jun 10, 2020

@swift-ci Please test

@rintaro rintaro added the r5.3 label Jun 10, 2020
@rintaro
Copy link
Member Author

rintaro commented Jun 10, 2020

@swift-ci Please nominate

@tkremenek tkremenek merged commit fc20aee into swiftlang:release/5.3 Jun 10, 2020
@AnthonyLatsis AnthonyLatsis added swift 5.3 🍒 release cherry pick Flag: Release branch cherry picks labels Jan 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 5.3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants