You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix narrowing union types that include Self with isinstance (Fixes#14912).
The special case of bound type variables was not handled in function `covers_at_runtime` of module `subtypes`. So I added it and defined the test case `testNarrowSelfType`.
Bug Report
mypy failed to narrow down union types including
Self
withisinstance
.To Reproduce
Consider the following code:
Expected Behavior
Other should be infered as an
int
and mypy reports no error.Actual Behavior
mypy failed to narrow type of
other
Also, mypy reports the following error.
Your Environment
--follow-imports=silent --ignore-missing-imports --show-column-numbers --no-pretty
(VSCode defaults)mypy.ini
(and other config files): NoneThe text was updated successfully, but these errors were encountered: