Show where bad union code is located #22195
Labels
Bug
This tag is applied to issues which reports bugs.
Nicer V Errors
Bugs/feature requests, related to improving V error messages.
Unit: cgen
Bugs/feature requests, that are related to the default C generating backend.
Unit: Checker
Bugs/feature requests, that are related to the type checker.
Describe the bug
Next code yields correctly an union use error, but the compiler message doesn't indicate where the offending code is located. Specially when the bad code is in another imported module, it is very difficult to find it.
Error without the details to find the problem:
Reproduction Steps
Run the above code and get the incomplete (to say) compiler message.
Expected Behavior
The description of the error, in this case
cgen error: union must not have more than 1 initializer
but add the file name and the lines where the problem was found, like in the rest of compiler indications.Current Behavior
Simple compiler message without helping to find the bad code.
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.4.7 6aeef5e
Environment details (OS name and version, etc.)
V full version: V 0.4.7 2cde320.6aeef5e
OS: linux, Ubuntu 20.04.6 LTS
Processor: 4 cpus, 64bit, little endian, Intel(R) Core(TM) i3-4150 CPU @ 3.50GHz
Git version: git version 2.25.1
Git vroot status: weekly.2024.29-254-g6aeef5e4
.git/config present: true
CC version: cc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0
thirdparty/tcc status: thirdparty-linux-amd64 a0799a5
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
The text was updated successfully, but these errors were encountered: