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
{{ message }}
Repository navigation
isinstance(x, (T1, T2)) won't narrow the type of x when NamedTuple is involved. #1914
1.py: note: In function "foo":
1.py:9: error: Some element of union has no attribute "x"
1.py:10: error: Incompatible types in assignment (expression has type "Union[A, B, C]", variable has type "Union[B, C]")
The error happens only when NamedTuple is involved. Otherwise the type of a is correctly narrowed to Union[B, C] inside the branch.
Activity
ddfisher commentedon Jul 21, 2016
This might be related to #1691.
Add test case
Add test case
Fixes to union simplification, isinstance and more (#3025)
Fixes to union simplification, isinstance and more (#3025)
Fixes to union simplification, isinstance and more (try 2) (#3086)