error: type 'Hashable' does not conform to protocol 'Equatable'
| Originator: | gwendal.roue | ||
| Number: | rdar://17229707 | Date Originated: | 2014/06/09 |
| Status: | Open | Resolved: | |
| Product: | Xcode | Product Version: | 6.0 (6A215l) |
| Classification: | Reproducible: |
Summary:
Swift compiler emits "error: type 'Hashable' does not conform to protocol 'Equatable'" error messages despite Hashable being explicitly defined as conforming to Equatable.
Steps to Reproduce:
Compile the following code:
class Foo<T:Hashable> { }
protocol Bar: Hashable { }
var a:Foo<Bar>?
var b:Foo<Hashable>?
Expected Results:
The code compiles without error
Actual Results:
The code does not compile, with the following error:
error: type 'Hashable' does not conform to protocol 'Equatable'
var b:Foo<Hashable>?
^
Swift.Equatable:2:8: note: '==' requirement refers to 'Self' type
func ==(lhs: Self, rhs: Self) -> Bool
^
Swift.Hashable:1:10: note: type 'Hashable' does not conform to inherited protocol 'Equatable.Protocol'
protocol Hashable : Equatable
Version:
Xcode Version 6.0 (6A215l)
OSX Version 10.9.3 (13D65)
Notes:
I first noticed this bug when declaring a variable of the Dictionary type:
var d: Dictionary<Hashable, String> // does not compile
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!