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
Certain order of union members causes Incompatible types error #3085
I’m getting this weird error: Incompatible types in assignment (expression has type Dict[str, Union[str, float]], variable has type Dict[str, Union[str, int, float, bool]])
Another observation that looks related is this incorrect error message for the last statement of the following example. The last statement should cause Incompatible types and it does:
Activity
gvanrossum commentedon Mar 30, 2017
Might have been fixed by #3025, which got rolled back for other reasons.
Stiivi commentedon Mar 30, 2017
Another observation that looks related is this incorrect error message for the last statement of the following example. The last statement should cause Incompatible types and it does:
However the error is showing wrong types:
(indented for better demonstration)
The first union (expression type) in the error should have five elements – it is missing
int.JelleZijlstra commentedon Mar 30, 2017
That's probably also something deciding that int is compatible with float, so
Union[float, int]== float.ilevkivskyi commentedon Mar 30, 2017
I think this is essentially a duplicate of #1850
JukkaL commentedon Mar 30, 2017
This should be fixed by #3025 (I'll need to double check) and yes, this looks like a duplicate of #1850 so I'm closing this now.