nebius/SWE-rebench-V2-PRs huggingface dataset:
Repository: quora/pyanalyze
Pull request #345 (2021-12-19 03:06:12)

Get signatures for MethodWrapperType


Patch:
diff --git a/docs/changelog.md b/docs/changelog.md
index 3bdb390..97b1cb4 100644
--- a/docs/changelog.md
+++ b/docs/changelog.md
@@ -2,6 +2,8 @@
 
 ## Unreleased
 
+- Infer signatures for method wrapper objects (bound methods
+  of builtin types) (#345)
 - Allow storing type narrowing constraints in variables (#343)
 - The first argument to `__new__` and `__init_subclass`
   does not need to be `self` (#342)
diff --git a/pyanalyze/arg_spec.py b/pyanalyze/arg_spec.py
index d9c02c5..eb541f9 100644
--- a/pyanalyze/arg_spec.py
+++ b/pyanalyze/arg_spec.py
@@ -16,6 +16,7 @@ from .safe import (
     safe_in,
     safe_issubclass,
     is_typing_name,
+    safe_isinstance,
 )
 from .stacked_scopes import Composite, uniq_chain
 from .signature import (
@@ -56,6 +57,9 @@ from types import FunctionType, ModuleType
 from typing import Any, Sequence, Generic, Iterable, Mapping, Optional, Union
 import typing_inspect
 
+# types.MethodWrapperType in 3.7+
+MethodWrapperType = type(object().__str__)
+
 
 @used  # exposed as an API
 @contextlib.contextmanager
@@ -365,6 +369,18 @@ class ArgSpecCache:
                 # some cythonized methods have __self__ but it is not a function
                 pass
 
+        if safe_isinstance(obj, MethodWrapperType):
+            try:
+                unbound = getattr(obj.__objclass__, obj.__name__)
+            except Exception:
+                pass
+            else:
+                sig = self._cached_get_argspec(
+                    unbound, impl, is_asynq, in_overload_resolution
+                )
+                if sig is not None:
+                    return make_bound_method(sig, Composite(KnownValue(obj.__self__)))
+
         # for bound methods, see if we have an argspec for the unbound method
         if inspect.ismethod(obj) and obj.__self__ is not None:
             argspec = self._cached_get_argspec(


Test patch:
diff --git a/pyanalyze/test_arg_spec.py b/pyanalyze/test_arg_spec.py
index 5271edd..6555ab8 100644
--- a/pyanalyze/test_arg_spec.py
+++ b/pyanalyze/test_arg_spec.py
@@ -380,3 +380,16 @@ class TestNamedTuple(TestNameCheckVisitorBase):
             CustomNew("x")  # E: incompatible_argument
             cn = CustomNew(a=3)
             assert_is_value(cn, TypedValue(CustomNew))
+
+
+class TestBuiltinMethods(TestNameCheckVisitorBase):
+    @assert_passes()
+    def test_method_wrapper(self):
+        import collections.abc
+
+        def capybara():
+            r = range(10)
+            assert_is_value(r, KnownValue(range(10)))
+            assert_is_value(
+                r.__iter__(), GenericValue(collections.abc.Iterator, [TypedValue(int)])
+            )
Repository: quora/pyanalyze
Pull request #346 (2021-12-19 03:12:50)

improve Iterable inference


Patch:
diff --git a/docs/changelog.md b/docs/changelog.md
index 97b1cb4..3f23318 100644
--- a/docs/changelog.md
+++ b/docs/changelog.md
@@ -2,6 +2,7 @@
 
 ## Unreleased
 
+- Improve type compatibility between generics and literals (#346)
 - Infer signatures for method wrapper objects (bound methods
   of builtin types) (#345)
 - Allow storing type narrowing constraints in variables (#343)
diff --git a/pyanalyze/value.py b/pyanalyze/value.py
index 3427a09..448434f 100644
--- a/pyanalyze/value.py
+++ b/pyanalyze/value.py
@@ -50,7 +50,7 @@ from typing_extensions import Literal, Protocol
 import pyanalyze
 from pyanalyze.extensions import CustomCheck
 
-from .safe import all_of_type, safe_issubclass
+from .safe import all_of_type, safe_issubclass, safe_isinstance
 
 T = TypeVar("T")
 # __builtin__ in Python 2 and builtins in Python 3
@@ -585,7 +585,7 @@ class TypedValue(Value):
             if (
                 isinstance(other.typ, TypedValue)
                 and isinstance(self.typ, type)
-                and isinstance(other.typ.typ, self.typ)
+                and safe_isinstance(other.typ.typ, self.typ)
             ):
                 return {}
             elif isinstance(other.typ, (TypeVarValue, AnyValue)):
@@ -734,6 +734,8 @@ class GenericValue(TypedValue):
 
     def can_assign(self, other: Value, ctx: CanAssignContext) -> CanAssign:
         other = replace_known_sequence_value(other)
+        if isinstance(other, KnownValue):
+            other = TypedValue(type(other.val))
         if isinstance(other, TypedValue) and not isinstance(other.typ, super):
             generic_args = other.get_generic_args_for_type(self.typ, ctx)
             # If we don't think it's a generic base, try super;


Test patch:
diff --git a/pyanalyze/test_typeshed.py b/pyanalyze/test_typeshed.py
index 1f5b69a..d1b53cd 100644
--- a/pyanalyze/test_typeshed.py
+++ b/pyanalyze/test_typeshed.py
@@ -10,7 +10,7 @@ import tempfile
 import time
 from typeshed_client import Resolver, get_search_context
 import typing
-from typing import Container, Dict, Generic, List, TypeVar, NewType, Union
+from typing import Dict, Generic, List, TypeVar, NewType, Union
 from urllib.error import HTTPError
 import urllib.parse
 
@@ -413,3 +413,14 @@ class TestAttribute:
     def test_http_error(self) -> None:
         tsf = TypeshedFinder(verbose=True)
         assert True is tsf.has_attribute(HTTPError, "read")
+
+
+class TestRange(TestNameCheckVisitorBase):
+    @assert_passes()
+    def test_iteration(self):
+        def capybara(r: range):
+            for j in r:
+                assert_is_value(j, TypedValue(int))
+
+            for i in range(10000000):
+                assert_is_value(i, TypedValue(int))
Repository: quora/pyanalyze
Pull request #350 (2021-12-19 22:02:19)

fix AbstractAsyncContextManager crash


Patch:
diff --git a/docs/changelog.md b/docs/changelog.md
index 139d6fa..63c751e 100644
--- a/docs/changelog.md
+++ b/docs/changelog.md
@@ -2,12 +2,13 @@
 
 ## Unreleased
 
+- Fix error on use of `AbstractAsyncContextManager` (#350)
 - Check `with` and `async with` statements (#344)
 - Improve type compatibility between generics and literals (#346)
 - Infer signatures for method wrapper objects (bound methods
   of builtin types) (#345)
 - Allow storing type narrowing constraints in variables (#343)
-- The first argument to `__new__` and `__init_subclass`
+- The first argument to `__new__` and `__init_subclass__`
   does not need to be `self` (#342)
 - Drop dependencies on `attrs` and `mypy_extensions` (#341)
 - Correct location of error for incompatible parameter (#339)
diff --git a/pyanalyze/typeshed.py b/pyanalyze/typeshed.py
index b76a8ca..fedfc0c 100644
--- a/pyanalyze/typeshed.py
+++ b/pyanalyze/typeshed.py
@@ -58,6 +58,12 @@ from typing_extensions import Protocol, TypedDict
 import typeshed_client
 from typed_ast import ast3
 
+try:
+    # 3.7+
+    from contextlib import AbstractAsyncContextManager
+except ImportError:
+    AbstractAsyncContextManager = None
+
 
 T_co = TypeVar("T_co", covariant=True)
 
@@ -177,7 +183,7 @@ class TypeshedFinder:
                 # too confusing, just hardcode it. Same for (Abstract)ContextManager.
                 if typ is AbstractSet:
                     return [GenericValue(Collection, (TypeVarValue(T_co),))]
-                if typ is AbstractContextManager:
+                if typ is AbstractContextManager or typ is AbstractAsyncContextManager:
                     return [GenericValue(Generic, (TypeVarValue(T_co),))]
                 if typ is Callable or typ is collections.abc.Callable:
                     return None


Test patch:
diff --git a/pyanalyze/test_typeshed.py b/pyanalyze/test_typeshed.py
index d1b53cd..3415e0c 100644
--- a/pyanalyze/test_typeshed.py
+++ b/pyanalyze/test_typeshed.py
@@ -267,6 +267,12 @@ class TestGetGenericBases:
             contextlib.AbstractContextManager,
             [int_tv],
         )
+        if sys.version_info >= (3, 7):
+            self.check(
+                {contextlib.AbstractAsyncContextManager: [int_tv]},
+                contextlib.AbstractAsyncContextManager,
+                [int_tv],
+            )
 
     def test_collections(self):
         int_tv = TypedValue(int)
Repository: quora/pyanalyze
Pull request #380 (2021-12-31 10:12:47)

fix nested async def


Patch:
diff --git a/docs/changelog.md b/docs/changelog.md
index 7e9a8f8..5b1d30a 100644
--- a/docs/changelog.md
+++ b/docs/changelog.md
@@ -2,6 +2,7 @@
 
 ## Unreleased
 
+- Fix inference for nested `async def` functions (#380)
 - Fix usage of type variables in function parameters
   with defaults (#378)
 - Support the Python 3.10 `match` statement (#376)
diff --git a/pyanalyze/functions.py b/pyanalyze/functions.py
index d8331ea..5ca1dd9 100644
--- a/pyanalyze/functions.py
+++ b/pyanalyze/functions.py
@@ -6,6 +6,7 @@ Code for understanding function definitions.
 from abc import abstractmethod
 import ast
 import asyncio
+import collections.abc
 import types
 import asynq
 import enum
@@ -316,6 +317,8 @@ def compute_value_of_function(
         result = info.return_annotation
     if result is None:
         result = AnyValue(AnySource.unannotated)
+    if isinstance(info.node, ast.AsyncFunctionDef):
+        result = GenericValue(collections.abc.Awaitable, [result])
     sig = Signature.make(
         [param_info.param for param_info in info.params],
         result,


Test patch:
diff --git a/pyanalyze/test_functions.py b/pyanalyze/test_functions.py
index 71f18b2..3400188 100644
--- a/pyanalyze/test_functions.py
+++ b/pyanalyze/test_functions.py
@@ -1,5 +1,5 @@
 # static analysis: ignore
-from .value import KnownValue, AnyValue, AnySource
+from .value import GenericValue, KnownValue, AnyValue, AnySource, TypedValue
 from .error_code import ErrorCode
 from .implementation import assert_is_value
 from .test_node_visitor import assert_passes, skip_before
@@ -35,7 +35,7 @@ class TestNestedFunction(TestNameCheckVisitorBase):
                     xs = ys
 
     @assert_passes()
-    def test_async(self):
+    def test_asynq(self):
         from asynq import asynq
         from typing_extensions import Literal
 
@@ -49,6 +49,18 @@ class TestNestedFunction(TestNameCheckVisitorBase):
             val = yield nested.asynq()
             assert_is_value(val, KnownValue(3))
 
+    @assert_passes()
+    def test_async_def(self):
+        import collections.abc
+
+        def capybara():
+            async def nested() -> int:
+                return 1
+
+            assert_is_value(
+                nested(), GenericValue(collections.abc.Awaitable, [TypedValue(int)])
+            )
+
     @assert_passes()
     def test_bad_decorator(self):
         def decorator(fn):
Repository: quora/pyanalyze
Pull request #381 (2021-12-31 15:54:18)

fix Callable/Annotated


Patch:
diff --git a/docs/changelog.md b/docs/changelog.md
index f2305a2..7f7ceb9 100644
--- a/docs/changelog.md
+++ b/docs/changelog.md
@@ -2,6 +2,8 @@
 
 ## Unreleased
 
+- Fix compatibility between `Callable` and `Annotated`
+  (#381)
 - Fix inference for nested `async def` functions (#380)
 - Fix usage of type variables in function parameters
   with defaults (#378)
diff --git a/pyanalyze/value.py b/pyanalyze/value.py
index 790e460..4991e3b 100644
--- a/pyanalyze/value.py
+++ b/pyanalyze/value.py
@@ -1186,7 +1186,7 @@ class CallableValue(TypedValue):
         return CallableValue(sig, self.typ)
 
     def can_assign(self, other: Value, ctx: CanAssignContext) -> CanAssign:
-        if not isinstance(other, (MultiValuedValue, AnyValue)):
+        if not isinstance(other, (MultiValuedValue, AnyValue, AnnotatedValue)):
             signature = ctx.signature_from_value(other)
             if signature is None:
                 return CanAssignError(f"{other} is not a callable type")


Test patch:
diff --git a/pyanalyze/test_annotations.py b/pyanalyze/test_annotations.py
index 1716399..2e29db1 100644
--- a/pyanalyze/test_annotations.py
+++ b/pyanalyze/test_annotations.py
@@ -1592,3 +1592,35 @@ class TestParamSpec(TestNameCheckVisitorBase):
             assert_is_value(
                 refined(), GenericValue(list, [AnyValue(AnySource.generic_argument)])
             )
+
+
+class TestCallable(TestNameCheckVisitorBase):
+    @assert_passes()
+    def test_compatibility(self):
+        from typing import Callable, TypeVar
+
+        T = TypeVar("T")
+
+        def want_callable(c: Callable[[int], T]) -> T:
+            return c(1)
+
+        def string_func(s: str) -> str:
+            return s
+
+        def capybara(unannotated, other):
+            assert_is_value(want_callable(lambda _: 3), KnownValue(3))
+            assert_is_value(
+                want_callable(unannotated), AnyValue(AnySource.generic_argument)
+            )
+            # generates an AnnotatedValue(MultiValuedValue(...))
+            assert_is_value(
+                want_callable(unannotated or other),
+                AnyValue(AnySource.generic_argument),
+            )
+
+            assert_is_value(
+                want_callable(string_func),  # E: incompatible_argument
+                AnyValue(AnySource.error),
+            )
+            want_callable(1)  # E: incompatible_argument
+            want_callable(int(unannotated))  # E: incompatible_argument
Repository: quora/pyanalyze
Pull request #382 (2021-12-31 16:01:06)

fix nested self


Patch:
diff --git a/docs/changelog.md b/docs/changelog.md
index 7f7ceb9..d491e86 100644
--- a/docs/changelog.md
+++ b/docs/changelog.md
@@ -2,6 +2,8 @@
 
 ## Unreleased
 
+- Fix incorrect inference of `self` argument on
+  some nested methods (#382)
 - Fix compatibility between `Callable` and `Annotated`
   (#381)
 - Fix inference for nested `async def` functions (#380)
diff --git a/pyanalyze/name_check_visitor.py b/pyanalyze/name_check_visitor.py
index 2e7b3f0..58f7da8 100644
--- a/pyanalyze/name_check_visitor.py
+++ b/pyanalyze/name_check_visitor.py
@@ -1553,8 +1553,11 @@ class NameCheckVisitor(node_visitor.ReplacingNodeVisitor):
         info = compute_function_info(
             node,
             self,
+            # If we set the current_class in the collecting phase,
+            # the self argument of nested methods with an unannotated
+            # first argument is incorrectly inferred.
             enclosing_class=TypedValue(self.current_class)
-            if self.current_class is not None
+            if self.current_class is not None and self._is_checking()
             else None,
             is_nested_in_class=self.node_context.includes(ast.ClassDef),
             potential_function=potential_function,


Test patch:
diff --git a/pyanalyze/test_functions.py b/pyanalyze/test_functions.py
index 3400188..233545d 100644
--- a/pyanalyze/test_functions.py
+++ b/pyanalyze/test_functions.py
@@ -82,6 +82,18 @@ class TestNestedFunction(TestNameCheckVisitorBase):
             inner.punare = 3
             assert_is_value(inner.punare, KnownValue(3))
 
+    @assert_passes()
+    def test_nested_in_method(self):
+        class Capybara:
+            def method(self):
+                def nested(arg) -> int:
+                    assert_is_value(arg, AnyValue(AnySource.unannotated))
+                    # Make sure we don't think this is an access to Capybara.numerator
+                    print(arg.numerator)
+                    return 1
+
+                assert_is_value(nested(1), TypedValue(int))
+
 
 class TestFunctionDefinitions(TestNameCheckVisitorBase):
     @assert_passes()
Repository: quora/pyanalyze
Pull request #397 (2022-01-11 13:47:17)

Fix compatibility between Union and Annotated


Patch:
diff --git a/docs/changelog.md b/docs/changelog.md
index bdf129a..bf480a6 100644
--- a/docs/changelog.md
+++ b/docs/changelog.md
@@ -2,6 +2,7 @@
 
 ## Unreleased
 
+- Fix compatibility between Union and Annotated (#397)
 - Fix potential incorrect inferred return value for
   unannotated functions (#396)
 - Fix compatibility between Thrift enums and TypeVars (#394)
diff --git a/pyanalyze/value.py b/pyanalyze/value.py
index afbbccf..4ccd703 100644
--- a/pyanalyze/value.py
+++ b/pyanalyze/value.py
@@ -1326,9 +1326,9 @@ class MultiValuedValue(Value):
     def can_assign(self, other: Value, ctx: CanAssignContext) -> CanAssign:
         if isinstance(other, TypeVarValue):
             other = other.get_fallback_value()
-        if isinstance(other, MultiValuedValue):
+        if is_union(other):
             tv_maps = []
-            for val in other.vals:
+            for val in flatten_values(other):
                 tv_map = self.can_assign(val, ctx)
                 if isinstance(tv_map, CanAssignError):
                     # Adding an additional layer here isn't helpful


Test patch:
diff --git a/pyanalyze/test_name_check_visitor.py b/pyanalyze/test_name_check_visitor.py
index 481e8e7..5168b50 100644
--- a/pyanalyze/test_name_check_visitor.py
+++ b/pyanalyze/test_name_check_visitor.py
@@ -2611,3 +2611,14 @@ class TestWalrus(TestNameCheckVisitorBase):
                     print(i)  # E: undefined_name
             """
         )
+
+
+class TestUnion(TestNameCheckVisitorBase):
+    @assert_passes()
+    def test_union_to_union(self):
+        from typing import Optional
+
+        def capybara(x: Optional[str], y: Optional[str]) -> Optional[str]:
+            assert_is_value(x, TypedValue(str) | KnownValue(None))
+            assert_is_value(y, TypedValue(str) | KnownValue(None))
+            return x or y
Repository: quora/pyanalyze
Pull request #400 (2022-01-11 23:09:13)

fix list[TypeVar]


Patch:
diff --git a/docs/changelog.md b/docs/changelog.md
index 1b65140..02c99b4 100644
--- a/docs/changelog.md
+++ b/docs/changelog.md
@@ -2,6 +2,8 @@
 
 ## Unreleased
 
+- Fix indexing a list with an index typed as a
+  `TypeVar` (#400)
 - Fix "This function should have an @asynq() decorator"
   false positive on lambdas (#399)
 - Fix compatibility between Union and Annotated (#397)
diff --git a/pyanalyze/implementation.py b/pyanalyze/implementation.py
index 4530caa..428aec5 100644
--- a/pyanalyze/implementation.py
+++ b/pyanalyze/implementation.py
@@ -346,6 +346,7 @@ def _sequence_getitem_impl(ctx: CallContext, typ: type) -> ImplReturn:
         self_value = replace_known_sequence_value(ctx.vars["self"])
         if not isinstance(self_value, TypedValue):
             return AnyValue(AnySource.error)  # shouldn't happen
+        key = replace_known_sequence_value(key)
         if not TypedValue(slice).is_assignable(key, ctx.visitor):
             key = ctx.visitor._check_dunder_call(
                 ctx.ast_for_arg("obj"), Composite(key), "__index__", [], allow_call=True


Test patch:
diff --git a/pyanalyze/test_implementation.py b/pyanalyze/test_implementation.py
index 5c90b12..8160f55 100644
--- a/pyanalyze/test_implementation.py
+++ b/pyanalyze/test_implementation.py
@@ -900,6 +900,14 @@ class TestSequenceGetItem(TestNameCheckVisitorBase):
             assert_is_value(tpl[-2], TypedValue(str))
             assert_is_value(tpl[2], TypedValue(float))
 
+    @assert_passes()
+    def test_list_in_lambda(self):
+        from typing import List
+
+        def capybara(words: List[str]):
+            sorted_indexes = sorted(range(len(words)), key=lambda i: words[i])
+            return sorted_indexes
+
 
 class TestDictGetItem(TestNameCheckVisitorBase):
     @assert_fails(ErrorCode.unhashable_key)
Repository: quora/pyanalyze
Pull request #446 (2022-01-27 03:00:07)

fix **kwargs: Never calls


Patch:
diff --git a/docs/changelog.md b/docs/changelog.md
index f57c089..156b8c1 100644
--- a/docs/changelog.md
+++ b/docs/changelog.md
@@ -2,6 +2,7 @@
 
 ## Unreleased
 
+- Treat `NoReturn` like `Any` in `**kwargs` calls (#446)
 - Improve error messages for overloaded calls (#445)
 - Infer `NoReturn` instead of `Any` for unreachable code (#443)
 - Make `NoReturn` compatible with all other types (#442)
diff --git a/pyanalyze/signature.py b/pyanalyze/signature.py
index ea16e44..09ab19e 100644
--- a/pyanalyze/signature.py
+++ b/pyanalyze/signature.py
@@ -1730,6 +1730,11 @@ def preprocess_args(
         elif label is KWARGS:
             items = {}
             extra_values = []
+            if arg.value is NO_RETURN_VALUE:
+                new_value = GenericValue(dict, [TypedValue(str), NO_RETURN_VALUE])
+                processed_args.append((Composite(new_value), KWARGS))
+                continue
+
             # We union all the kwargs that may be provided by any union member, so that
             # we give an error if
             for subval in flatten_values(arg.value, unwrap_annotated=True):


Test patch:
diff --git a/pyanalyze/test_never.py b/pyanalyze/test_never.py
index daca4c4..319ede7 100644
--- a/pyanalyze/test_never.py
+++ b/pyanalyze/test_never.py
@@ -50,3 +50,17 @@ class TestAssertNever(TestNameCheckVisitorBase):
                 print("str")
             else:
                 assert_never(x)
+
+
+class TestNeverCall(TestNameCheckVisitorBase):
+    @assert_passes()
+    def test_empty_list(self):
+        def callee(a: int):
+            pass
+
+        def capybara():
+            for args in []:
+                callee(*args)
+
+            for kwargs in []:
+                callee(**kwargs)
Repository: quora/pyanalyze
Pull request #454 (2022-01-31 01:51:10)

fix callable typevars


Patch:
diff --git a/docs/changelog.md b/docs/changelog.md
index f453a0f..8c51c02 100644
--- a/docs/changelog.md
+++ b/docs/changelog.md
@@ -2,6 +2,8 @@
 
 ## Unreleased
 
+- Fix treatment of `TypeVar` with bounds or constraints
+  as callables (#454)
 - Improve `TypeVar` solution algorithm (#453)
 - Cache decisions about whether classes implement protocols (#450)
 - Fix application of multiple suggested changes per file
diff --git a/pyanalyze/checker.py b/pyanalyze/checker.py
index 4036818..498343c 100644
--- a/pyanalyze/checker.py
+++ b/pyanalyze/checker.py
@@ -37,6 +37,7 @@ from .value import (
     AnyValue,
     CallableValue,
     KnownValueWithTypeVars,
+    MultiValuedValue,
     SubclassValue,
     TypeVarValue,
     TypedValue,
@@ -352,6 +353,20 @@ class Checker:
                 return ANY_SIGNATURE
         elif isinstance(value, AnyValue):
             return ANY_SIGNATURE
+        elif isinstance(value, MultiValuedValue):
+            sigs = [
+                self.signature_from_value(
+                    subval,
+                    get_return_override=get_return_override,
+                    get_call_attribute=get_call_attribute,
+                )
+                for subval in value.vals
+            ]
+            if all(sig is not None for sig in sigs):
+                # TODO we can't return a Union if we get here
+                return ANY_SIGNATURE
+            else:
+                return None
         else:
             return None
 


Test patch:
diff --git a/pyanalyze/test_typevar.py b/pyanalyze/test_typevar.py
index 2779b15..45a433e 100644
--- a/pyanalyze/test_typevar.py
+++ b/pyanalyze/test_typevar.py
@@ -230,3 +230,14 @@ class TestSolve(TestNameCheckVisitorBase):
 
         def take_union(seq: Union[Sequence[bytes], Sequence[str]]) -> None:
             take_seq(seq)
+
+    @assert_passes()
+    def test_call_with_value_restriction(self):
+        from typing import TypeVar, Callable, Union
+
+        CallableT = TypeVar("CallableT", Callable[..., str], Callable[..., int])
+        UnionT = TypeVar("UnionT", bound=Union[Callable[..., str], Callable[..., int]])
+
+        def capybara(c: CallableT, u: UnionT) -> None:
+            c(3)
+            u(3)