[SR-14665] Synthesised Equatable may be incorrect for manually implemented Comparable #57016
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler itself
derived conformances
Feature → protocol → conformances: derived conformances aka synthesized conformances
Additional Detail from JIRA
md5: 7c4663ac0f4ead1b689e43c0ea8393a3
relates to:
Issue Description:
Currently
Comparable
inherits fromEquatable
, but does not provide a default implementation for==
, so the compiler synthesizes one composed of member-wise==
s. This leads to a problem where if a type's<
is not composed of member-wise inequalities, then<
,>
, and==
can all evaluate tofalse
for some pairs of values, contradictingComparable
's documentation:For example:
Forums discussion: https://forums.swift.org/t/add-default-implementation-of-to-comparable/48832
The text was updated successfully, but these errors were encountered: