facebook / facebook/pyrefly

IDE: references and call hierarchy for overridden methods

Open
#2,490 1 comment 0 reactions 1 assignee Claimed by @asukaminato0721 View on GitHub
language-server
Dominant language
Rust
Stars
7k
Forks
516
PR merge metrics
No merged PRs in 30d

Description

### Describe the Bug

In the IDE, when navigating to references (via `Go to references` or `Show Call Hierarchy`), I would expect it to also show references of the overridden base method. While it's not a direct call, I'd prefer to show it all possible references.

```python
from typing import Protocol, override, cast

class Foo(Protocol):
def foo(self): pass

class FooImpl(Foo):
def foo(self): pass

def a():
cast(Foo, None).foo() # not counted as a reference for FooImpl.foo
def b():
cast(FooImpl, None).foo()

class Bar():
def bar(self): pass

class BarChild(Bar):
@override
def bar(self): pass # not counted as a reference for FooImpl.foo

def c():
cast(Bar, None).bar()
def d():
cast(BarChild, None).bar()
```

Screenshot with Pyrefly:

Image

Screenshot with Pylance:

Image

### Sandbox Link

_No response_

### (Only applicable for extension issues) IDE Information

VS Code with Pyrefly v0.53.0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.