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
(馃巵) Perform 'union math' on non overloaded calls聽#13493
What's happening here is that union_overload_result, which is intended for when a call with a union would match multiple overload parts, is matching twice against the same overload, resulting is a more accurate return type.
changed the title [-](馃悶) Generics behave differently on overloads compared to single functions[/-][+](馃巵) Perform 'union math' on non overloaded calls[/+]on Aug 24, 2022
Revealed type is "builtins.list[Union[builtins.int, builtins.str]]"
But this is by accident, because in your example T = int | str is a valid solution for T even without union math. But in general I agree that we may want to use union math more eagerly if it results in a more precise type.
Activity
[-](馃悶) Generics behave differently on overloads compared to single functions[/-][+](馃巵) Perform 'union math' on non overloaded calls[/+]ilevkivskyi commentedon Feb 9, 2025
Both examples now infer this:
But this is by accident, because in your example
T = int | stris a valid solution forTeven without union math. But in general I agree that we may want to use union math more eagerly if it results in a more precise type.KotlinIsland commentedon Feb 19, 2025
i updated the op