Skip to content
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

[SR-6523] libSwiftPM defines Collection.split() which behaves differently from split() in Swift Standard Library. #4849

Closed
norio-nomura opened this issue Dec 4, 2017 · 1 comment
Labels

Comments

@norio-nomura
Copy link
Contributor

Previous ID SR-6523
Radar None
Original Reporter @norio-nomura
Type Bug
Status Resolved
Resolution Done
Environment

https://github.com/apple/swift-package-manager/releases/tag/0.1.0

Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: 4ea1f4e52badbb08fa533a471fa945a5

Issue Description:

By importing libSwiftPM, the client can not build with "Ambiguous use of 'split'" error.
Defined in libSwiftPM are the following:

extension Collection {
    /// Splits into two arrays, first containing elements which matching the predicate
    /// and other containting elements not matching the predicate.
    ///
    /// - Parameter isMatching: The predicate to apply.
    /// - Returns: Tuple of split arrays.
    public func split(_ isMatching: (Iterator.Element) -> Bool) -> ([Iterator.Element], [Iterator.Element]) {
        var matchingElements: [Iterator.Element] = []
        var nonMatchingElements: [Iterator.Element] = []
        for element in self {
            if isMatching(element) {
                matchingElements.append(element)
            } else {
                nonMatchingElements.append(element)
            }
        }
        return (matchingElements, nonMatchingElements)
    }
}

I think that this should be changed to a different name.

@norio-nomura
Copy link
Contributor Author

opened #1407

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant