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-7497] KeyPath hash collision #50040

Closed
dmcyk opened this issue Apr 22, 2018 · 5 comments
Closed

[SR-7497] KeyPath hash collision #50040

dmcyk opened this issue Apr 22, 2018 · 5 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. standard library Area: Standard library umbrella

Comments

@dmcyk
Copy link
Contributor

dmcyk commented Apr 22, 2018

Previous ID SR-7497
Radar None
Original Reporter @dmcyk
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Standard Library
Labels Bug
Assignee @dmcyk
Priority Medium

md5: 26f9fe26680ec6e01f701a56a1f24655

Issue Description:

struct SomeData {

    var one: Int
    var two: Int
}

print((\SomeData.one).hashValue == (\SomeData.two).hashValue)

In Xcode 9.3 this will print `false`, but in latest Swift snapshot from April 21, 2018 this prints `true`.
It seems like all KeyPaths return same `hashValue` now? It also happens between distinct top level types:

struct Nested {

    let inner: Int
    let innerTwo: Int
}
struct SomeData {

    var one: Int
    var two: Int
}

print((\SomeData.one).hashValue == (\SomeData.two).hashValue)
print((\SomeData.one).hashValue == (\Nested.inner).hashValue)

This will print `true` twice

@AnnaZaks
Copy link
Mannequin

AnnaZaks mannequin commented Apr 26, 2018

cc @jckarter

@dmcyk
Copy link
Contributor Author

dmcyk commented Jun 23, 2018

hey @lorentey is this something you're working on? Mind if I give it a try otherwise?

@lorentey
Copy link
Member

Go right ahead! 🙂

@dmcyk
Copy link
Contributor Author

dmcyk commented Jun 24, 2018

@lorentey cool, on it 😃

@dmcyk
Copy link
Contributor Author

dmcyk commented Jun 25, 2018

Resolved in #17467

@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
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. standard library Area: Standard library umbrella
Projects
None yet
Development

No branches or pull requests

2 participants