[SR-4908] Protocol default init implementation not working for generic type #47485
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
regression
swift 4.0
type checker
Area → compiler: Semantic analysis
Attachment: Download
Environment
$ swift --version
:Apple Swift version 4.0-dev (LLVM f175cad503, Clang 51f7aba0dc, Swift 79b6334)
Target: x86_64-apple-macosx10.9
Toolchain: 4.0-DEVELOPMENT-SNAPSHOT-2017-05-15-a
Additional Detail from JIRA
md5: 9943bb86056cf89636b8a1dfd73dbcc1
relates to:
Issue Description:
In the following example, the default initializer implementation for
init(block: @escaping Block)
is not used and the call results in an error stating that an argument is missing:This is the output I get:
I've also attached the file with the sample code.
Here are a few observations I made while trying to narrow this down:
It works fine when using two normal
func
's instead of an initializer.As soon as I make the struct non-generic (also removing the associatedtype from the protocol), it seems to work.
The closure also seems to play its role in it. If I use the associated type directly (instead of the closure
Block
), it works fine. Together with the first point, this could hint at a problem with generics, but explicitly declaring the generic parameter (as withhandler2
) doesn't help.The text was updated successfully, but these errors were encountered: