Use where clause to constrain types in a protocol
| Originator: | danielctull | ||
| Number: | rdar://21441502 | Date Originated: | 18-Jun-2015 04:17 PM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode 7.0 / Swift 2 |
| Classification: | Feature (New) | Reproducible: | Always |
This is a duplicate of rdar://17203060
It would be really useful to have the ability to define a where clause on typealiases in a protocol.
I would like to be able to have a setup something like the following:
protocol DataSource {
typealias ObjectType
}
protocol ParentDataSource: DataSource {
type alias ChildDataSource: DataSource where ChildDataSource.ObjectType == Self.ObjectType
}
Such that you could have a tree of data sources, that you could constrain to contain the same object type.
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!