Bug Report
mypy applies type checks when passing an unpacked tuple to a function, but it seems to skip the checks when passing a variable that is a union of tuple types.
To Reproduce
def inner(_name: str, _num: int) -> None: ... # mypy passes as expected def fun1(name_and_num: tuple[str, int]) -> None: inner(*name_and_num) # mypy errors as expected def fun2(name_and_num: tuple[str, float]) -> None: inner(*name_and_num) # mypy passes *but should error* def fun3(name_and_num: tuple[str, int] | tuple[str, float]) -> None: inner(*name_and_num)
https://gist.github.com/mypy-play/257f0a56dd44b405b2853e2854333cc2
Expected Behavior
arg-type error on line 14
Actual Behavior
No error on line 14
Your Environment
Looks like *name_and_num in fun3 is revealed to be tuple[Any, ...]
Activity
sobolevn commented on Aug 28, 2023
Looks like *name_and_num in fun3 is revealed to be tuple[Any, ...]