Skip to content
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

Merged
merged 1 commit into from Aug 11, 2019

Conversation

PopFlamingo
Copy link
Contributor

@PopFlamingo PopFlamingo commented Aug 9, 2019

CircularBuffer is now Equatable when its Element is Equatable, and Hashable when its Element is Hashable

Solves #1098

@swift-nio-bot
Copy link

Can one of the admins verify this patch?

8 similar comments
@swift-nio-bot
Copy link

Can one of the admins verify this patch?

@swift-nio-bot
Copy link

Can one of the admins verify this patch?

@swift-nio-bot
Copy link

Can one of the admins verify this patch?

@swift-nio-bot
Copy link

Can one of the admins verify this patch?

@swift-nio-bot
Copy link

Can one of the admins verify this patch?

@swift-nio-bot
Copy link

Can one of the admins verify this patch?

@swift-nio-bot
Copy link

Can one of the admins verify this patch?

@swift-nio-bot
Copy link

Can one of the admins verify this patch?

@Lukasa Lukasa requested a review from weissi August 9, 2019 15:17
@Lukasa Lukasa added the 🔼 needs-minor-version-bump For PRs that when merged cause a bump of the minor version, ie. 1.x.0 -> 1.(x+1).0 label Aug 9, 2019
@Lukasa Lukasa added this to the 2.7.0 milestone Aug 9, 2019
Copy link
Contributor

@Lukasa Lukasa left a 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?

Sources/NIO/CircularBuffer.swift Outdated Show resolved Hide resolved
@Lukasa
Copy link
Contributor

Lukasa commented Aug 9, 2019

I think we're still missing the tests.

Copy link
Contributor

@Lukasa Lukasa left a 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?

@PopFlamingo PopFlamingo force-pushed the cbequatablehashable branch 2 times, most recently from 6384d44 to fee7195 Compare August 9, 2019 23:09
@PopFlamingo
Copy link
Contributor Author

@Lukasa Everything should now be ok! 🙂

Copy link
Contributor

@Lukasa Lukasa left a 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!

@Lukasa
Copy link
Contributor

Lukasa commented Aug 10, 2019

@swift-nio-bot test this please

Sources/NIO/CircularBuffer.swift Outdated Show resolved Hide resolved
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
@Lukasa
Copy link
Contributor

Lukasa commented Aug 11, 2019

@swift-nio-bot test this please

@Lukasa Lukasa merged commit d30aa6a into apple:master Aug 11, 2019
@PopFlamingo PopFlamingo deleted the cbequatablehashable branch August 11, 2019 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔼 needs-minor-version-bump For PRs that when merged cause a bump of the minor version, ie. 1.x.0 -> 1.(x+1).0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants