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-13056] Equality of Void via AnyObject only checks for pointer equality #3979

Open
swift-ci opened this issue Jun 21, 2020 · 0 comments
Open

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-13056
Radar None
Original Reporter jaspa (JIRA User)
Type Bug

Attachment: Download

Environment

Apple Swift version 5.2.4 (swiftlang-1103.0.32.9 clang-1103.0.32.53)
Target: x86_64-apple-darwin19.5.0

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

md5: bdaa20b6bf7a6aef772d4ccd188017e9

Issue Description:

Compare this

import Foundation
let unit: () = ()
let unitAny = unit as Any
let unitObject1 = unit as AnyObject
let unitObject2 = unit as AnyObject
unit == unit                      // true
unitObject1.isEqual(unit)         // false
unitObject1.isEqual(unitObject1)  // true
unitObject1.isEqual(unitObject2)  // false

with

import Foundation
let num = 12345678987
let numAny = num as Any
let numObject1 = num as AnyObject
let numObject2 = num as AnyObject
num == num                      // true
numObject1.isEqual(num)         // true
numObject1.isEqual(numObject1)  // true
numObject1.isEqual(numObject2)  // true

I expect all expression in the first code block to be true analogous to the second code block.

@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