You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
from __future__ import annotations
from plum import dispatch
from typing import TypeVar, Type
T=TypeVar('T')
class A:
@dispatch
def f(self, x:Type[T])->int:
return 1
@dispatch
def f(self, x:int, y:int)->int:
return 2
A().f(int)
This gives me
/tmp/PythonVenvs/geniusweb1targz/lib/python3.8/site-packages/plum/type.py:215: UserWarning: Could not resolve the type hint of `~T`. I have ended the resolution here to not make your code break, but some types might not be working correctly. Please open an issue at https://github.com/wesselb/plum.
return tuple(resolve_type_hint(arg) for arg in x)
/tmp/PythonVenvs/geniusweb1targz/lib/python3.8/site-packages/plum/resolver.py:269: MethodRedefinitionWarning: `Method(function_name='f', signature=Signature(typing.Any, int, int), return_type=<class 'int'>, impl=<function A.f at 0x7fec7ec40af0>)` overwrites the earlier definition `Method(function_name='f', signature=Signature(typing.Any, int, int), return_type=<class 'int'>, impl=<function A.f at 0x7fec7ecd6af0>)`.
warnings.warn(
This looks incorrect to me. The f;s have different number of arguments so there can never be an ambiguity
The text was updated successfully, but these errors were encountered:
The error message may change slightly, if I run it now I get only the first :
/tmp/PythonVenvs/geniusweb1targz/lib/python3.8/site-packages/plum/type.py:215: UserWarning: Could not resolve the type hint of `~T`. I have ended the resolution here to not make your code break, but some types might not be working correctly. Please open an issue at https://github.com/wesselb/plum.
return tuple(resolve_type_hint(arg) for arg in x)
1
Not sure what this "type hint of ~T " means or why it's a problem.
This gives me
This looks incorrect to me. The f;s have different number of arguments so there can never be an ambiguity
The text was updated successfully, but these errors were encountered: