-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
Duplicate Clone Functions v 7.0.2 #354
Comments
I can see how that would happen. What has possessed you to redefine the existing primitives? |
Oh, I see -- You're trying to get around the FlatBuffer Union restrictions by mapping primitive types externally. That's very clever and not something that I anticipated at all. Clone methods are implemented "on the side" and work by overloading the "Clone" method so that the generated code doesn't have to be very smart. There's a Clone method available for every type in the object graph. For the dumb ones like primitives, strings, and value structs, they are just annotated with The cheapest possible fix here is to just not emit clone methods at all for value structs since they are values. However, I need to actually revisit copy constructors wholesale at some point to remove some extra allocations. Let me noodle on this for a few days and get back to you on this thread. Thanks for raising the issue! |
In the interim I have just copied the generated file out of the obj folder and removed the duplicate function definitions. It's working great so far with that workaround. |
Just FYI -- I'm not in a big hurry to fix this. It seems like the workaround is pretty easy and this seems to be a pretty niche scenario, so I'm going to take the time and make sure I can do it correctly. |
Getting duplicate clone helpers generated with the latest version.
Sample.fbs
Snip from FlatSharp.generated.cs showing the duplication.
The text was updated successfully, but these errors were encountered: