Skip to content

Conversation

@hamishknight
Copy link
Contributor

5.9 cherry-pick of #65915, based on #65905

  • Explanation: Fixes an issue where an if/switch expression would be incorrectly rejected when used in an assignment to an optional chain.
  • Scope: Affects if/switch expressions used in assignments.
  • Issue: rdar://109305454
  • 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
Make sure we look through a wrapping
`OptionalEvaluationExpr` and its injections when
looking for an assignment to mark a valid if/switch
source expression.

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

@swift-ci please test

@hamishknight hamishknight merged commit 310ff65 into swiftlang:release/5.9 May 16, 2023
@hamishknight hamishknight deleted the off-the-chain-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