File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
stdlib/public/Synchronization/Atomics
test/stdlib/Synchronization/Atomics Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -191,7 +191,11 @@ extension WordPair: Comparable {
191191 @_alwaysEmitIntoClient
192192 @_transparent
193193 public func < ( lhs: WordPair , rhs: WordPair ) -> Bool {
194- lhs. first < rhs. first || lhs. second < rhs. second
194+ if lhs. first != rhs. first {
195+ return lhs. first < rhs. first
196+ } else {
197+ return lhs. second < rhs. second
198+ }
195199 }
196200}
197201
Original file line number Diff line number Diff line change @@ -50,11 +50,15 @@ suite.test("basics") {
5050 let c1 = WordPair ( first: 1 , second: 0 )
5151 let c2 = WordPair ( first: 2 , second: 0 )
5252 let c3 = WordPair ( first: 0 , second: 1 )
53+ let c4 = WordPair ( first: 1 , second: 2 )
54+ let c5 = WordPair ( first: 2 , second: 1 )
5355 expectFalse ( c0 < c0)
5456 expectTrue ( c0 < c1)
5557 expectTrue ( c0 < c2)
5658 expectTrue ( c0 < c3)
5759 expectFalse ( c1 < c0)
60+ expectTrue ( c4 < c5)
61+ expectFalse ( c5 < c4)
5862}
5963
6064} // if #available(SwiftStdlib 6.0, *)
You can’t perform that action at this time.
0 commit comments