Closed kwsch closed 1 year ago
Thanks for raising this! The -1
issue is definitely a bug that I'll work on getting fixed soon. Real Work is quite busy right now, but it should be a small fix. I do have negative-value enum tests, but it seems that there are no tests that cover the combination of enum default + negative value.
The error with the large ulong value was, unfortunately, not fixable the last time I checked. The reason for this is that FlatSharp depends upon flatc (the Google compiler) to parse the FBS files. Unfortunately, flatc only exposes a signed 64 bit value for the enum default. I did check on this at one point and my conclusion was that default values over long.MaxValue
were not possible. However, it has been awhile and I will confirm that this remains the case.
Repro
fbs
(w/ latest 7.1.0 compiler & runtime NuGet pkg):Generated output:
Expected behavior: Compiler would be able to generate its code with a negative default enum value, and high-ulong enum value. Same behavior exists for signed
byte
type.Changing the default value to
0
generates the code as expected. Removing the enum and using the primitive directly (int/ulong) & default value works as expected too.