Skip to content

Conversation

hamishknight
Copy link
Contributor

5.9 cherry-pick of #66762

  • Explanation: Fixes a constraint system crash when attempting to diagnose an invalid pattern match.
  • Scope: Affects diagnostic logic for patterns
  • Radar: rdar://111009224
  • Risk: Low, only affects invalid code, and the fix is defensive in nature
  • Testing: Added tests to test suite
  • Reviewer: Pavel Yaskevich

For `CTP_Initialization`, there's no contextual
type to record if the pattern is not a
`TypedPattern`. As such, tweak
`RequirementFailure::getDeclRef` to handle this
case.

We probably ought to reconsider how we handle
contextual types here, using a ContextualType
locator when there is no contextual type recorded
seems a bit weird, though in most cases we want
to treat initializations the same regardless of
if a TypedPattern was used. For now I'm leaving
that as future work.

rdar://111009224
@hamishknight hamishknight requested a review from a team as a code owner June 20, 2023 17:04
@hamishknight
Copy link
Contributor Author

@swift-ci please test

@hamishknight hamishknight merged commit b0dd6f8 into swiftlang:release/5.9 Jun 20, 2023
@hamishknight hamishknight deleted the out-of-context-5.9 branch June 20, 2023 21:58
@hamishknight hamishknight added 🍒 release cherry pick Flag: Release branch cherry picks swift 5.9 labels Jun 21, 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.9
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants