-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Closed
Labels
accepts invalidBug: Accepts invalidBug: Accepts invalidbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfproperty wrappersFeature: property wrappersFeature: property wrappers
Description
| Previous ID | SR-12430 |
| Radar | None |
| Original Reporter | briantkelley (JIRA User) |
| Type | Bug |
| Status | Closed |
| Resolution | Done |
Attachment: Download
Additional Detail from JIRA
| Votes | 0 |
| Component/s | Compiler |
| Labels | Bug, AcceptsInvalid, PropertyWrappers |
| Assignee | briantkelley (JIRA) |
| Priority | Medium |
md5: b9f06e7a94b959281ac36fd796a2e6c3
duplicates:
- SR-12341 @propertyWrapper wrong behaviour
Issue Description:
In the attached sample code, self can be used to access uninitialized memory.
init(value: String) {
self.value = value
}
@Notifying({ (p: Publisher, l: Listener) in l.propertyChanged(p) })
var value: String = ""Where @Notifying is a property wrapper that uses the static subscript to access the enclosing self.
As a work around, the user can explicitly insert super.init():
init(value: String) {
super.init()
self.value = value
}The Swift compiler should diagnose this scenario and emit an error diagnostic.
Metadata
Metadata
Assignees
Labels
accepts invalidBug: Accepts invalidBug: Accepts invalidbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfThe Swift compiler itselfproperty wrappersFeature: property wrappersFeature: property wrappers