Implicit override not flagged for decorated methods
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 15.6k
- Forks
- 1.8k
- Avg merge
- 12h 13m
- Merged PRs (30d)
- 52
Description
**Describe the bug**
I have `reportImlicitOverride=true` set, and in the code below, I would expect both `MySubclass.f` and `MySubclass.g` to be flagged by this check. With pyright 1.1.403, only `f` gets flagged, but the (decorated) `g` does not.
**Code or Screenshots**
```python
from typing import Callable, Concatenate, ParamSpec, TypeVar
T = TypeVar("T")
P = ParamSpec("P")
R = TypeVar("R")
def memoize_method(
method: Callable[Concatenate[T, P], R]
) -> Callable[Concatenate[T, P], R]:
return method
class MyBase:
def f(self, x: int) -> int:
return 2*x
def g(self, x: int) -> int:
return 2*x
class MySubclass(MyBase):
def f(self, x: int) -> int:
return 2*x
@memoize_method
def g(self, x: int) -> int:
return 2*x
```
([Playground](https://pyright-play.net/?strict=true&reportImplicitOverride=true&code=GYJw9gtgBALgngBwJYDsDmUkQWEMoDCAhgDYlEBGJApgDSFgoDGRM1KrdUACkSERADKCak3oAVRNQBqfAFBzxUALxRJI2SAAUAInE6AlHO4qefAcNG7uhuQCVT6mX113bCgCbVgUCNQhgSABe1AD6fjAAFmAeWnJQCYkJEdEeAFyEpORU1ADaBIwsbBxsueL03AC69HaV8UmJBlAAtAB8mWSUNPmFnCV55TzVULVp9Qkg1DAAriAovlOpCnJM5ADOa1AAsnAAQkRr1GNJXj7AWockwPQAHhmoME1tmCgwxw0TU7PzAEwAVDcFCdvFA0BdqFdbvdXk92g93h9JjM5lB-oCFKsDpsdoJphRMRstDt9ocDAioKcoOdLtcoHcXo8WnDXuSkkjvqiAUDEgABPwBYJhFIxcYUkFgmlQhmwhmsxLslFooA))
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the provided Playground reproducer with reportImplicitOverride=true and compare the diagnostics for undecorated f and decorated g. Trace the implicit-override diagnostic handling for decorated methods; done means both MySubclass.f and MySubclass.g are flagged for the shown example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100