-
Notifications
You must be signed in to change notification settings - Fork 145
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
OTP27 support; Fix handling of negative zero in OTP27+ #370
OTP27 support; Fix handling of negative zero in OTP27+ #370
Conversation
According to the official documentation in https://protobuf.dev/programming-guides/proto3/#default as of 09/05/24, if a float or double value is set to +0 it will not be serialized, but if it is set to -0 it should be serialized. Currently there are no conformance tests for this behaviour.
# Varies with erlang version | ||
assert TestMsg.EnumFoo.__reverse_mapping__()[4] in [:C, :D, :E] |
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.
This enum is aliased, hence it's correct to decode to any of the aliases, according to documentation:
Though all alias values are valid during deserialization, the first value is always used when serializing.
(https://protobuf.dev/programming-guides/proto3/)
The result is deterministic, just varies by erlang version.
data = %{"j" => 1} | ||
decoded = %Foo{j: :A} |
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.
Here I just avoided using an aliased enum
Looks like erleft/setup-beam is too strict and doesn't allow me to use Elixir 1.16.2 with the rc OTP... |
Yeah we'll need to wait for OTP 27 to be released. Should be real soon. |
Should we maybe drop the CI part (can add it in another PR), or just hold this until its released? :) |
@v0idpwn can you remove the CI part so that we can merge this, and open an issue to remind us to bump CI when 27 is released? |
Required for Elixir 1.15+
They are related to ordering changes
Co-authored-by: Andrea Leopardi <[email protected]>
a042d98
to
13d0b25
Compare
Rebased and changed to add Elixir 1.16.2 with OTP 25 instead of with OTP 27. |
There's a CI failure, other than it looks good. |
Thanks @v0idpwn 🙏 |
@whatyouhide, request a new version release in |
Adds CI and fixes tests that fail on OTP27.
Fixes dependency (ssl_verify_fun) that would cause CI to fail on Elixir 1.15+.
Fixes warning that would cause CI to fail on OTP25 + Elixir 1.16 (closing #369).
Took the opportunity to fix negative zero handling:
According to the official documentation in
https://protobuf.dev/programming-guides/proto3/#default as of 09/05/24,
if a float or double value is set to +0 it will not be serialized, but
if it is set to -0 it should be serialized.
Currently there are no conformance tests for this behaviour.