Integer types no longer conforming to Comparable?


(Carl Peto) #1

I'm probably being blind, but I can't find where Integer types now conform to Comparable since Swift 5.0? (I'm trying to update my minimal stdlib to be compatible with Swift 5.0.)

Sorry if a dumb question.


(Manolo van Ee) #2

Took me some digging, but the inheritance path is BinaryInteger: Strideable: Comparable.

Then I remembered swiftdoc.org can show the inheritance graph. Unfortunately the nightly build doesn't work, but it looks like nothing changed since 4.2:
https://swiftdoc.org/v4.2/type/int/hierarchy/

Edit: I guess you meant the actual implementation. This must be it: https://github.com/apple/swift/blob/1c9bb7268bb3776b8ea0cffe5c0e70fd22ccd1e3/stdlib/public/core/IntegerTypes.swift.gyb#L1218


(Carl Peto) #3

I actually just meant the inheritance, I was being dumb and couldn't see it. Thanks for helping out with an easy one. Closed. :slight_smile: