Description
In this example, mypy succeeds, but pyrefly fails.
https://mypy-play.net/?mypy=latest&python=3.12&gist=5f8fe155f983bdb6950f422aee9cd612 has two examples of calling a method a TypeVar that returns Self.
- In the case of a TypeVar that lists a union of types, pyrefly doesn't like us calling f() on the variable of type T
- In the case of a bounded TypeVar, it seems pyrefly says "Returned type
B
is not assignable to declared return typeTypeVar[TBounded]
". It seems to be incorrectly inferring that the Self that f() returns is of typeB
rather than of the typeTBounded
.