Skip to content

See references show unrelated results #56984

@FMorschel

Description

@FMorschel

In my screenshot I'll sepparate this repro into three files so the VSCode UI helps a bit to see the problem.

class A {
  void m1() {}
  void m2() {
    m1();
  }
}

class B extends A {
  @override
  void m2() {
    m1();
  }

  @override
  void m1() {
    print('B.m1');
  }
}

void f1(B m) {
  m
    ..m2()
    ..m1();
}

class C extends A {
  @override
  void m1 () {}
  @override
  void m2() {
    m1();
  }
}

Here you can see that in the above structure B and C are subclasses of A. In this example, m1 is called under A.m2, B.m2, C.m2 and under f1.

If you look for references of A.m1 you get all calls to it in the list.

image

Now the problem; if you ask for references for B.m1 or C.m1 you get the same unrelated results:

image

Here you can see that when asking for references of C.m1 I get instance calls that would never be C. Inside B and f1 in this case.

The same happens if you ask for references of B.m1, you get the call under C.m2 which could never be a B instance.


I'd like to ask for this to be worked on so that only B instances (or another subclass instance) would show. For C.m1 for example, I was expecting only the call inside A.m2 and C.m2. Definitelly not the call under f1 or B.m2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3A lower priority bug or feature requestarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-serverIssues related to some aspect of the analysis servertype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions