Skip to content

[6.2] Fix LifetimeDependence type inference for setters. #81271

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

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

(cherry picked from commit 88bbc18)

main PR: #81270

@atrick atrick requested a review from a team as a code owner May 3, 2025 07:09
@atrick atrick added 🍒 release cherry pick Flag: Release branch cherry picks swift 6.2 labels May 3, 2025
@atrick atrick requested a review from tbkka May 3, 2025 07:17
@atrick
Copy link
Contributor Author

atrick commented May 3, 2025

@swift-ci test

@atrick atrick enabled auto-merge May 3, 2025 07:17
atrick added 2 commits May 5, 2025 10:22
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

(cherry picked from commit 88bbc18)
@atrick atrick force-pushed the 62-rdar150403948-lifedep-walker-recurse branch from 73991d7 to cd343df Compare May 5, 2025 17:23
@atrick
Copy link
Contributor Author

atrick commented May 5, 2025

@swift-ci test

@atrick
Copy link
Contributor Author

atrick commented May 5, 2025

@swift-ci test macOS

@atrick
Copy link
Contributor Author

atrick commented May 6, 2025

Blocked on the continually failing Concurrency/Reflection/reflect_task.swift

@atrick
Copy link
Contributor Author

atrick commented May 6, 2025

@swift-ci test macOS

@atrick atrick merged commit 6bbd19a into swiftlang:release/6.2 May 6, 2025
5 checks passed
@atrick atrick deleted the 62-rdar150403948-lifedep-walker-recurse branch May 6, 2025 16:09
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 6.2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants