protoreflect
protoreflect copied to clipboard
protoparse: ParseFiles allows case insensitive duplicate enum values
ParseFiles doesn't do the same check as protoc for case-insensitive duplicate enums.
syntax = "proto3";
package a;
enum Success {
SUCCESS_UNSPECIFIED = 0;
SUCCESS_unspecified = 1;
}
protoc result:
a.proto:7:3: Enum name SUCCESS_unspecified has the same name as SUCCESS_UNSPECIFIED if you ignore case and strip out the enum name prefix (if any). This is error-prone and can lead to undefined behavior. Please avoid doing this. If you are using allow_alias, please assign the same numeric value to both enums.
This is similar to https://github.com/jhump/protoreflect/issues/358
Ugh, looks like protoc must have some gnarly parsing logic to identify fields that look the same this way :/
It considers all of these to be conflicts, too:
SUCCESS_UNSPECIFIED,UnspecifiedSUCCESS_UNSPECIFIED,successUnSpecifiedSUCCESS_UNSPECIFIED,___success___unspecified
@WillAbides, what version of protoc were you using?
In version 3.14, this is just a warning, not an error. I was perusing release notes for all versions since 3.14.0 and don't see anything about a change in behavior. Is it possible you were using an older version of protoc?