basedmypy
basedmypy copied to clipboard
Based Python static type checker with baseline, sane default settings and based typing features
```py a: Any = [1] # error: list[Any] ```
```py class C: # Note: Generic[T] missing def bad_idea(self, x: T) -> None: self.x = x # should be error def nope(self, x: T) -> None: self.x = x #...
```py def f(a: float) -> None: if isinstance(a, float): reveal_type(a) return reveal_type(a) ```
if application mode is enabled, we can make assumptions about subclasses
```py class A: ... A() or 1 # error, we know that it's not a subtype that has an `__eq__` reveal_type(A()) # Exactly[A] def f(a: A): a or 1 #...
- as a subset of #202 we should narrow literals: ```py a = 1 reveal_type(a) # i expect "1" ```
`Final` means `ReadOnly`, need a way to distinguish
Shouldn't there be separate denotations for final and read-only? should `Final` mean read only?
### Describe the problem, ie expected/actual result (if it's not blatantly obvious) original issue: https://github.com/pydantic/pydantic/issues/9902 also raised on bpr: https://github.com/DetachHead/basedpyright/issues/536 since mypy is able to detect that the positional argument...