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
syntax = "proto3";
package Test;
enum E { A = 0; }
enum F { A = 0; }
It is rejected by protoc:
$ protoc --cpp_out=. test.proto
test.proto:5:10: "A" is already defined in "Test".
test.proto:5:10: Note that enum values use C++ scoping rules, meaning that enum values are siblings of their type, not children of it. Therefore, "A" must be unique within "Test", not just within "F".
NOTE: Using --python_out or --scala_out does not eliminate the mention of C++. Probably this rule is imposed regardless of output language.
Suggestion: For compatibility, compile-proto-file should impose this rule. And once the rule is imposed, the enumeration type name can be removed from the data constructor:
data E = A
The text was updated successfully, but these errors were encountered:
Consider this file
test.proto
:It is rejected by
protoc
:NOTE: Using
--python_out
or--scala_out
does not eliminate the mention of C++. Probably this rule is imposed regardless of output language.However,
compile-proto-file
accepts it:The result includes these definitions:
Suggestion: For compatibility,
compile-proto-file
should impose this rule. And once the rule is imposed, the enumeration type name can be removed from the data constructor:The text was updated successfully, but these errors were encountered: