mypy
a8b6d6f7 - Fix inference of protocol against overloaded function (#12227)

Commit
4 years ago
Fix inference of protocol against overloaded function (#12227) We used to infer a callable in a protocol against all overload items. This could result in incorrect results, if only one of the overload items would actually match the protocol. Fix the issue by only considering the first matching overload item. This seems to help with protocols involving `__getitem__`. In particular, this fixes regressions related to `SupportsLenAndGetItem`, which is used for `random.choice`.
Author
Parents
Loading