mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
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
11 lines
305 B
Swift
11 lines
305 B
Swift
// Note that for the test to be effective, each of these enums must only have
|
|
// its Equatable or Hashable conformance referenced /once/ in the primary file.
|
|
enum FromOtherFile : String {
|
|
case A = "a"
|
|
}
|
|
enum AlsoFromOtherFile : Int {
|
|
case A = 0
|
|
}
|
|
enum YetAnotherFromOtherFile: Float {
|
|
case A = 0.0
|
|
} |