Closed wch closed 1 week ago
I'm not seeing any errors for the above code snippet. Did you mean for Foo = int
to be Foo = int | str
or something like that?
Sorry, I did mean Foo = int | str
! I have corrected the example.
This is addressed in pyright 1.1.371.
Consider this code.
With pyright 1.1.370, this results in an error:
It looks like inside of the
if isinstance(x, Foo):
block, it is not narrowingx
toFoo
; it still thinks it could beFoo | list[Foo]
.If I change the definition of
Foo
so that it's justFoo = int
(and not a union type) then no error is reported.