facebook / facebook/pyrefly

report an error when `__init__` and `__new__` signatures are incompatible

Open
#3,679 0 comments 0 reactions 0 assignees View on GitHub
typechecking
Dominant language
Rust
Stars
7k
Forks
516
PR merge metrics
No merged PRs in 30d

Description

basically pyright's `reportInconsistentConstructor` rule:

```py
from typing import Self

class Foo:
def __init__(self) -> None: # error: Mismatch between signature of __new__ and __init__ in class "Foo" (reportInconsistentConstructor)
...

def __new__(cls, value: int) -> Self:
...
```

(note that the pyright rule is a bit too strict however, see https://github.com/DetachHead/basedpyright/issues/1785#issuecomment-4303007748)

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.