mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
When deriving the `hash(into:)` and `==` witnesses for `Hashable`/`Equatable` enums, call `_diagnoseUnavailableCodeReached()` in the case bodies for unavailable enum elements. This is needed because the previously derived code would operate on the values associated with unavailable enum elements, which is illegal if the types of those associated values are also unavailable (these case bodies would have failed typechecking had they been hand-written). The new structure also more explicitly documents that reaching these cases is unexpected, since unavailable enum elements should not be instantiated at run time.