bearophile wrote:
Another diagnostic feature is to not just use the caret (we have discussed
about it time ago) but it also underlines the wrong part:
t.c:7:39: error: invalid operands to binary expression ('int' and 'struct A')
return y + func(y ? ((SomeA.X + 40) + SomeA) / 42 + SomeA.X : SomeA.X);
~~~~~~~~~~~~~~ ^ ~~~~~
Yes, we discussed it before. The Digital Mars C/C++ compiler does this, and
NOBODY CARES.
Not one person in 25 years has ever even commented on it. Nobody commented on
its lack in dmd.
It's a waste of time to implement things nobody cares about.
--------------------
"Fix-it Hints" are a diagnostic feature that I think is generally missing in D,
dmd has quite a few of them, like:
error("storage class 'auto' is invalid when declaring a class, did you mean to
use 'scope'?");
$ clang t.c
t.c:4:8: error: expected ';' after expression
bar()
^
;
DMD 2.049 shows a worse error message:
test.d(5): found '}' when expecting ';' following statement
test.d(5): found 'EOF' when expecting '}' following compound statement
I'd like the missing ; error to refer to where it's actually missing, in D code.
It's the very next token. There's nothing wrong with the message. In fact, I
think it is better than the clang one. The clang one is wrong as a ; terminates
a statement, not an expression.
void main() {
foo_t *P = null;
}
Unfortunately here DMD 2.049 acts very badly:
test.d(2): Error: identifier 'foo_t' is not defined
test.d(2): Error: foo_t is used as a type
Assertion failure: 'tn->mod == MODimmutable' on line 879 in file 'mtype.c'
The assert is a bug, but the first two messages are right on target.