Add final checks that were added to protoc between v27.0-rc3 and final v27.0 #309
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There were three changes in the final v27.0 that were not previously implemented in this compiler:
A new
feature_support
field onEnumValueOptions
to allow defining the lifetime of a feature value. This is similar to the field of the same name and type onFieldOptions
, but it controls the actual enum values and in which editions they are valid. (This resolves editions: how to prevent use of new "string_type" feature in edition 2023? protocolbuffers/protobuf#16369 (comment).)A new check that a feature is not used from the same file in which it's defined. (This resolves editions: options interpretation can generate incorrect results protocolbuffers/protobuf#16756.)
A change to
google/protobuf/descriptor.proto
to add extension declarations for known custom features. (This resolves editions: strange behavior with open enums and unrecognized values in message literals protocolbuffers/protobuf#16757.)Unfortunately, this one isn't quite part of this PR because this configuration is not actually in the
descriptorpb
package. Why not? Because extension declarations are defined as source-only options, which means they aren't preserved at runtime, which means they are not present in the embedded descriptor in the latestdescriptorpb
package. I will address this in a subsequent PR by making the sources for these files available to compiler users. It will need to be in a separate package that so it doesn't get linked into user programs by default. For example, the buf CLI won't need it because it has its own mechanism of supplying the sources for these files.This PR updates to use the latest (final) v27.0 release and also updates the protobuf-go dependency to include the v27.0 version of the
descriptorpb
package (first two commits). It then implements the same checks as the first two bullets mentioned above, each in its own commit.