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
type of Union containing Any is incorrectly inferred after an isinstance check #1720
file1.py: note: In function "func":
file1.py:8: error: Revealed type is 'Union[file1.B, file1.C]'
file1.py:10: error: Revealed type is 'file1.B'
file1.py:13: error: Revealed type is 'Union[<ERROR>, <ERROR>]'
file1.py:14: error: Some element of union has no attribute "name"
On that second case: inheriting from Any is illegal (though it can happen legally when you inherit from a class whose import is suppressed by --silent-imports).
Activity
[-]isinstance with Any fails[/-][+]type of Union containing Any is incorrectly inferred after an isinstance check[/+]ddfisher commentedon Jun 23, 2016
In addition to being a Union[Any, ...] -> Any problem, I think this is at least vaguely related to #1691.
sharmaeklavya2 commentedon Jun 26, 2016
Another case where I found this error is when 2 classes inherit from
Any:file1.py:gives this output:
It works fine when I replace
Anybyobject.gvanrossum commentedon Jul 13, 2016
On that second case: inheriting from Any is illegal (though it can happen legally when you inherit from a class whose import is suppressed by
--silent-imports).