[Swift] Allow constrained extensions on concrete types to satisfy protocols
| Originator: | info | ||
| Number: | rdar://23616223 | Date Originated: | 19-Nov-2015 11:54 AM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Swift 2.1 |
| Classification: | Feature (New) | Reproducible: | Always |
This is a duplicate of rdar://21507148
Summary:
Concrete types with generic parameters like 'Array' can be extended using extensions, and in Xcode beta 2 those extensions can be further constrained on their generic parameters. However, trying to declare that such an extension satisfies a protocol results in the error "Extension of type 'TypeName' with constraints cannot have an inheritance clause".
It would be nice to enhance this feature to allow conditional satisfaction of protocols, which would make the above scenario possible.
Steps to Reproduce:
1. Try to compile the following code:
protocol FooType { }
extension Array : FooType where T : Equatable { }
2. Note the error produced.
Expected Results:
Desired results: code compiles.
Actual Results:
(Also currently expected results, since this is a feature request/enhancement): Code does not compile, produces error described in description.
Configuration:
Xcode version 7.0 beta (7A121I), OS X 10.10.3
Comments
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!