[swift-users] Equality is broken, isn't it?

Alexey Komnin interfere.work at gmail.com
Wed Jul 6 11:54:13 CDT 2016

Here is the code:

    let a: String = "abc"
    let b: NSString = "abc"

    assert(a == b)
    assert(a.hashValue == b.hashValue, "a.hashValue(\(a.hashValue)) !=

It fails with error:
    assertion failed: a.hashValue(4799450059707601744) != b.hashValue(516202353)

Perhaps, there is an issue with the equality operator.

Alexey Komnin.

More information about the swift-users mailing list