Swift protocol extension with initializer doesn't compile in extension of struct

Originator:keithbsmiley
Number:rdar://23376350 Date Originated:03-Nov-2015 09:49 AM
Status:Resolved Resolved:Xcode 9 beta 5
Product:Developer Tools Product Version:Swift 2.1
Classification:Other Bug Reproducible:Always
 
Summary:

Protocols that define an initializer with an argument, that is then
declared in a protocol extension, and then implemented in the extension
of a struct, causes the program to not compile.

Steps to reproduce:

1. Create a protocol with an initializer
2. Implement the initializer in a protocol extension
3. Create an empty struct
4. Conform to the protocol in an extension on that struct
5. Call the initializer

OR

1. Open the attached playground

Expected results:

Everything compiles correctly

Actual results:

A compiler error is produced:

```
'(string: String) -> Bar' is not convertible to '(string: String) -> Bar?'
```

Notes:

- If you make the struct conform to the protocol in the definition ( not
  in an extension) it works

Comments

https://github.com/keith/radars/tree/master/ProtocolExtensionInitializerBug

By keithbsmiley at Nov. 3, 2015, 5:50 p.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!