coady / multimethod

Multiple argument dispatching.
https://coady.github.io/multimethod
Other
277 stars 24 forks source link

Custom generic types aren't recognized properly #49

Closed fedorpashin closed 3 years ago

fedorpashin commented 3 years ago

Consider this example:

from typing import TypeVar, Generic
from multimethod import multimethod

T = TypeVar('T')

class A(Generic[T]):
    pass

class B:
    pass

@multimethod
def func(a: A[B]):
    pass

func(A[B]())

It crashes with multimethod.DispatchError: ('func: 0 methods found', (<class '__main__.A'>,), []).

Whereas without the annotation everything works fine.