Another example of how AI is bad, bug fix for 20875

Dennis dkorpel at gmail.com
Tue Apr 7 14:06:58 UTC 2026


On Tuesday, 7 April 2026 at 12:41:59 UTC, user1234 wrote:
> the problem is not about arguments. The problem is that the 
> sub-expression is not callable. I.E the error message shoud be 
> the same as when you unfortunatetly, completly exhausted after 
> a 12 hours shift, write
>
> ```d
> void main()
> {
>     alias FT = void(int);
>     FT(0);
> }
> ```

The compiler analyses expressions depth first. It checks 
arguments before checking whether the expression is callable. If 
you change `FT(0)` into `FT("")`, it reports "Error: cannot 
implicitly convert expression `""` of type `string` to `int`" 
which hides the "type `void(int)` is not an expression" error. 
This has always been the case.

Conversely, once you fix the argument list in the test case of 
20875 you will get the "is not an expression" error. Also note 
that calling a type is not necessarily an error, it's fine when 
you don't actually need the value. For example:

```D
alias T = typeof(typeof(res.front)());
```

If you think the "is not an expression" should have priority over 
the argument list error, that's a valid enhancement request, but 
it would be harder to implement (goes against the natural bottom 
up analysis order of the compiler) and would be a separate 
change. The bugfix simply follows existing architectural choices 
of dmd.

I don't appreciate the rabble rousing on the forum by the way. I 
would have preferred a review comment on GitHub, or a new issue 
asking to improve the error message. I like working on open 
source, but it can be stressful for me when I feel like there's a 
large group of strangers watching me, eager to point out every 
way I'm doing things wrong.


More information about the Digitalmars-d mailing list