-
Notifications
You must be signed in to change notification settings - Fork 13
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
Fix encoding of optional custom types #3819
Conversation
tools/slicec-cs/src/encoding.rs
Outdated
let value = match (is_optional, type_ref.is_value_type()) { | ||
(true, false) => "value!", | ||
(true, true) => "value!.Value", | ||
let value = match (is_optional, type_ref.is_value_type(), type_ref.is_reference_type()) { |
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.
I didn't change the logic of this code in this PR, even though it's definitely inelegant.
We compute this value here and then use "value" or value in the code below, which is pretty confusing. Not having any comment doesn't help either.
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.
Yes, definitely inelegant.
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.
Looks good!
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.
Looks good!
tools/slicec-cs/src/encoding.rs
Outdated
let value = match (is_optional, type_ref.is_value_type()) { | ||
(true, false) => "value!", | ||
(true, true) => "value!.Value", | ||
let value = match (is_optional, type_ref.is_value_type(), type_ref.is_reference_type()) { |
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.
Yes, definitely inelegant.
Co-authored-by: Jose <pepone@users.noreply.github.com>
Fixes #3812.