You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
SR-6945 Error in struct init, saying 'self' used before assignment for the assignment itself
relates to:
SR-15669 Diagnostics for reinitialization of ‘let’ property due to initilizer delegation is misleading
Issue Description:
Currently, as long as there exists a delegation somewhere in an initializer, let properties are not allowed to be initialised directly, even if the delegation is unreachable.
structS{letx:Int}extensionS{init(a:Int){
guard true else{self.init(x: a)}
x = a // error: 'let' property ‘x’ may not be initialized directly; use "self.init(...)" or "self = ..." instead}}
This should be changed to be flow-sensitive, so it should be ok so long as every let property is initialized only once on each path.
The text was updated successfully, but these errors were encountered:
Environment
macOS 12.2 Beta (21D5025f)
2021-12-23 trunk snapshot
Additional Detail from JIRA
md5: 585be41f2a676f040b3b7a4a7d219034
duplicates:
relates to:
Issue Description:
Currently, as long as there exists a delegation somewhere in an initializer,
let
properties are not allowed to be initialised directly, even if the delegation is unreachable.This should be changed to be flow-sensitive, so it should be ok so long as every
let
property is initialized only once on each path.The text was updated successfully, but these errors were encountered: