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

fix: fixed union generator when processing union with custom enum value #447

Merged
merged 5 commits into from
Oct 30, 2024

Conversation

sssooonnnggg
Copy link
Contributor

In our real-world project, some unions define custom enum values, in which case FlatSharp will report compilation errors.
This PR fixes this issue.

Copy link
Owner

@jamescourtney jamescourtney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution. I'd like to clear up a few details of what impact the assigned numbers here have on the binary format.

src/Tests/FlatSharpCompilerTests/UnionTests.cs Outdated Show resolved Hide resolved
src/Tests/FlatSharpCompilerTests/UnionTests.cs Outdated Show resolved Hide resolved
@jamescourtney
Copy link
Owner

In our real-world project, some unions define custom enum values, in which case FlatSharp will report compilation errors. This PR fixes this issue.

Not related to your PR, but can you share some details about the nature of your real world project? I'm always curious how people are using FlatSharp.

@sssooonnnggg
Copy link
Contributor Author

Not related to your PR, but can you share some details about the nature of your real world project? I'm always curious how people are using FlatSharp.

FlatSharp looks more elegant than the official C# implementation.💕

We have a game engine developed in C++ and using Flatbuffer as the serialization format. We use the official flatbuffer implementation on the C++ side and during this process, we found some bugs in the official flatbuffer implementation and submitted some PRs to them.
Now, some game scene data is edited using Unity, and we want to export this data from Unity and import it into our engine developed with C++. The code generated by the official flatbuffer for C# does not seem to follow best practices in C#, so we are trying to use FlatSharp for this export task because of its superior performance.

@jamescourtney
Copy link
Owner

Not related to your PR, but can you share some details about the nature of your real world project? I'm always curious how people are using FlatSharp.

FlatSharp looks more elegant than the official C# implementation.💕

We have a game engine developed in C++ and using Flatbuffer as the serialization format. We use the official flatbuffer implementation on the C++ side and during this process, we found some bugs in the official flatbuffer implementation and submitted some PRs to them. Now, some game scene data is edited using Unity, and we want to export this data from Unity and import it into our engine developed with C++. The code generated by the official flatbuffer for C# does not seem to follow best practices in C#, so we are trying to use FlatSharp for this export task because of its superior performance.

Thanks! I'm planning to review this PR in depth tonight. I need to check out your branch to actually get a feel for the changes. Sorry for the delay.

@jamescourtney jamescourtney merged commit 334fa59 into jamescourtney:main Oct 30, 2024
6 checks passed
@sssooonnnggg sssooonnnggg deleted the fix-union-value branch November 1, 2024 02:45
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

Successfully merging this pull request may close these issues.

2 participants