Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Naming conflict when oneof begins with Set, fails to compile #686

Open
sppalkia opened this issue Oct 23, 2023 · 0 comments
Open

Naming conflict when oneof begins with Set, fails to compile #686

sppalkia opened this issue Oct 23, 2023 · 0 comments

Comments

@sppalkia
Copy link

I have a Protobuf that looks something like this:

message Foo {
  oneof command {
    Bar bar = 1;
    SetBar bar = 2;
  }
}

message Bar {}
message SetBar {}

When I try to compile the Proto, I get an error along the lines of:

71  |     pub fn set_bar(&mut self, v: Bar) {
    |     ---------------------------------------------------------- other definition for `set_bar`
...
101 |     pub fn set_bar(&self) -> &SetBar {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ duplicate definitions for `set_bar`

This is happening even if I set the generate_getter and generator_accessor to false. Is there any good workaround for this? Maybe it be possible to add an option for adding a prefix to getters, e.g., get_, to disambiguate such cases?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant