mirror of
https://github.com/protocolbuffers/protobuf
synced 2026-08-26 02:23:14 -04:00
Internal change
PiperOrigin-RevId: 645427569
This commit is contained in:
parent
c008a86038
commit
217b66558c
2 changed files with 7 additions and 7 deletions
|
|
@ -211,18 +211,18 @@ post-editions, they will look like this:
|
|||
edition = "tbd"
|
||||
|
||||
message Foo {
|
||||
int32 x = 1 [features.presence = LEGACY_REQUIRED];
|
||||
int32 x = 1 [features.field_presence = LEGACY_REQUIRED];
|
||||
int32 y = 2;
|
||||
repeated int32 z = 3;
|
||||
}
|
||||
|
||||
// bar.proto
|
||||
edition = "tbd"
|
||||
option features.presence = NO_PRESENCE;
|
||||
option features.field_presence = NO_PRESENCE;
|
||||
|
||||
message Bar {
|
||||
int32 x = 1;
|
||||
int32 y = 2 [features.presence = EXPLICIT_PRESENCE];
|
||||
int32 y = 2 [features.field_presence = EXPLICIT_PRESENCE];
|
||||
repeated int32 z = 3;
|
||||
}
|
||||
```
|
||||
|
|
|
|||
|
|
@ -188,11 +188,11 @@ breaking changes.
|
|||
|
||||
### Large-scale Changes with Features Only: Immolation of `required`
|
||||
|
||||
We can use features to move fields off of `features.presence = LEGACY_REQUIRED`
|
||||
(the edition’s spelling of `required`) and onto `features.presence =
|
||||
EXPLICIT_PRESENCE`.
|
||||
We can use features to move fields off of `features.field_presence =
|
||||
LEGACY_REQUIRED` (the edition’s spelling of `required`) and onto
|
||||
`features.field_presence = EXPLICIT_PRESENCE`.
|
||||
|
||||
To do this, we introduce a new value for `features.presence`,
|
||||
To do this, we introduce a new value for `features.field_presence`,
|
||||
`ALWAYS_SERIALIZE`, which behaves like `EXPLICIT_PRESENCE`, but, if the has-bit
|
||||
is not set, the default is serialized. (This is sort of like a cross between
|
||||
`required` and `proto3` no-label.)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue