Skip to content

Commit 58ab3fe

Browse files
lorenteyAzoy
andcommitted
Apply suggestions from code review
Co-authored-by: Alejandro Alonso <[email protected]>
1 parent 3c99689 commit 58ab3fe

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

stdlib/public/core/StringCharacterView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ extension String: BidirectionalCollection {
313313
/// present!)
314314
///
315315
/// This method is called from inlinable `subscript` implementations in
316-
/// current and previous versions of the stdlib, wich require this contract
316+
/// current and previous versions of the stdlib, which require this contract
317317
/// not to be violated.
318318
@usableFromInline
319319
@inline(__always)

stdlib/public/core/StringUTF16View.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ extension String.UTF16View: BidirectionalCollection {
145145
"String index is out of bounds")
146146
if _slowPath(_guts.isForeign) { return _foreignIndex(after: idx) }
147147
if _guts.isASCII {
148-
return idx.nextEncoded._scalarAligned._knownUTF8._knownUTF16
148+
return idx.nextEncoded._scalarAligned._encodingIndependent
149149
}
150150

151151
// For a BMP scalar (1-3 UTF-8 code units), advance past it. For a non-BMP
@@ -173,7 +173,7 @@ extension String.UTF16View: BidirectionalCollection {
173173
"String index is out of bounds")
174174
if _slowPath(_guts.isForeign) { return _foreignIndex(before: idx) }
175175
if _guts.isASCII {
176-
return idx.priorEncoded._scalarAligned._knownUTF8._knownUTF16
176+
return idx.priorEncoded._scalarAligned._encodingIndependent
177177
}
178178

179179
if idx.transcodedOffset != 0 {
@@ -709,7 +709,7 @@ extension String.UTF16View {
709709
if _guts.isASCII {
710710
return Index(
711711
_encodedOffset: offset
712-
)._scalarAligned._knownUTF8._knownUTF16
712+
)._scalarAligned._encodingIndependent
713713
}
714714

715715
guard _guts._useBreadcrumbs(forEncodedOffset: offset) else {

0 commit comments

Comments
 (0)