Skip to content

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

Merged
lorentey merged 1 commit intoswiftlang:release/5.7from
lorentey:fix-generic-set-intersection-5.7
Jun 14, 2022
Merged

[5.7][stdlib] Fix handling of duplicate items in generic Set.intersection#59422
lorentey merged 1 commit intoswiftlang:release/5.7from
lorentey:fix-generic-set-intersection-5.7

Conversation

@lorentey
Copy link
Copy Markdown
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
Copy Markdown
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