Example:
---
void main() {
string a = 42; // single tab at the beginning
}
---
Currently prints:
---
test.d(2,13): Error: cannot implicitly convert expression 42 of type int to string
string a = 42; // tab is printed as is
^ // prints 1 space for the source tab
---
The diagnostic should instead be:
---
utf8error.d(3,21): Error: cannot implicitly convert expression 42 of type int to string
string a = 42; // tab is printed as is
^ // prints tab for every tab in the source line
---
The issue is in this line: https://github.com/dlang/dmd/blob/1988acf9d0bedc8fe708e3e8009488e4d4f0e769/src/dmd/errors.d#L381
Currently it is:
---
fputc(' ', stderr);
---
but instead it should be:
---
if (u == '\t')
fputc('\t', stderr);
else
fputc(' ', stderr);
---
or
---
fputc(u == '\t' ? '\t' : ' ', stderr);
---
Comment #1 by dlang-bot — 2022-01-15T23:00:08Z
@MrSmith33 created dlang/dmd pull request #13537 "Fix issue 22678 - -verrors=context does not account for tabs when printing cursor" fixing this issue:
- Fix issue 22678 - -verrors=context does not account for tabs when printing cursor
https://github.com/dlang/dmd/pull/13537
Comment #2 by robert.schadek — 2024-12-13T19:20:24Z