Merge pull request #62859 from lorentey/mark-utf8-index-encoding

[stdlib] String.UTF8View.index(_:offsetBy:limitedBy:): mark encoding of result
This commit is contained in:
Karoy Lorentey
2023-01-05 13:57:25 -08:00
committed by GitHub

View File

@@ -191,7 +191,7 @@ extension String.UTF8View: BidirectionalCollection {
}
_precondition(result >= 0 && result <= _guts.count,
"String index is out of bounds")
return Index(_encodedOffset: result)
return Index(_encodedOffset: result)._knownUTF8
}
return _foreignIndex(i, offsetBy: n, limitedBy: limit)