Swift version 2.2-dev (LLVM 3ebdbb2c7e, Clang f66c5bb67b, Swift 42591f7cba)
Apple Swift version 2.1.1 (swiftlang-700.1.101.15 clang-700.1.81)
A StackOverflow question pointed out that there is a problem with Self-requirement in protocols that can lead to wrong results or crashes. Consider this example from the question:
The problem here is that SuperMario.getFriend always returns a new instance of SuperMario which is correct at that point.
But when FireFlowerMario derived from SuperMario it inherited the implementation of getFriend that returns a SuperMario instance! The compiler treats the instance as a FireFlowerMario instead and tries to access the nonexistent fireballCount. This either leads to garbage output or crashes.
The compiler should be able to detect that SuperMario.getFriend does not behave as expected when subclassing and issue a warning about this.