[swift-users] TWISt-shout Newsletter 2018-01-15

2018-01-15 Thread Kenny Leung via swift-users
Hi All. Here is your TWISt-shout Newsletter for the week of 2018-01-08 to 2018-01-14 https://github.com/pepperdog/TWISt-shout/blob/master/2018/TWISt-shout-2018-01-15.md Enjoy! -Kenny

Re: [swift-users] Synthesized Equatable Bug?

2018-01-15 Thread Jon Shier via swift-users
Thanks Dmitri. Once I looked up the total ordering for points I was able to get proper behavior. static func < (lhs: Point, rhs: Point) -> Bool { return lhs.x < rhs.x || (lhs.x == rhs.x && lhs.y < rhs.y) } Jon > On Jan 15, 2018, at 8:38 PM, Dmitri Gribenko wrote: >

Re: [swift-users] Synthesized Equatable Bug?

2018-01-15 Thread Dmitri Gribenko via swift-users
On Mon, Jan 15, 2018 at 2:30 PM, Jon Shier via swift-users wrote: > This is pretty straightforward code, so am I missing something here? Your '<' function does not define a valid strict total order. For let p1 = Point(1, 1) let p2 = Point(0, 2) neither of 'p1 < p2', 'p2

[swift-users] Synthesized Equatable Bug?

2018-01-15 Thread Jon Shier via swift-users
Swifters: Take this simple Point type: struct Point: Hashable { let x: Int let y: Int init(_ x: Int, _ y: Int) { self.x = x self.y = y } } Using the latest Swift 4.1 snapshot, the Hashable conformance is generated for me. Adding Comparable conformance