Skip to content

[5.7][stdlib] Fix handling of duplicate items in generic Set.intersection #59422

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

Conversation

lorentey
Copy link
Member

(cherry picked from #59417)

  • Explanation: If the sequence passed to Set.intersection has exactly as many duplicate items as items missing from self, then the implementation that shipped in 5.6 mistakenly returns self unchanged. (It counts duplicate hits as distinct items in the result.)
  • Scope: Set.intersect overloads in the Swift Standard Library
  • Risk: Low due primarily to the limited scope.
  • Issue: rdar://94803458
  • Testing: This adds a new regression test case to the Swift test suite.
  • Reviewers: @rctcwyvrn, @stephentyrone

If the sequence passed to `Set.intersection` has exactly as many duplicate items as items missing from `self`, then the new implementation in 5.6 will mistakenly return `self` unchanged. (It counts duplicate hits as distinct items in the result.)

rdar://94803458
(cherry picked from commit 01d7b57)
@lorentey lorentey requested a review from a team as a code owner June 14, 2022 02:46
@lorentey
Copy link
Member Author

@swift-ci test

@lorentey lorentey merged commit e12b1b5 into swiftlang:release/5.7 Jun 14, 2022
@lorentey lorentey deleted the fix-generic-set-intersection-5.7 branch June 14, 2022 19:07
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