sway icon indicating copy to clipboard operation
sway copied to clipboard

Delete redundant spans in `sway_error::error`

Open ironcev opened this issue 2 years ago • 7 comments

Now when Idents are used instead of strings, those redundant spans are really annoying and bloating the code.

See this TODO.

When removing those redundant spans we can have a situation that deduplication of error messages might remove errors that are actually not duplicates because although they point to the same Ident (in terms of name), their Spans can be different. Deduplication works on hashes and Ident's hash contains only the name and not the span.

That's why we should always using IdentUnique.

ironcev avatar Jul 18 '23 21:07 ironcev

What I Understood:

The link takes me to the 'error.rs' file under the sway-error folder. So, whenever, that file will be referred somewhere else, we have to use sway_error::error . I see a lot of { span: Span } there, shall I remove them all ?

postmeback avatar Jul 19 '23 12:07 postmeback

I believe that #4878 closes this issue as well

andrewvious avatar Jul 28 '23 18:07 andrewvious

Hi @postmeback, thanks for your willingness to contribute! This issue actually depends on the outcome of #21 and it might be that it will be obsolete after #21 is closed. So let's rather keep those redundant spans in code for now.

ironcev avatar Jul 28 '23 19:07 ironcev

I believe that #4878 closes this issue as well

As explained in the comment, #4878 does not close this issues, but #21 could render it obsolete.

ironcev avatar Jul 28 '23 19:07 ironcev

Thanks for the reply.

postmeback avatar Jul 29 '23 04:07 postmeback