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-15700] Set.intersection returns wrong other element instead of self #3184

Open
swift-ci opened this issue Jan 7, 2022 · 3 comments
Open

Comments

@swift-ci
Copy link
Contributor

swift-ci commented Jan 7, 2022

Previous ID SR-15700
Radar None
Original Reporter racer1988 (JIRA User)
Type Bug

Attachment: Download

Environment

Xcode 13.2.1

swift-driver version: 1.26.21 Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
Target: x86_64-apple-macosx12.0

Additional Detail from JIRA
Votes 0
Component/s Foundation, Standard Library, swift
Labels Bug
Assignee None
Priority Medium

md5: 74ff9a9b4fa7fab1f518641db1695df7

Issue Description:

Due to apple/swift@4e0c6f9

executing myself.intersection(other) returns other elements instead of myself if other.count is smaller or same size.

This create a big issue in case the comparison is not done on the entire object but the hash is calculated only from specific parts of the object (see a playground attached for demonstration)

myself.intersection(other) should always return only elements from the myself Set and never from other (as it does now)

apple/swift@2e3e88c

Might solve the issue, but it's really unclear to me if this one was released or not.

@lorentey could you let me know if your change is fixing this issue and the scheduled release?

We tested in Xcode 13.2.1 with Swift 5.5.2 and the bug is still reproducible

CC matthiaskmt (JIRA User)

@swift-ci
Copy link
Contributor Author

swift-ci commented Jan 7, 2022

Comment by Marco Pappalardo (JIRA)

git tag --contains 2e3e88cab8a395e3c6122f173bea3f13861d54b6

returns

swift-DEVELOPMENT-SNAPSHOT-2021-11-10-a
swift-DEVELOPMENT-SNAPSHOT-2021-11-11-a
swift-DEVELOPMENT-SNAPSHOT-2021-11-12-a
swift-DEVELOPMENT-SNAPSHOT-2021-11-15-a
swift-DEVELOPMENT-SNAPSHOT-2021-11-19-a
swift-DEVELOPMENT-SNAPSHOT-2021-11-20-a
swift-DEVELOPMENT-SNAPSHOT-2021-12-02-a
swift-DEVELOPMENT-SNAPSHOT-2021-12-04-a
swift-DEVELOPMENT-SNAPSHOT-2021-12-06-a
swift-DEVELOPMENT-SNAPSHOT-2021-12-23-a
swift-DEVELOPMENT-SNAPSHOT-2022-01-06-a 

so it seems to me the change has not been released yet?

@swift-ci
Copy link
Contributor Author

swift-ci commented Apr 5, 2022

Comment by Marco Pappalardo (JIRA)

@belkadan I saw you parsing other tickets I opened.. so wanted to know how to up this.

@glessard
Copy link
Contributor

glessard commented Apr 5, 2022

The commit you're looking for is part of the Swift 5.6 release.

Can you reproduce this issue with Xcode 13.3?

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

No branches or pull requests

2 participants