Union field ordered differently error should report the position the field should be in #18854
Labels
error message
This issue points out an error message that is unhelpful and should be improved.
Milestone
Zig Version
0.12.0-dev.2636+476ba0475
Steps to Reproduce and Observed Output
Use an out of order tagged union:
Expected Output
The error should say something along the lines of
Expected union field 'b' to be listed 1st (as it is in enum E)
.While the error does provide the location of the defined enum, this is not as helpful when the enum is generated via comptime code. I'd argue that maybe the error should only show up for types not defined trough
@Type
, but I don't have enough knowledge of the compiler to know if that info is tracked or feasible to track.I attempted to make a patch, but my computer isn't good enough to build the compiler, but here is a simple diff:
Not sure if there is a style guide for error messages or any prior art for the ordinal indicator there, but should be a nice jump start if anyone else wants to take a stab at it.
The text was updated successfully, but these errors were encountered: