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-11430] NSNumber boxed in AnyHashable comparison behavior differs on macOS and Linux #3288

Open
Frizlab opened this issue Sep 6, 2019 · 0 comments

Comments

@Frizlab
Copy link
Contributor

Frizlab commented Sep 6, 2019

Previous ID SR-11430
Radar None
Original Reporter @Frizlab
Type Bug
Environment

macOS:
Apple Swift version 5.0.1 (swiftlang-1001.0.82.4 clang-1001.0.46.5)
Target: x86_64-apple-darwin18.7.0

Linux:
Swift version 5.0.3 (swift-5.0.3-RELEASE)
Target: x86_64-unknown-linux-gnu

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

md5: 55c09c1855ce9e6643cbd9ab1f414b26

Issue Description:

Snippet:

import Foundation
let a = NSNumber(0)
let b = NSNumber(false)
let c = (a == b)
let d = (AnyHashable(a) == AnyHashable(b))

On macOS we get c = true, d = false.
On Linux we get c = true, d = true.

I don’t know who is right.
It feels to me (a == b) (and it’s AnyHashable variant) should both be false because the numbers were not created with the same type.

@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

1 participant