-
Notifications
You must be signed in to change notification settings - Fork 15.5k
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
Implemented proto3 presence for Ruby. #7406
Conversation
continue; | ||
} | ||
|
||
// Prepend '_' until we are no longer conflicting. |
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.
Will this renaming suddenly change when users reorder fields in their proto definition?
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.
If there are conflicts it could. But the synthetic oneof name was not created by the user, so the user cannot assume what its name is.
if (accessor_type == METHOD_PRESENCE && test_f != NULL) { | ||
if (!upb_fielddef_haspresence(test_f)) return METHOD_UNKNOWN; | ||
|
||
// TODO(haberman): remove this case, allow for proto3 oneofs. |
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.
Do we previously support this?
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.
No, we have never supported this. The unit tests were failing until I added this check, see:
Lines 45 to 50 in 1895045
assert_raise NoMethodError do | |
m.has_a? | |
end | |
assert_raise ArgumentError do | |
OneofMessage.descriptor.lookup('a').has?(m) | |
end |
size_t hasbit = layout->fields[upb_fielddef_index(field)].hasbit; | ||
assert(field_contains_hasbit(layout, field)); |
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.
Do you need to move this assert?
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, because it is a statement and cannot go before the declaration of hasbit
.
This worked previously because we had not been testing with asserts enabled.
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.
What is synthetic oneof?
Re: synthetic oneof (and for more background information in general), see this doc which is currently in review: https://github.com/protocolbuffers/protobuf/blob/9ae5203712eb80f89261d6df8d5674efa5a0edb8/docs/implementing_proto3_presence.md |
Did ruby 2.6 fail on mac? |
@TeBoring fixed the crash that was happening on mac. |
No description provided.