Actually I'm surprised that the first snippet even works. But the
recommended style guide
<https://developers.google.com/protocol-buffers/docs/style> suggests using
CamelCase for message names and snake_case for field names, so if you go
with that convention then you won't have to worry about this kind of error
anyway.

On Sun, Jan 21, 2018 at 8:41 AM, <[email protected]> wrote:

> Lets say I have the following messages:
>
> message A {
>     int foo = 1;
> }
>
> message B {
>     int bar = 1;
> }
>
> message C {
>     oneof asdf {
>         A A = 1;
>         B B = 2;
>     }
> }
>
> If A and B are embedded inside C like:
>
> message C {
>     message A {
>         int foo = 1;
>     }
>
>     message B {
>         int bar = 1;
>     }
>
>     oneof asdf {
>         A A = 1;
>         B B = 2;
>     }
> }
>
> Then it errors out with:
>
> "A" is already defined in "pkg.C".
> "B" is already defined in "pkg.C".
> "A" is not defined.
> "B" is not defined.
>
> However if I change the field name to be anything but the same as the
> message name it works fine.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.

Reply via email to