Missing error messages in shadowing errors #5502
Labels
bug
Something isn't working
compiler: frontend
Everything to do with type checking, control flow analysis, and everything between parsing and IRgen
compiler
General compiler. Should eventually become more specific as the issue is triaged
All the shadowing errors (for consts, symbols, and generic parameters) are missing errors on the compiler output in the case of the same identifier. The reason is using
Ident
s in the errors and extracting spans from them. This is exactly what we should do, but since the span is not a part of theIdent
's hash, two different error messages (different spans) with the sameIdent
e.g. a variable or a constant, will end up having the same hash and will be removed by the deduplication of the error messages which differentiate the messages based on their hash.The solution is to use
IdentUnique
instead ofIdent
.To reproduce, create a script with lib.sw like this:
and the main.sw:
When compiling the script, the shadowing messages will appear only for the first error. The second one will be falsely removed by the deduplication.
Related to #4818.
The text was updated successfully, but these errors were encountered: