[Issue 23152] Bad diagnostic for variable used as a type

2022-12-27 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23152

Iain Buclaw  changed:

   What|Removed |Added

 CC||ibuc...@gdcproject.org

--- Comment #2 from Iain Buclaw  ---
Looks like https://github.com/dlang/dmd/pull/5588 introduced the loss of "S2 is
used as a type" diagnostic.


In particular this change switched the result of resolving the identifier from
an error expression to an error type (the latter doesn't have a "used as a
type" follow-up error).

https://github.com/dlang/dmd/pull/5588/files#diff-17f8386682e9c4681f8080c09449e8db528014e83496ce7ed72fc82001fd0883R7455-R7460

--


[Issue 23152] Bad diagnostic for variable used as a type

2022-06-03 Thread d-bugmail--- via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=23152

RazvanN  changed:

   What|Removed |Added

 CC||razvan.nitu1...@gmail.com

--- Comment #1 from RazvanN  ---
I, personally, find that the "is used as a type error" is actually misleading
in this context. S1 is a type, the problem is that the variable should have a
different name. The "circular reference to variable S1" is also annoying, but I
think it's closer to the truth since you are actually creating a circular
reference.

Ideally, the error message should be: "variable name S1 conflicts with struct
declaration S1". Also, it seems that:

void fun()
{
S1 S1;
}

compiles just fine. Which should not.

--