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
Support basic union math for overloaded functions #4576
I think this idea appeared in context of other issues (mostly related to strict optional), but I hit this few times in another context. Consider this example:
Dictable=Union[Dict[str, str], Iterable[Tuple[str, str]]]
defdo(arg: Dictable) ->None:
converted=dict(arg) # mypy errors here, although this is valid
The problem is that dict.__init__ is defined as an overload. I think we should at least support matching simple cases like:
@overloaddeffun(x: A) ->B: ...
@overloaddeffun(x: C) ->D: ...
arg: Union[A, C]
fun(arg) # we infer Union[B, D]
Activity
Adds support for basic union math with overloads
Adds support for basic union math with overloads
Adds support for basic union math with overloads
Adds support for basic union math with overloads
Adds support for basic union math with overloads
Relax union math logic to allow signatures with different arg kinds
Relax union math logic to allow signatures with different arg kinds
Relax union math logic to allow signatures with different arg kinds
Relax union math logic to allow signatures with different arg kinds (#…
Michael0x2a commentedon Jul 3, 2018
I believe this is now fixed after a combination of #5255 and #5222.