File tree Expand file tree Collapse file tree 2 files changed +767
-78
lines changed Expand file tree Collapse file tree 2 files changed +767
-78
lines changed Original file line number Diff line number Diff line change @@ -2165,8 +2165,14 @@ bool NominalTypeDecl::derivesProtocolConformance(ProtocolDecl *protocol) const {
2165
2165
// Hashable conformance.
2166
2166
case KnownProtocolKind::Equatable:
2167
2167
case KnownProtocolKind::Hashable:
2168
- return enumDecl->hasCases ()
2169
- && enumDecl->hasOnlyCasesWithoutAssociatedValues ();
2168
+ // FIXME: This is too lenient; we can only promise to provide a witness
2169
+ // for enums where all associated values conform to the protocol.
2170
+ // Unfortunately, figuring this out requires a TypeChecker and resolving
2171
+ // the argument type of each enum element. Instead, we let
2172
+ // DerivedConformance::derive{Equatable,Hashable} perform the full check
2173
+ // and it outputs its own diagnostics if conformance cannot be
2174
+ // synthesized.
2175
+ return enumDecl->hasCases ();
2170
2176
2171
2177
// @objc enums can explicitly derive their _BridgedNSError conformance.
2172
2178
case KnownProtocolKind::BridgedNSError:
You can’t perform that action at this time.
0 commit comments