g00g1e / metasyntactic

Automatically exported from code.google.com/p/metasyntactic
0 stars 0 forks source link

[ProtocolBuffers] Obj-C classes produced from proto definitions that have a field named "result" fail to compile #137

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
As the title says, proto messages that have a field named "result" produce 
Obj-C classes that fail to compile. For example, this .proto definition:

message Game {
    optional GameResult result = 1;
}

... gives in an Obj-C file that has a Game_Builder class which has a setResult: 
method for the Game's result variable. However, the Game_Builder class also has 
a @property defined for its internal result value (of type Game). Once it's 
synthesized, it yields another setResult: method, which conflicts with the 
setResult: method for Game_Builder's result field ("duplicate method 
definition" error).

I went through your compiler code and refactored the "result" variable to 
become "protobufBuilderResult". I used a name that is highly unlikely to be 
used as a field name inside a .proto file, but you can of course rename it to 
something else.

I attached the modified files, they're all from the 
src/google/protobuf/compiler/objectivec/ folder. Can you please integrate the 
changes?

Thanks,
Vladimir Mitrovic (vladimirm@nordeus.eu)
Lead iOS Dev at Nordeus (www.nordeus.eu)

Original issue reported on code.google.com by snipe...@gmail.com on 20 Jun 2011 at 10:23

Attachments: