Ah, one should never post to a mailing list before a morning coffee! The reason for the essentially undefined behaviour is that `Hashable` conformance must guarantee that two instances have the same `hashValue` if they are `==`, **but not vice versa**! In other words, the equality in the code snippet should've been implemented along the lines of:

    static func == (lhs: X, rhs: X) -> Bool {
        return lhs.hashValue == rhs.hashValue && lhs.x == rhs.x
    }

Now, where is that coffee?

milos
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to