[SR-4736] Passing self to super.init before initialization is incorrectly allowed #47313
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
definite initialization
Environment
Xcode 8.3.2
Additional Detail from JIRA
md5: 03184d8a6cf438d233ec66793248256d
Issue Description:
The following code will crash when you instantiate (or in some cases use)
C
:The compiler is allowing
self
to be passed tosuper.init
, which should not be allowed.If this is changed to
init(s: AnyObject)
(using typeAnyObject
rather thanS
), the compiler will generate the correct error. It seems specific to aninit
that accepts a parameter of the class's own type.The text was updated successfully, but these errors were encountered: