Commit Graph

1 Commits

Author SHA1 Message Date
Jordan Rose
9418b9cfd4 [Type Checker] Try harder to synthesize enum Equatable conformance on demand.
If either parameter to == has a known concrete type at constraint generation
time, see if that type is a nominal that can derive its conformance to
Equatable. If so, do so, and then add that == to the overload set.
(It may already be there, but that's okay -- it will get uniqued later.)

This isn't perfect because it relies on one of the parameters to == having
a concrete type /before/ constraint solving. There are plenty of reasons
why that wouldn't happen. But this at least fixes the common case, and
breaking the expression up into multiple lines is a less distasteful
workaround than replacing (x == .Value) with !(x != .Value). I've added a
test case that should work but doesn't that we can revisit later.

rdar://problem/18073705

Swift SVN r21557
2014-08-29 01:10:06 +00:00