Compare symbols by metadata name when searching for eqivalent symbols in FAR engine #78656
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: #64592
The cause was that although file-scoped types can have equal names and be in same namespaces, their metadata names are always different. I extrapolated this approach to all symbol comparisons and found-and-replaced all comparisons of
Name
to comparisons ofMetadataName
in the file. At first this doesn't make sense for most symbol kinds (e.g. namespaces or preprecessor symbols), but I believe that conceptually this is more correct.Name
is mostly a user-facing thing, whileMetadataName
is a behind-the-scenes property which, if different on 2 symbols, 100% tells that they are not equivalent. If a symbol always has the sameMetadataName
asName
, the underlying symbol implementation will just return the reference to the same memory, so no waste here. But this makes implementation more future-proof; e.g. if file-scoped members are gonna be added to the language this code will still correctly handle them and tell different references apart.