@@ -324,3 +324,25 @@ p(bar, 1, "a", 3.0) # OK
324324p(bar, 1, "a", 3.0, kwarg="asdf") # OK
325325p(bar, 1, "a", "b") # E: Argument 1 to "foo" has incompatible type "Callable[[int, str, float], None]"; expected "Callable[[int, str, str], None]"
326326[builtins fixtures/dict.pyi]
327+
328+ [case testFunctoolsPartialUnion]
329+ import functools
330+ from typing import Any, Callable, Union
331+
332+ cls1: Any
333+ cls2: Union[Any, Any]
334+ reveal_type(functools.partial(cls1, 2)()) # N: Revealed type is "Any"
335+ reveal_type(functools.partial(cls2, 2)()) # N: Revealed type is "Any"
336+
337+ fn1: Union[Callable[[int], int], Callable[[int], int]]
338+ reveal_type(functools.partial(fn1, 2)()) # N: Revealed type is "builtins.int"
339+
340+ fn2: Union[Callable[[int], int], Callable[[int], str]]
341+ reveal_type(functools.partial(fn2, 2)()) # N: Revealed type is "builtins.object"
342+
343+ fn3: Union[Callable[[int], int], str]
344+ reveal_type(functools.partial(fn3, 2)()) # E: "str" not callable \
345+ # E: "Union[Callable[[int], int], str]" not callable \
346+ # N: Revealed type is "builtins.int" \
347+ # E: Argument 1 to "partial" has incompatible type "Union[Callable[[int], int], str]"; expected "Callable[..., int]"
348+ [builtins fixtures/tuple.pyi]
0 commit comments