Skip to content

Restore Data.Indices to be a CountableRange #1423

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions Foundation/Data.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1005,7 +1005,8 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
public typealias Base64DecodingOptions = NSData.Base64DecodingOptions

public typealias Index = Int
public typealias Indices = Range<Int>
// FIXME: switch back to Range once swift 5.0 branch has PR #13342
public typealias Indices = CountableRange<Int>

@_versioned internal var _backing : _DataStorage
@_versioned internal var _sliceRange: Range<Index>
Expand Down Expand Up @@ -1746,7 +1747,7 @@ public struct Data : ReferenceConvertible, Equatable, Hashable, RandomAccessColl
return i + 1
}

public var indices: Range<Int> {
public var indices: CountableRange<Int> {
@inline(__always)
get {
return startIndex..<endIndex
Expand Down