Skip to content

[swift-4.0-branch][stdlib] Add a Swift 4 only RangeRepleaceable.filter returning Self #9750

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 2 commits into from
May 19, 2017

Conversation

moiseev
Copy link
Contributor

@moiseev moiseev commented May 18, 2017

  • Explanation: This overload allows String.filter to return a String, and not
    [Character]. (Partial implementation of https://github.com/apple/swift-evolution/blob/master/proposals/0174-filter-range-replaceable.md
  • Scope of Issue: Introduces the new overload in Swift 4 mode only. Tests make sure that the behavior for Swift 3 remains the same.
  • Risk: Minimal
  • Reviewed By: Ben Cohen
  • Testing: Automated test suite + special test cases
  • Directions for QA: N/A
  • Radar: rdar://problem/32284321 [swift-4.0-branch]

Max Moiseev added 2 commits May 18, 2017 16:20
This overload allows `String.filter` to return a `String`, and not
`[Character]`.

In the other hand, introduction of this overload makes `[123].filter`
somewhat ambiguous in a sence, that the compiler will now prefer an
implementatin from a more concrete protocol, which is less efficient for
arrays, therefore extra work is needed to make sure Array types fallback
to the `Sequence.filter`.

Implements: <rdar://problem/32209927>
@moiseev moiseev requested a review from airspeedswift May 18, 2017 23:24
@moiseev
Copy link
Contributor Author

moiseev commented May 18, 2017

@swift-ci Please test

@moiseev
Copy link
Contributor Author

moiseev commented May 18, 2017

Similar to #9741 and #9748

@tkremenek
Copy link
Member

@swift-ci test source compatibility

@tkremenek tkremenek merged commit c65e3ca into swiftlang:swift-4.0-branch May 19, 2017
@moiseev moiseev deleted the rrc-filter-4 branch May 22, 2017 17:04
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.

3 participants