[ty] Infer typevar specializations for implicit generic protocols (#21902)
We now infer specializations that involve generic protocols. This
includes recursing into the methods of the protocol, matching up the
signatures of the class's methods with the signatures of the protocol,
and adding bindings for any typevars that appear in the protocol
signatures.
This required several performance updates, which were pulled out and
merged as separate PRs. There is still a performance and memory hit, but
I think a reasonable one, given the new functionality that this opens
up.
There are still some ecosystem false positives that relate to how this
interacts with overload resolution, but I plan to tackle that in
follow-on PRs.
---------
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>