-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal: consider column for
TLineInfo
equality (#880)
## Summary Change the default equality operation for `TLineInfo` to also consider the column, effectively changing the meaning of `TLineInfo` to "source position info". Places in the compiler that relied on the old behaviour are adjusted. In most cases, a `TLineInfo` is already treated as a "source position", so having the `==` operator reflect that makes sense. The `hash` procedure also already considered the column, too. ## Details The custom `==` implementation for `TLineInfo` is removed, which means that the default implementation (value equality) is used. `exactEquals` is redundant now: its usages are replaced with `==` and the procedure itself is removed. ### Changed usage sites The VM profiler implementation (`vmprofiler`) relied on the old equality behaviour, as it uses `TLineInfo` as the key for a table that associates profiler data with a source *line*. Here, `TLineInfo` usage is replaced with the new `SourceLinePosition` tuple, which is a `TLineInfo` without the column information. For rendering the profiler data, a temporary `TLineInfo` instance is created, but with the column set to -1. This means that the text output now links to the source line *without* including a column position. ### Other relevant usage sites There are two other places where the different equality behaviour causes a visible change in compiler behaviour, but that are not adjusted because the new behaviour is better: - with reporting "nil dereference" warnings (`nilcheck.derefWarning`): warnings are now reported one per line+column, instead of one per line - providing error/warning context (`msgs.getContext`, "instantiated from" messages): if there are multiple surrounding instantiation contexts on the same line (but in different columns), they are now all shown, instead of only the first one --------- Co-authored-by: zerbina <100542850+zerbina@users.noreply.github.com>
- Loading branch information
Showing
7 changed files
with
19 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters