Skip to content

Update algorithms methods to match proposal #330

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

Merged
merged 9 commits into from
Apr 24, 2022

Conversation

natecook1000
Copy link
Member

@natecook1000 natecook1000 commented Apr 23, 2022

  • Sequence/Collection constraints
  • @escaping/rethrows closures
  • split parameters
  • More exhaustive testing
  • Documentation comments Coming in a separate PR

@natecook1000 natecook1000 requested a review from itingliu April 23, 2022 00:23
This plumbs those parameters down into the SplitCollection type,
and removes Collection conformance for now because (a) we aren't
using it, and (b) it looks tricky to implement properly.
Better test coverage for both the regex and collection variants of
these two methods, plus overloads for contains(_:) to win over
Foundation's version from the overlay.

Also fixes an error in TwoWaySearcher that tried to offset past the
searched string's endIndex; might be a sign of something awry, but
tests seem to be otherwise succeeding.
@natecook1000 natecook1000 marked this pull request as ready for review April 24, 2022 06:18
@natecook1000
Copy link
Member Author

@swift-ci Please test

@natecook1000
Copy link
Member Author

@swift-ci Please test

@natecook1000 natecook1000 requested a review from milseman April 24, 2022 18:57
@natecook1000
Copy link
Member Author

@swift-ci Please test

Copy link
Contributor

@itingliu itingliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great!

public func contains(_ other: Substring) -> Bool {
firstRange(of: other) != nil
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to add these to the proposal?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so - we just need to make sure these are winning the overload resolution vs Foundation's overlay version. However we do that is just an implementation detail.

@natecook1000 natecook1000 merged commit 9e09bf8 into swiftlang:main Apr 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants