-
Notifications
You must be signed in to change notification settings - Fork 664
Implement IEquatable<Self> for all [SpacetimeDB.Type]s #2396
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
Conversation
Finish generated code Update test output Codegen seems to be working, but I want to test in blackholio... Add nullable annotations Fix nullability of generated == and != More elaborate ToString Test ToString better + fix ToString for tagged enums One more test case
1f007f1 to
f6c1a7f
Compare
|
I don't know the C# sdk well enough to be able to review this change sufficiently. I've reviewed the repro, and so I'm satisfied as long as it fixes the repro test, but I think @rekhoff will be able to give this a much better review. |
|
There is a decent amount going on here, I don't see any clear issues, and what I see makes sense. It looks like the quickstart-chat and blackholio haven't been manually tested with these changes, which would be good to do. I'm going to hold off on my approval until after I get these tested. |
rekhoff
left a comment
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.
Reviewed code, nothing stood out as wrong. Tested the repo version Blackhol.io locally using both a Rust and C# server without running into issues. Marking this as approved!
Description of Changes
Fixes issue identified in clockworklabs/com.clockworklabs.spacetimedbsdk#264 by implementing
IEquatable<Self>for all[SpacetimeDB.Type]s in C#. Also overridesGetHashCode()andToString()for these types, which should be helpful if users want to use them as hash map keys or print them.Ready for review.
API and ABI breaking changes
Technically API breaking, since it is possible users manually implemented
IEquatablesomewhere.It's an easy fix though.
This also uses
#nullable enableand#nullable restorein the generated code. This requires a version of Unity supporting C# 8. But I believe we already required this.Expected complexity level and risk
2: this is a slightly-tricky algorithm to implement due to some pitfalls in C#'s type system.
Testing