Open arichardson opened 3 years ago
Similarly warning messages such as
Warning: Possible incomplete pattern match at
Most general matched pattern is AT_CAP_ERR_
Warning: Possible incomplete pattern match at [sail-riscv/model/riscv_pmp_regs.sail]:76:7-12
76 | then match n {
| ^---^
|
Most general matched pattern is 0
would be clickable if they were reported as
<unknown>:0:0: Warning: Possible incomplete pattern match
Most general matched pattern is AT_CAP_ERR_
sail-riscv/model/riscv_pmp_regs.sail]:76:7-12: Warning: Possible incomplete pattern match
76 | then match n {
| ^---^
|
Most general matched pattern is 0
This would also be useful for Emacs; check Emacs' compile
library/command for details, but of course it supports GCC-style error messages -- it turns out that this style is actually laid out in the GNU Coding Standards: https://www.gnu.org/prep/standards/standards.html#Errors.
(I mean how else are the GNU Emacs developers going to check the errors in their C code when compiling on GNU/Linux -- even the other compiler uses GCC-style messsages: https://clang.llvm.org/docs/UsersManual.html#cl-diag-formatting.)
Thanks for bumping this issue, this looks like a fairly straightforward change. Should just be a case of changing some format strings in src/error_format.ml. I will put it on my todo list for the next Sail release.
My only question is there any guidance for nesting errors formatted in this way, so that the inner locations will also be clickable? For example:
Type error:
[duplicate_binding.sail]:6:10-11
6 | let (x, x) = (true, false);
| ^
| Duplicate binding for x in pattern
|
| Caused by [duplicate_binding.sail]:6:7-8
| 6 | let (x, x) = (true, false);
| | ^
| | Previous binding of x here
|
Many IDEs allow for clickable links if you format error messages similar to common GCC/Clang C compiler output:
For example, in PyCharm, if I get an error/warning when compiling the simulator code, I get something like:
If I click on the file path, my IDE will open the file at that line.
However, a sail error such as
Does not result in a clickable link. It should work if the message is changed to use:
sail-riscv/model/riscv_mem.sail:147:4-35: