[SR-12430] self in Property Wrapper Using Enclosing Self Escapes Before Initialization Completed #54869
Labels
accepts invalid
Bug: Accepts invalid
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
property wrappers
Feature: property wrappers
Attachment: Download
Environment
macOS 10.15.4/Xcode 10.4
Also reproduces from trunk build at 3b3eade
Additional Detail from JIRA
md5: b9f06e7a94b959281ac36fd796a2e6c3
duplicates:
Issue Description:
In the attached sample code,
self
can be used to access uninitialized memory.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()
:The Swift compiler should diagnose this scenario and emit an error diagnostic.
The text was updated successfully, but these errors were encountered: