Skip to content

Commit

Permalink
Update isPackedFieldByDefault to return false if not PACKED
Browse files Browse the repository at this point in the history
Instead of assuming that EXPANDED means that the field is not packed, be specific and check for PACKED, because it's unlikely but possible that more values are added to the enumeration in the future.
  • Loading branch information
timostamm committed Nov 22, 2023
1 parent 3836058 commit 9ee344c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/protobuf/src/create-descriptor-set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,7 @@ function isPackedFieldByDefault(
resolveFeatures: FeatureResolverFn,
) {
const { repeatedFieldEncoding } = resolveFeatures(file.edition);
if (repeatedFieldEncoding == FeatureSet_RepeatedFieldEncoding.EXPANDED) {
if (repeatedFieldEncoding != FeatureSet_RepeatedFieldEncoding.PACKED) {
return false;
}
// From the proto3 language guide:
Expand Down

0 comments on commit 9ee344c

Please sign in to comment.