Skip to content

Commit

Permalink
[red-knot] Add MRO resolution for classes (take 2)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexWaygood committed Oct 31, 2024
1 parent 53fa32a commit 9bb38e5
Show file tree
Hide file tree
Showing 6 changed files with 791 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,7 @@ reveal_type(A() + B()) # revealed: MyString
# N.B. Still a subtype of `A`, even though `A` does not appear directly in the class's `__bases__`
class C(B): ...

# TODO: we currently only understand direct subclasses as subtypes of the superclass.
# We need to iterate through the full MRO rather than just the class's bases;
# if we do, we'll understand `C` as a subtype of `A`, and correctly understand this as being
# `MyString` rather than `str`
reveal_type(A() + C()) # revealed: str
reveal_type(A() + C()) # revealed: MyString
```

## Reflected precedence 2
Expand Down
Loading

0 comments on commit 9bb38e5

Please sign in to comment.