Type narrowing behaves oddly in presence of type.__eq__ #4419
Labels
addressed in next version
Issue is fixed and will appear in next published version
bug
Something isn't working
Describe the bug
In some situations an
x: Union[X, Y, ...]
that has been previously narrowed toY
incorrectly unnarrows back tox: Union[X, Y]
. This happens seemingly when we branch onsomething == X
.To Reproduce
Run pyright on the code from the Code section.
Expected behavior
No error.
Screenshots or Code
VS Code extension or command-line
Commandline pyright 1.1.287
Additional context
Works on pyright 1.1.285
The text was updated successfully, but these errors were encountered: