From 80af2b904815882e3aa9cd37688bda81e9f84ce0 Mon Sep 17 00:00:00 2001 From: LordBaryhobal Date: Mon, 22 Jun 2026 14:44:51 +0200 Subject: [PATCH] fix(checker): handle is_subtype of TypeVar --- midas/checker/registry.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) 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)