为什么从 Xcode 10 的 Enum 得到错误的 hashValue?是苹果的bug吗?

Why get wrong hashValue from Enum from Xcode 10? Is it Apple's bug?

更新:

我遇到这个问题是因为我使用 hashValue 获取枚举计数作为 Antonio 的 suggestion in this question

还有,Antonio的answer在Xcode10之前效果很好,我只想知道为什么现在结果变了。


原问题

环境: macOS 10.14.1

同一个枚举,Xcode10.1return枚举项的hashValue为4607296766572878277,Xcode9.4.1returns 0:

代码:

enum IntEnum: Int {
    case first = 1, second
}

let x = IntEnum.first.hashValue

print("first hashValue \(x)")

enum strEnum: String {
    case first, second
}

let a = strEnum.first.hashValue

Xcode 10.1:

Xcode 9.4.1:

这是苹果的bug吗?

感谢大家的回答。正如 rmaddy 所说 document 如下:

因此在以后的执行过程中不要使用 hashValue。