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
Fix Rust codegen escaping field in tables. #7659
Conversation
@dbaileychess hey can you take a look at the CI failures? I can't quite figure out what's broken, though it appears unrelated to Rust changes |
Hi @CasperN ,
As you can see the second one match with keyword and get an underline suffix. Now, When code generator wants to use first method to get union type in code, by mistake, take the second one, as result we add "_type" suffix to fix the problem, but we should have use the second one and it does not need to add suffix and use another variable name DISCRIMINAT.
The same problem exist in c++ code generator. example of fbs:
the result should be something like this:
IMO the best way to fix these problems is to pick the correct method. |
I made some fixes to the MacOS CI yesterday, you just have to update (rebase/merge) to trigger it again. |
@dbaileychess can you approve this? |
Ping @dbaileychess for LGTM |
Sorry for the delay! |
* Fix Rust codegen escaping field in tables. * other gencode * gencode * removed a debug print * regen code Co-authored-by: Casper Neo <cneo@google.com> Co-authored-by: Derek Bailey <derekbailey@google.com>
Fixes #7617 - the problem is that if you have a union in a table with the field name "type", the Rust code-gen escaped "type" to "type_" before appending "_type"` which does not equal the magic field "type_type" which is generated by flatc.