`bad-override` false positive on `__init__`, `__new__` and `__init_subclass__` with `@override` decorator
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 516
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the Bug
```python
from typing import override
class Foo:
def __init_subclass__(cls, asdf: bool) -> None: ... # no error
class Bar:
@override
def __init_subclass__(cls, asdf: bool) -> None: ... # error: bad-overide
```
```
ERROR sandbox.py:10:9-26: Class member `Bar.__init_subclass__` overrides parent class `object` in an inconsistent manner [[bad-override](https://pyrefly.org/en/docs/error-kinds/#bad-override)]
`Bar.__init_subclass__` has type `(cls: type[Bar], asdf: bool) -> None`, which is not assignable to `(cls: type[Bar]) -> None`, the type of `object.__init_subclass__`
Signature mismatch:
expected: def __init_subclass__(cls: type[Bar]) -> None: ...
^ parameters
found: def __init_subclass__(cls: type[Bar], asdf: bool) -> None: ...
^^^^^^^^^^^^ parameters
```
Python: 3.13
the `@override` decorator should have no impact on whether the method is considered a valid override or not, because it's still an override either way
### Sandbox Link
https://pyrefly.org/sandbox/?project=N4IgZglgNgpgziAXKOBDAdgEwEYHsAeAdAA4CeS4ATrgLYAEALqcROgOZ0Q3G6UN24AbjEqUImGAB1006QGMoqOHDoAxXLkTS6OuhLB0A%2BodYQGhuAFdsCpXGMAKBXAA0dJZjCI6eXFACUdAC0AHx0AHK46DDehHF0AMR06Lh0ItSUsjLotsp0AEKolFrounQAAkLp4lKluvpGJuhmFta59oZOUK7ucJ7evgHBYZHRsfFJ6bwDqJhBVWIS0iAuIGSUMGBQpIQMtFAUZAwAFlFBwpRwEFF0ALx0kiAAzIQAjABMj9IA2lOXALrSDApBioBjXdBBGgQOA0MFyY53OgAcj%2ByOWAF9Vqg5ODhKpoDAKGgsHgiGQQBigA
### (Only applicable for extension issues) IDE Information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.