1 post found
In Swift, a Data slice keeps the indices of the original buffer. After dropFirst, prefix(upTo:) or a range subscript, data[0] is out of bounds and crashes. Here's why Data is its own SubSequence, why tests built from fresh Data never catch it, and how to write byte parsers that work on any slice.