Also infer Self for positional-only self parameters

This commit is contained in:
David Peter 2025-09-24 18:06:51 +02:00
parent 47678d176c
commit 9fdedb5e34
3 changed files with 81 additions and 57 deletions

View file

@ -141,8 +141,7 @@ class B:
reveal_type(B().name_does_not_matter()) # revealed: B
# TODO: this should be B
reveal_type(B().positional_only(1)) # revealed: Unknown
reveal_type(B().positional_only(1)) # revealed: B
reveal_type(B().keyword_only(x=1)) # revealed: B

View file

@ -664,7 +664,7 @@ def combine(p: Person, e: Employee):
reveal_type(e | e) # revealed: Employee
# TODO: Should be `Person` once we support subtyping for TypedDicts
reveal_type(p | e) # revealed: Employee
reveal_type(p | e) # revealed: Person | Employee
```
When inheriting from a `TypedDict` with a different `total` setting, inherited fields maintain their