[SR-1927] Subsequences of String Views don’t behave correctly #44536
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
standard library
Area: Standard library umbrella
Environment
Swift 3.0 Preview 1
(included with Xcode 8S128d)
Additional Detail from JIRA
md5: 4cb067c1ef10d57d7423021666825754
duplicates:
Issue Description:
(from https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160627/022460.html, where I was told this is a bug)
String Views (UTF8, UTF16, UnicodeScalar, Character) conform to Collection. However, they do not all provide the correct expected behavior when working with subsequences.
There are two issues:
Using the same indices
The documentation of
Collection
has this requirement:which is not respected by
UTF16View
andCharacterView
. For example:Bounds checking
UTF8View
andUTF16View
allow subscripting with indices past the end of the subsequence.UnicodeScalar
returns an incorrect value when accessing an element past the end of the subsequence.The text was updated successfully, but these errors were encountered: