mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-30 05:44:56 +00:00
Also infer Self for positional-only self parameters
This commit is contained in:
parent
47678d176c
commit
9fdedb5e34
3 changed files with 81 additions and 57 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue