We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Latest Xcode GM (9A235)
md5: a40e33dda90e14803763da1dfdb27b81
Issue Description:
When I use the range-based subscript on Data with a non-zero lowerbound, I consistently get a crash.
Example:
import Foundation let data = "hello".data(using: .utf8)! // 5 bytes data.subdata(in: 1..<3) // this works as expected data[1..<3] // this crashes
The subscript works fine when the lowerbound is zero.
The text was updated successfully, but these errors were encountered:
Comment by Chris Eidhof (JIRA)
Other methods are broken as well:
data.suffix(from: 1)
Sorry, something went wrong.
Ok, the plot thickens. It turns out this only happens in a playground. Probably a playground-quicklookable problem.
I'm pretty sure this line is the culprit:
https://github.com/apple/swift/blob/master/stdlib/public/SDK/Foundation/Data.swift#L1773
It should almost certainly use startIndex, not 0.
@phausler
No branches or pull requests
Environment
Latest Xcode GM (9A235)
Additional Detail from JIRA
md5: a40e33dda90e14803763da1dfdb27b81
Issue Description:
When I use the range-based subscript on Data with a non-zero lowerbound, I consistently get a crash.
Example:
The subscript works fine when the lowerbound is zero.
The text was updated successfully, but these errors were encountered: