[swift-users] Swift 4 protocol with associatedtype conforming to itself

Jens Persson jens at bitcycle.com
Wed Jun 7 00:37:37 CDT 2017


In Swift 4:

protocol P1 {
    associatedtype A: P1 // Error: Type may not reference itself as a
requirement
}
protocol P2 {
    associatedtype A where A: P2 // OK
}

What is the rationale behind this?

/Jens
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170607/e9861d65/attachment.html>


More information about the swift-users mailing list