New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add conditional conformances of CircularBuffer to Equatable and Hashable #1101
Conversation
Can one of the admins verify this patch? |
8 similar comments
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
Can one of the admins verify this patch? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside from cleaning up the code, do you mind adding a few tests to verify that the equatable conformance works correctly?
I think we're still missing the tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, the patch itself looks really good! Can you squash and write a commit message with our commit message template, please?
6384d44
to
fee7195
Compare
@Lukasa Everything should now be ok! 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beautiful, this looks great, thanks @adtrevor!
@swift-nio-bot test this please |
Motivation: In general, Swift collections and sequences automatically conforms to Equatable and Hashable when their Element conforms to Equatable and Hashhable, respectively. This wasn't the case of CircularBuffer, which was unintuitive and could cause useless boilerplate code. Modifications: CircularBuffer has been extended so that it conforms to Equatable when its Element is Equatable, and to Hashable when its element is Hashable. Corresponding test cases have been added. Result: Appropriate conditional conformances of CircularBuffer to Equatable and Hashable
fee7195
to
92a0701
Compare
@swift-nio-bot test this please |
CircularBuffer is now
Equatable
when itsElement
isEquatable
, andHashable
when itsElement
isHashable
Solves #1098