Skip to content

[5.9] [ASTScopes] Fix scope expansion for if/switch expressions #65905

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
May 16, 2023

Conversation

hamishknight
Copy link
Contributor

@hamishknight hamishknight commented May 13, 2023

5.9 cherry-pick of #65893

  • Explanation: Fixes an issue where name lookup would not find a binding introduced by an if/switch expression that is used in an assignment.
  • Scope: Affects name lookup of bindings introduced by if/switch expressions used in assignments (note that if/switch expressions in bindings are unaffected).
  • Issue: rdar://109192116
  • Risk: Low
  • Testing: Added tests to the test suite
  • Reviewer: Pavel Yaskevich

Previously we could miss the scopes present in
if/switch expressions if they were nested in
another expression, such as an AssignExpr. Fix
the logic such that we properly walk over a given
expression looking for if/switch scopes, the same
as what we do for closures.

rdar://109192116
@hamishknight hamishknight added 🍒 release cherry pick Flag: Release branch cherry picks swift 5.9 labels May 13, 2023
@hamishknight hamishknight requested a review from a team as a code owner May 13, 2023 10:36
@hamishknight
Copy link
Contributor Author

@swift-ci please test

@hamishknight hamishknight merged commit 6be7085 into swiftlang:release/5.9 May 16, 2023
@hamishknight hamishknight deleted the scoping-out-5.9 branch May 16, 2023 15:58
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.9
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants