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

Fix encoding of optional custom types #3819

Merged
merged 4 commits into from
Nov 30, 2023

Conversation

bernardnormier
Copy link
Member

Fixes #3812.

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()) {
Copy link
Member Author

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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, definitely inelegant.

@bernardnormier bernardnormier marked this pull request as draft November 30, 2023 14:57
Copy link
Member

@externl externl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@externl externl self-requested a review November 30, 2023 15:05
@bernardnormier bernardnormier marked this pull request as ready for review November 30, 2023 15:08
Copy link
Member

@InsertCreativityHere InsertCreativityHere left a 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 Show resolved Hide resolved
tools/slicec-cs/src/encoding.rs Outdated Show resolved Hide resolved
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()) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, definitely inelegant.

tools/slicec-cs/src/encoding.rs Outdated Show resolved Hide resolved
bernardnormier and others added 2 commits November 30, 2023 11:05
Co-authored-by: Jose  <pepone@users.noreply.github.com>
@bernardnormier bernardnormier merged commit b06a0d0 into icerpc:main Nov 30, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Collections of Optional Custom Types do not Compile
4 participants