From c27b2bff1f52503a9748e90fda7ee77242537492 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=86=80=E5=8D=93=E7=96=8C?= <55120045+WowbaggersLiquidLunch@users.noreply.github.com> Date: Sat, 4 Jun 2022 14:15:41 +0800 Subject: [PATCH] add a comment referring to the SR-14665 Reference to [SR-14665](https://github.com/apple/swift/issues/57016) links to more explanation on why the manual `==` implemenatation is necessary. --- .../SymbolGraph/SemanticVersion/SemanticVersion+Comparable.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Sources/SymbolKit/SymbolGraph/SemanticVersion/SemanticVersion+Comparable.swift b/Sources/SymbolKit/SymbolGraph/SemanticVersion/SemanticVersion+Comparable.swift index e3492ea..3febe55 100644 --- a/Sources/SymbolKit/SymbolGraph/SemanticVersion/SemanticVersion+Comparable.swift +++ b/Sources/SymbolKit/SymbolGraph/SemanticVersion/SemanticVersion+Comparable.swift @@ -10,6 +10,7 @@ extension SymbolGraph.SemanticVersion: Comparable { // Although `Comparable` inherits from `Equatable`, it does not provide a new default implementation of `==`, but instead uses `Equatable`'s default synthesised implementation. The compiler-synthesised `==`` is composed of [member-wise comparisons](https://github.com/apple/swift-evolution/blob/main/proposals/0185-synthesize-equatable-hashable.md#implementation-details), which leads to a false `false` when 2 semantic versions differ by only their build metadata identifiers, contradicting SemVer 2.0.0's [comparison rules](https://semver.org/#spec-item-10). + // [SR-14665](https://github.com/apple/swift/issues/57016) /// Returns a Boolean value indicating whether two semantic versions are equal. /// - Parameters: /// - lhs: A semantic version to compare.