Open Michael0x2a opened 6 years ago
I should work on this, if I will find the time.
@elazarg -- sounds good to me!
(I added myself mostly out of a sense of obligation, since the TODOs were a fallout of my operator refactors. But I also don't know when I'll find the time to do this, so feel free to tackle this whenever.)
@Michael0x2a - sorry, I can't seem to find the time to do that.
@elazarg -- no worries, I'm also in the same boat.
The current implementation for checking reversible operators contains two kludges that seem to be related to operators, metaclasses, and Type[...]
This call to has_member feels like it ought to be unnecessary/redundant due to the following
analyze_member_access
-- but removing it causes pythoneval's OpMetaclassAccess test case to fail.(Note: if you remove just that call, you also need to add in a
elif isinstance(member, AnyTyp): return None
after callinganalyze_member_access
)If the reversible operators logic was unable to find a matching operator, it just tries calling
check_call
on the name directly to get back some generic error message. It seems as if this call ought to always return an error message, but sometimes it surprisingly will not. E.g. see the TypeTypeComparisonWorks tests in check-classes -- adding anassert local_errors.is_errors()
causes that test case to crash.This feels related to the first TODO in some way -- either we're not handling operators + metaclasses + Type directly, or there are some weird shenanigans happening due to
Any
...For additional context, see https://github.com/python/mypy/issues/5136 and https://github.com/python/mypy/pull/1806.