You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Explicit-presence enum fields skip defined_only, const, in and not_in#103
Enum rules on a field with explicit presence generate no check.
Every singular enum field in an editions 2023 file has explicit presence by default, as does a proto3 optional enum. With
the generated validate() accepts a Paint with color set to 7 (no such value) and base set to COLOR_UNSPECIFIED.
It should report enum.defined_only for color and enum.in for base.
The field is generated as Option<EnumValue<E>>, so it reaches emit_optional_inner, where FieldKind::Enum { .. } falls in the arm that emits nothing.
Routing it through emit_enum_checks_on, as the implicit-presence path already does, fixes it.
Reference fix (it also makes emit_optional_inner return Result, since emit_enum_checks_on does): sachaw@049f8ea
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Enum rules on a field with explicit presence generate no check.
Every singular enum field in an editions 2023 file has explicit presence by default, as does a proto3
optionalenum. Withthe generated
validate()accepts aPaintwithcolorset to 7 (no such value) andbaseset toCOLOR_UNSPECIFIED.It should report
enum.defined_onlyforcolorandenum.inforbase.The field is generated as
Option<EnumValue<E>>, so it reachesemit_optional_inner, whereFieldKind::Enum { .. }falls in the arm that emits nothing.Routing it through
emit_enum_checks_on, as the implicit-presence path already does, fixes it.Reference fix (it also makes
emit_optional_innerreturnResult, sinceemit_enum_checks_ondoes): sachaw@049f8eaAll reactions