Swift 2b6: Mutually recursive protocols have a really bad error message

Originator:rix.rob
Number:rdar://22419981 Date Originated:25-Aug-2015 12:16 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode-beta (7A192o)
Classification:Other Bug Reproducible:Always
 
Summary:
Provide a descriptive summary of the issue.

Steps to Reproduce:
This code:
protocol A {
	typealias O : B
}
protocol B {
	typealias O : A
}


Expected Results:
should result in an unambiguous, easy-to-understand, and resolvable error message (or actually it should compile but that’s fodder for a different radar)


Actual Results:
but instead, you get this:
boom.swift:5:12: error: type may not reference itself as a requirement
        typealias O : A
                  ^


Regression:
It used to crash (rdar://problem/22064783), so this is much better.


Notes:
This error message is misleading (to say the least), because the type does _not_ reference itself as a requirement; it references another protocol as a requirement which references it (the first one) as a requirement. It’s still cyclic either way, but the direct/indirect distinction is significant to the programmer.

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!