why swift compiler behaves differently with equality operator with/without Equatable protocol
问题 I have a very simple class in a Playground in Swift 4.0 that overrides the == operator. I'm not understanding why the Swift complier doesn't behave the same when the class inherits/doesn't inherit Equatable protocol. Here the class when inheriting Equatable protocol class Test: Equatable { var value = 0 init(_ initialValue:Int) { value = initialValue } static func == (lhs:Test, rhs:Test) -> Bool { return lhs.value == rhs.value ? true : false } } let test1 = Test(0) var test4:Test? = nil if