With:
protocol HashValue {
func hashValue() -> Int
}
extension HashValue where Self: Optional<Hashable> {
func hashValue() -> Int {
guard let self = self else {
return 1
}
return hashValue
}
}I get a compiler crash, Xcode 7b4, with the error message:
<unknown>:0: error: type 'Self' constrained to non-protocol type 'Optional<Hashable>'Which obviously is a compiler bug, compilers should crash! However:
- Where do you report crashes? Xcode doesn't seem to have a crash reporting feature!
- Should the code compile? `extension HashValue where Self == Optional<Hashable>` doesn't!
- Is there a way of doing an extension constrained to an optional?