fix(checker): handle is_subtype of TypeVar
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user