Swift: Instances conformed to 'Comparable' are required to implement 'less than', but it's not declared in protocol signature

Originator:d2.lebedev
Number:rdar://17307999 Date Originated:14/06/2014
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 6.0 (6A215l)
Classification:Bug Reproducible:Always
 
Summary:

class Sample : Comparable {
    
}

func ==(lhs: Sample, rhs: Sample) -> Bool {
    return false
}

func <=(lhs: Sample, rhs: Sample) -> Bool {
    return false
}
func >=(lhs: Sample, rhs: Sample) -> Bool {
    return false
}
func >(lhs: Sample, rhs: Sample) -> Bool {
    return false
}

Steps to Reproduce:
1. Compile provided Sample class which conforms to Comparable

Expected Results:
Successful compilation. 'less than' method is inferred from 'greater than' as it's inverse

Actual Results:
Compiler error: 'Sample' does not conform to "Comparable"

Version:
OSX 10.9.4
Xcode 6.0 (6A215l)

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!