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-4005] elementsEqual should allow heterogenous comparisons #46590

Closed
airspeedswift opened this issue Feb 19, 2017 · 5 comments
Closed

[SR-4005] elementsEqual should allow heterogenous comparisons #46590

airspeedswift opened this issue Feb 19, 2017 · 5 comments
Assignees
Labels
affects ABI Flag: Affects ABI bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. good first issue Good for newcomers standard library Area: Standard library umbrella

Comments

@airspeedswift
Copy link
Member

Previous ID SR-4005
Radar rdar://problem/17590938
Original Reporter @airspeedswift
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Bug, AffectsABI, StarterBug
Assignee @Cbieniak
Priority Medium

md5: 05dd3b208bbe9991fa5d1d5e7d99ead7

Issue Description:

The version of elementsEqual in the Swift standard library that allows the caller to supply a predicate for comparing the elements of two sequences requires that the elements of the two sequences be the same. However, if the user is supplying a predicate to make the comparison, this should not be necessary.

@Cbieniak
Copy link
Contributor

@airspeedswift
hey mate
I've made some progress with this issue but have hit a wall and was hoping for some advice
It was easy enough to remove the requirement for sequences element to match otherSequences element but update the equitable closure has proven more of an issue.
``` public func elementsEqual<OtherSequence>(
_ other: OtherSequence${"," if preds else ""}
% if preds:
by areEquivalent: (${GElement}, OtherSequence.${GElement}) throws -> Bool
% end
) ${rethrows_}-> Bool
where
OtherSequence: Sequence
```

this code causes a linker error I believe because we are accessing the otherSequences Iterator.element before the where clause had ensured its a sequence. Does that sound correct?

Commit here Cbieniak@3e11d46
please ignore the hacky if below its a WIP.

@Cbieniak
Copy link
Contributor

Cbieniak commented Mar 6, 2017

Ignore above comment, ive found the issue and sorted it

@natecook1000
Copy link
Member

This should presumable apply to the predicate version of startsWith, as well—would we also want heterogenous comparison for lexicographicallyPrecedes? Trying to think of how that would make sense…

@Cbieniak
Copy link
Contributor

#8045 PR is Here

@natecook1000 Happy to take a shot at both of those, if they don't need to go through another round of swift evo discussion

@xwu
Copy link
Collaborator

xwu commented Feb 23, 2018

Looks like this is done as of a long time ago. Closing.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects ABI Flag: Affects ABI bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. good first issue Good for newcomers standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

4 participants