[SR-7009] Required Initializer of Generic Type unavailable in Protocol Extension #49557
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
type checker
Area → compiler: Semantic analysis
Attachment: Download
Environment
Swift 4.0, Xcode 9.2.0.
Additional Detail from JIRA
md5: 05857787b8520078ff71fba1bad937e2
duplicates:
Issue Description:
If I write a class
C
with a genericT
constrained toUIView
, then write an extension whereT
is further constrained to a protocolP
with a required initializer, I expect that I should be able to call that required initializer in that generic. However, Swift fails to find it, and offers meinit(frame:)
andrequired init(coder:)
fromUIView
instead.init(frame:)
shouldn't even be safe to call, sinceT
could be anyUIView
} subclass.Gives the following errors:
This also happens in a normal Xcode project.
I tried to repro this without UIKit, but I wasn't able to figure out what's special about UIView.
The text was updated successfully, but these errors were encountered: