Skip to content

Fix logic issue in find-refs that could fail to find related symbols in inheritance#61972

Merged
CyrusNajmabadi merged 1 commit intodotnet:mainfrom
CyrusNajmabadi:fixFindRefsInheritance
Jun 17, 2022
Merged

Fix logic issue in find-refs that could fail to find related symbols in inheritance#61972
CyrusNajmabadi merged 1 commit intodotnet:mainfrom
CyrusNajmabadi:fixFindRefsInheritance

Conversation

@CyrusNajmabadi
Copy link
Copy Markdown
Contributor

@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner June 16, 2022 20:41
@ghost ghost added the Area-IDE label Jun 16, 2022

if (projects.Count == 1)
{
orderedProjectsToExamine = projects.ToImmutableArray();
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

the issue here was htat we attempted to have an optimization whereby we assumed that if we were only examining a single project, that we only had to check that project alone to find out if it derived from teh type we were looking for. This is trivially not true with a case like:

project1

class A { }
class B : A { }

project2

class C : B { }

Here, searching for the derived types of 'A' would not find 'C' if we were looking only in project2 (which can happen as find-refs is sweeping projects).

This is often unnoticeable as we will normally find 'B' and then discover teh relation between B and C when in project2. However, in the reported issue teh user has:

project1

class A { public virtual void F() { } }
class B : A { }

project2

class C : B { public override void F() { } }

Here, as we're searching for overrides for 'F' we do not dive into 'B' (as it doesn't have an override itself). So we don't have consider the 'B' type when contiuing to look for derived types in project2. As such, we miss the override in it.

@CyrusNajmabadi CyrusNajmabadi enabled auto-merge June 16, 2022 23:48
@CyrusNajmabadi CyrusNajmabadi merged commit f6b6076 into dotnet:main Jun 17, 2022
@ghost ghost added this to the Next milestone Jun 17, 2022
@CyrusNajmabadi CyrusNajmabadi deleted the fixFindRefsInheritance branch June 17, 2022 04:41
@RikkiGibson RikkiGibson modified the milestones: Next, 17.3 P3 Jun 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants