Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix finding references to interface methods #15951

Merged
merged 5 commits into from
Sep 12, 2023

Conversation

0101
Copy link
Contributor

@0101 0101 commented Sep 8, 2023

A more thorough fix for #15371

@0101 0101 requested a review from a team as a code owner September 8, 2023 12:30
src/Compiler/Service/ItemKey.fs Outdated Show resolved Hide resolved
@psfinaki
Copy link
Member

All the debug key store stuff is just for the convenience and not directly related to the bug, right?

@0101
Copy link
Contributor Author

0101 commented Sep 11, 2023

All the debug key store stuff is just for the convenience and not directly related to the bug, right?

Yes. And it should all be disabled and not adding any overhead - unless you manually enable it for debugging.

Copy link
Member

@psfinaki psfinaki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Out of curiousity, in plain language, how does this fix the bug given that you don't touch editor code here?

IMO this doesn't feel like a very elegant thing, but if this fixes the bug and we don't have a better idea...

@0101
Copy link
Contributor Author

0101 commented Sep 12, 2023

Out of curiousity, in plain language, how does this fix the bug given that you don't touch editor code here?

IMO this doesn't feel like a very elegant thing, but if this fixes the bug and we don't have a better idea...

Finding references is a feature of Compiler Service, not editor. ItemKeyStore is an optimization to save memory. Instead of saving the symbols as objects we write their representation into memory mapped file as bytes (+ the range). Then when we need to find references the written bytes needs to be exactly the same for all of them. However, the symbols are not always the same (as here - definition of abstract method vs implementation or override). So that needs to be dealt with in this code.

If we want to make it more elegant we probably have to come up with a different system. Might be interesting to see how Roslyn does it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants