Skip to content

Fix LifetimeDependence type inference for setters. #81270

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 3, 2025

Conversation

atrick
Copy link
Contributor

@atrick atrick commented May 3, 2025

A setter on a non-Escapable type may have a dependency on both it's incoming
'self' and 'newValue'. If the 'newValue' dependency does not match the getter's
dependency, then lifetime diagnostics will not accept the generated '_modify'
accessor:

error: lifetime-dependent value returned by generated accessor '_modify'

To fix this, make sure that we don't (conservatively) infer a borrow
dependency on 'newValue'.

Fixes rdar://150444400

A setter on a non-Escapable type may have a dependency on both it's incoming
'self' and 'newValue'. If the 'newValue' dependency does not match the getter's
dependency, then lifetime diagnostics will not accept the generated '_modify'
accessor:

error: lifetime-dependent value returned by generated accessor '_modify'

To fix this, make sure that we don't (conservatively) infer a borrow
dependency on 'newValue'.

Fixes rdar://150444400
@atrick
Copy link
Contributor Author

atrick commented May 3, 2025

@swift-ci test

@atrick atrick enabled auto-merge May 3, 2025 07:17
@atrick atrick merged commit d033eec into swiftlang:main May 3, 2025
4 of 5 checks passed
@atrick atrick deleted the rdar150403948-lifedep-walker-recurse branch May 4, 2025 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant