Closed
Description
Well, I have found another bug with union math in overloads, this time false negative:
from typing import Union, overload
@overload
def f(x: int, y: int) -> int: ...
@overload
def f(x: object, y: str) -> str: ...
def f(x):
pass
x: Union[int, str]
y: Union[int, str]
f(x, y) # passes, but should fail because it never matches (str, int)
The problem is that make_simplified_union
is used. On one hand this allows us to do unioning in more scenarios, on other hand it is dangerous for union counting in unioned args. I am not sure what to do. @Michael0x2a could you take care of this? (This is however not urgent, since this is a false negative.)