Skip to content
Snippets Groups Projects
Commit 1fbd166c authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

Fixes for overload

parent 15cbfac6
No related branches found
No related tags found
No related merge requests found
__version__ = '2.24.1a6' __version__ = '2.24.1a7'
...@@ -35,14 +35,15 @@ class TypeSignature(inspect.Signature): ...@@ -35,14 +35,15 @@ class TypeSignature(inspect.Signature):
You can compare signatures: You can compare signatures:
>>> def a(a: object): >>> def a(y: object):
>>> pass >>> pass
>>> def b(a: int): >>> def b(y: int):
>>> pass >>> pass
>>> TypeSignature.from_fun(a) < TypeSignature(b) >>> TypeSignature.from_fun(a) < TypeSignature(b)
""" """
__slots__ = () __slots__ = ()
# pylint: disable=protected-access
def __init__(self, t_sign: inspect.Signature): def __init__(self, t_sign: inspect.Signature):
""" """
:param t_sign: a inspect.Signature :param t_sign: a inspect.Signature
...@@ -150,7 +151,7 @@ class overload: ...@@ -150,7 +151,7 @@ class overload:
for sign, fun in self.type_signatures_to_functions.items(): for sign, fun in self.type_signatures_to_functions.items():
if sign.matches(*args, **kwargs): if sign.matches(*args, **kwargs):
matching.append((sign, fun)) matching.append((sign, fun))
matching.sort() matching.sort() # This sorting should result in most precise class at the end of the list
if not matching: if not matching:
raise TypeError('No matching entries!') raise TypeError('No matching entries!')
else: else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment