-
Notifications
You must be signed in to change notification settings - Fork 1.2k
SR-10689: Fix bugs of DataProtocol's firstRange(of:in:)/lastRange(of:in:). #2499
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
Conversation
@swift-ci test |
Rebased to resolve conflicts. |
@swift-ci test |
The failures seem to be unrelated to this PR, don't they...? |
@swift-ci test |
1 similar comment
@swift-ci test |
Thank you for running tests. The error on macOS seems to be unrelated. |
@swift-ci test |
The failure on Linux seems to be caused by LLDB... |
I believe this is not stale... so rebased. |
@swift-ci test |
@spevans Thank you for rerunning tests. The error seems to be unrelated. /home/buildnode/jenkins/workspace/swift-corelibs-foundation-PR-Linux/swift/validation-test/StdlibUnittest/RaceTest.swift:116:11: error: CHECK: expected string not found in input |
@swift-ci test linux |
@spevans Thank you again. At last tests have passed. |
…f:in:) to fix SR-10689. Cherry-pick from swiftlang/swift-corelibs-foundation#2499
Finally PR for SDK Overlay (swift#28639) has been merged. |
I've just discovered that the previous implementation also had bugs in the returned length of the range. Here is a case that returns shorter range than the given input in Xcode 11.6 (11E708):
|
@juozasvalancius |
No conflicts even after the base branch was changed from |
This comment has been minimized.
This comment has been minimized.
Confirmation
@millenomi Could you review this PR (and/or #2993) at your convenience? |
@swift-ci test |
@CodaFi |
I would like sign offs from some core maintainers here. |
Done. |
@millenomi Thank you for your approval. |
DataProtocol
'sfirstRange(of:in:)
andlastRange(of:in:)
return a wrong value or crash under some conditions because they handle indices incorrectly.This PR fixes the issue.
Resolves SR-10689.
Note:
SR-10689 also says "
lastRange(of:)
returnsfirstRange(of:in:)
", however, it has been already fixed by #2310.