-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Property Wrappers] Only re-write assign_by_wrapper to assignment if all fields have been initialized. #31248
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
@swift-ci please smoke test |
@swift-ci please test source compatibility |
1 similar comment
@swift-ci please test source compatibility |
// Only re-write assign_by_wrapper to assignment if all fields have been | ||
// initialized. | ||
if (isa<AssignByWrapperInst>(Use.Inst) && | ||
getAnyUninitializedMemberAtInst(Use.Inst, 0, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you still need the isFullyUninitialized check above? Unless I'm missing something, it seems like "property wrapper is uninitialized" would be a special case of "any field uninitialized".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That case is still needed for non-property-wrapped properties
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like we need to use assign_by_wrapper for everything then, but maybe not in this PR :-)
if all fields have been initialized.
6cb305c
to
3aabdb5
Compare
@swift-ci please smoke test |
Otherwise, the wrapped property's setter will be called with the potential to access uninitialized memory via observers.
Resolves: rdar://problem/60832285, rdar://problem/58312953
Resolves: SR-12341