No, it should not be rejected. You're shadowing ==
with an unrelated static function that shares the same name, not changing the conformance of Double
to Equatable
. Swift doesn't offer you any way to make 0.0
equivalent to 1.0
:
extension Double {
static func == (lhs: Self, rhs: Self) -> Bool { true }
}
func areEqual<T: Equatable>(_ a: T, _ b: T) -> Bool { a == b }
areEqual(0.0, 1.0) // false