@@ -1704,7 +1704,29 @@ extension Collection {
1704
1704
1705
1705
1706
1706
extension Collection {
1707
- @available ( swift, deprecated: 4.1 , message: " all index disatnces are now of type Int " )
1707
+ @available ( swift, deprecated, message: " all index distances are now of type Int " )
1708
1708
public typealias IndexDistance = Int
1709
- }
1710
1709
1710
+ @available ( * , deprecated, message: " all index distances are now of type Int " )
1711
+ public func index< T: BinaryInteger > ( _ i: Index , offsetBy n: T ) -> Index {
1712
+ return index ( i, offsetBy: Int ( n) )
1713
+ }
1714
+ /* FIXME: crashes the compiler
1715
+ @available(*, deprecated, message: "all index distances are now of type Int")
1716
+ public func formIndex<T: BinaryInteger>(_ i: Index, offsetBy n: T) {
1717
+ return formIndex(i, offsetBy: Int(n))
1718
+ }
1719
+ @available(*, deprecated, message: "all index distances are now of type Int")
1720
+ public func index<T: BinaryInteger>(_ i: Index, offsetBy n: T, limitedBy limit: Index) -> Index {
1721
+ return index(i, offsetBy: Int(n), limitedBy: limit)
1722
+ }
1723
+ */
1724
+ @available ( * , deprecated, message: " all index distances are now of type Int " )
1725
+ public func formIndex< T: BinaryInteger > ( _ i: inout Index , offsetBy n: T , limitedBy limit: Index ) -> Bool {
1726
+ return formIndex ( & i, offsetBy: Int ( n) , limitedBy: limit)
1727
+ }
1728
+ @available ( * , deprecated, message: " all index distances are now of type Int " )
1729
+ public func distance< T: BinaryInteger > ( from start: Index , to end: Index ) -> T {
1730
+ return numericCast ( distance ( from: start, to: end) as Int )
1731
+ }
1732
+ }
0 commit comments