diff --git a/midas/checker/registry.py b/midas/checker/registry.py index 606c268..8259b93 100644 --- a/midas/checker/registry.py +++ b/midas/checker/registry.py @@ -133,6 +133,16 @@ class TypesRegistry: case (_, UnknownType()): return True + case (TypeVar(bound=bound), _): + if bound is None: + return False + return self.is_subtype(bound, type2) + + case (_, TypeVar(bound=bound)): + if bound is None: + return True + return self.is_subtype(type1, bound) + case (AliasType(type=base1), _): return self.is_subtype(base1, type2) @@ -150,11 +160,6 @@ class TypesRegistry: case (Function(), Function()): return self.is_func_subtype(type1, type2) - case (TypeVar(bound=bound), _): - if bound is None: - return False - return self.is_subtype(bound, type2) - case (ConstraintType(type=base1), _): return self.is_subtype(base1, type2)