When an actor satisfies a synchronous requirement (such as Hashable’s hash(into:) and hashValue), the witness must be nonisolated. This presents a problem for Hashable conformance:
Since Swift 4.2, the user implements either the Hasher-based hash(into:) or the deprecated hashValue, and the compiler synthesises the other that uses the user-implemented one (see the Source Compatibility section of SE-206). Because currently the synthesised code doesn’t have “nonisolated” keyword when the conforming type is an actor, the user is prompted with a warning that asks them to add “nonisolated” to the compiler-synthesised part. This results in the user having to implement both parts of the conformance. In addition to negating the benefits of having automatic Hashable synthesis, for someone not familiar with how hash(into:) and hashValue work together, it can lead to incorrect implementation.
The text was updated successfully, but these errors were encountered: