[6.2] LifetimeDependence type check: infer trivial _read accessor #82269
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
(cherry picked from commit 125a086)
--- CCC ---
Explanation: This fixes a small oversight in the type checker's LifetimeDependence inference. Allow inference on _read accessors even when 'self' is a trivial type. This is needed because the compiler synthesizes a _read accessor even when the user defines a getter (this is probably a mistake, but it's easire to just fix inference at this point). There is no workaround because it defining both a getter and '_read' is illegal! Allows:
Scope: Only affects users of the supported experiment Lifetimes feature.
Radar/SR Issue: rdar://153346478 (Can't compile the UnsafeMutableRawBufferPointer.mutableBytes property)
main PR: #82268
Risk: Low
Testing: Added unit tests
Reviewer: Meghana Gupta