@@ -296,7 +296,7 @@ def get_local_defns(
296296) -> tuple [
297297 dict [str , Any ],
298298 dict [
299- str , types .FunctionType | classmethod | staticmethod | WrappedOverloaded
299+ str , types .FunctionType | classmethod | staticmethod | WrappedOverloads
300300 ],
301301]:
302302 from typemap .typing import GenericCallable
@@ -334,8 +334,8 @@ def get_local_defns(
334334 # XXX: This is totally wrong; we still need to do
335335 # substitute in class vars
336336 local_fn = stuff
337- elif overloaded := _is_overloaded_function (stuff ):
338- local_fn = overloaded
337+ elif overloads := typing . get_overloads (stuff ):
338+ local_fn = WrappedOverloads ( tuple ( overloads ))
339339
340340 # If we got stuck, we build a GenericCallable that
341341 # computes the type once it has been given type
@@ -380,20 +380,8 @@ def lam(*vs):
380380
381381
382382@dataclasses .dataclass (frozen = True )
383- class WrappedOverloaded :
384- functions : tuple [types .FunctionType , ...]
385-
386-
387- def _is_overloaded_function (func ):
388- module_overload_registry = typing ._overload_registry [func .__module__ ]
389- if not module_overload_registry :
390- return None
391-
392- func_overload_registry = module_overload_registry [func .__qualname__ ]
393- if not func_overload_registry :
394- return
395-
396- return WrappedOverloaded (tuple (func_overload_registry .values ()))
383+ class WrappedOverloads :
384+ functions : tuple [typing .Callable [..., Any ], ...]
397385
398386
399387def flatten_class_new_proto (cls : type ) -> type :
0 commit comments