[SR-7368] Bugs of self-referencing Default Property Values in subclasses #49916
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
diagnostics QoI
Bug: Diagnostics Quality of Implementation
duplicate
Resolution: Duplicates another issue
expressions
Feature: expressions
identifiers
Feature: Identifiers
missing warning
Bug: Missing warning
self
Feature → expressions: The 'self' expression
swift 5.6
type checker
Area → compiler: Semantic analysis
Attachment: Download
Environment
Xcode 9.3
Additional Detail from JIRA
md5: 0da77bdeedb7ef554ed87067dd965c4e
duplicates:
Issue Description:
If I understand it correctly, self-reference should not be allowed in Default Property Values. Actually such properties should not support initialization-directly-to-final-value at all and must be
var
instead oflet
because:Stored properties must be initialized before
super.init
,But
self
cannot be used beforesuper.init
.However currently this code compiles:
but it doesn't really work:
tapGR
is not really connected toself
, as we can seetapGR.target
is null andhandleTap
will never be called.The text was updated successfully, but these errors were encountered: