Closed arik-so closed 1 year ago
Mh, I'm not entirely sure what you are referring to with 'default for the last value' here? I assume the general context is this part of the parser code?
Nope, not quite. Look how the type determination happens in a complex enum, such as APIError:
Now, compare that to the instantiation of a primitive enum from the C type:
Basically, the idea is that for primitive enums, there should also not be a default case, but an explicit check, with the default being an abort.
Perhaps the unsupported value should also be part of the error output in both cases.
For the generation aspect of it, compare (correct) https://github.com/arik-so/ldk-parser/blob/25cfb1b7333aacb88e207fe7716a719b6e91e24a/src/generation/complex_enum_generator.mts#L34-L52 with (incorrect) https://github.com/arik-so/ldk-parser/blob/25cfb1b7333aacb88e207fe7716a719b6e91e24a/src/generation/primitive_enum_generator.mts#L21-L45
Same way as we do it for the tagging enum variants in TaggedValueTypes/ComplexEnums.