Open jorenham opened 1 day ago
oh woops, this should be labeled as bug
oh woops, this should be labeled as bug
feel free to update it 😁
is this the same thing?
class C[T]: ...
type A = C[A] | int
type B = C[B]
b: B
a: A = b
class C[T]: ... type A = C[A] | int type B = C[B] b: B a: A = b
If T
is covariant, and mypy treats str
like a recursive type, then it might indeed be a more general example.
edit
it's actually a different, but similar, issue. Because this Sequence
issue actually works in as expected pyright, but your A, B
example is accepted in both mypy and pyright:
is this the same thing?
class C[T]: ... type A = C[A] | int type B = C[B] b: B a: A = b
What's the | int
for btw 🤔 ?
What's the
| int
for btw 🤔 ?
just for being closer to the original egg
This is a (p)repost from https://github.com/python/mypy/issues/18184, which also applies here:
The false negative can be reproduced with:
mypy-play