Skip to content

Sema: Property wrapper storage wrappers ($foo) inherit 'final' bit from original property [5.2] #30750

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

Conversation

slavapestov
Copy link
Contributor

Otherwise, we would generate inconsistent vtable layouts for classes
with static properties that have attached wrappers. The reason is that
we normally force synthesis of the backing storage and storage wrapper
for each instance property wrapper as part of computing the lowered
stored properties.

However, there was no such forcing for static properties. But since a
static stored property (with an attached wrapper or otherwise) must be
'final', the real fix is to just ensure that the 'final' bit propagates
to the storage wrapper as well.

The backing storage property was already always final, so the issue
did not arise there.

Fixes rdar://problem/59522703, https://bugs.swift.org/browse/SR-12429.

@slavapestov slavapestov requested a review from a team as a code owner April 1, 2020 16:18
@slavapestov
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

swift-ci commented Apr 1, 2020

Build failed
Swift Test OS X Platform
Git Sha - 9f4328a3d066c43055bd1e63df8092843b0dea3f

@swift-ci
Copy link
Contributor

swift-ci commented Apr 1, 2020

Build failed
Swift Test Linux Platform
Git Sha - 9f4328a3d066c43055bd1e63df8092843b0dea3f

…om original property

Otherwise, we would generate inconsistent vtable layouts for classes
with static properties that have attached wrappers. The reason is that
we normally force synthesis of the backing storage and storage wrapper
for each instance property wrapper as part of computing the lowered
stored properties.

However, there was no such forcing for static properties. But since a
static stored property (with an attached wrapper or otherwise) must be
'final', the real fix is to just ensure that the 'final' bit propagates
to the storage wrapper as well.

The backing storage property was already always final, so the issue
did not arise there.

Fixes <rdar://problem/59522703>, <https://bugs.swift.org/browse/SR-12429>.
@slavapestov slavapestov force-pushed the final-static-property-wrapper-fix-5.2 branch from 9f4328a to de53a64 Compare April 1, 2020 20:23
@slavapestov
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

swift-ci commented Apr 1, 2020

Build failed
Swift Test Linux Platform
Git Sha - 9f4328a3d066c43055bd1e63df8092843b0dea3f

@swift-ci
Copy link
Contributor

swift-ci commented Apr 1, 2020

Build failed
Swift Test OS X Platform
Git Sha - 9f4328a3d066c43055bd1e63df8092843b0dea3f

@tkremenek
Copy link
Member

@swift-ci clean test

@najacque najacque merged commit 0f2b0f6 into swiftlang:swift-5.2-branch Apr 3, 2020
@AnthonyLatsis AnthonyLatsis added swift 5.2 🍒 release cherry pick Flag: Release branch cherry picks labels Jan 8, 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants