-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[stdlib] Fix issue with UTF16 index(_:offsetBy:limitedBy) #12378
New issue
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
[stdlib] Fix issue with UTF16 index(_:offsetBy:limitedBy) #12378
Conversation
@swift-ci please test |
This seems to be fixing https://bugs.swift.org/browse/SR-4657. |
bc300aa
to
0a3ec5c
Compare
@swift-ci please test and merge |
@swift-ci please test |
Build failed |
Build failed |
} | ||
|
||
StringTraps.test("UTF16ViewIndex/offsetLimited") | ||
.code { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.code
is not necessary.
|
||
let iaBegin = u16a.index(sa.startIndex, offsetBy: 99, limitedBy: sa.endIndex) | ||
expectNil(iaBegin) | ||
let iaEnd = u16a.index(sa.endIndex, offsetBy: 99, limitedBy: sa.endIndex) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would also be interesting to test for non-positive offsets starting from an endIndex
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, good point!
@swift-ci test source compatibility |
When the string is empty, the code unit distance to the limit can be zero.
Manifests in this failing:
rdar://problem/34551055