pyright
pyright copied to clipboard
Overlapping overload error changes depending on type name
This discussion uncovered an apparent bug. If the class mpz is renamed i (or any name beginning with a character prior to i), the overlapping overload error disappears.
I suspect this is partly explained by the sorting algorithm used internally by pyright for unions. Since the type is being unioned with int, a name that comes prior to int will result in i | int versus int | mpz. The ordering of a union should not matter when it comes to assignability, so there's some other bug involved here — probably in the logic for determining whether one union is assignable to another union when using special "overlapping overload" rules, which differ somewhat from normal assignability rules.