File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -5245,6 +5245,18 @@ def visit_callable_type(self, t: CallableType) -> bool:
52455245 return False
52465246 return super ().visit_callable_type (t )
52475247
5248+ def visit_type_var (self , t : TypeVarType ) -> bool :
5249+ default = [t .default ] if t .has_default () else []
5250+ return self .query_types ([t .upper_bound , * default ] + t .values )
5251+
5252+ def visit_param_spec (self , t : ParamSpecType ) -> bool :
5253+ default = [t .default ] if t .has_default () else []
5254+ return self .query_types ([t .upper_bound , * default ])
5255+
5256+ def visit_type_var_tuple (self , t : TypeVarTupleType ) -> bool :
5257+ default = [t .default ] if t .has_default () else []
5258+ return self .query_types ([t .upper_bound , * default ])
5259+
52485260
52495261def has_coroutine_decorator (t : Type ) -> bool :
52505262 """Whether t came from a function decorated with `@coroutine`."""
Original file line number Diff line number Diff line change @@ -548,6 +548,12 @@ def new_unification_variable(cls, old: Self) -> Self:
548548 new_id = TypeVarId .new (meta_level = 1 )
549549 return old .copy_modified (id = new_id )
550550
551+ def has_default (self ) -> bool :
552+ return not (
553+ isinstance (self .default , AnyType )
554+ and self .default .type_of_any == TypeOfAny .from_omitted_generics
555+ )
556+
551557
552558class TypeVarType (TypeVarLikeType ):
553559 """Type that refers to a type variable."""
You can’t perform that action at this time.
0 commit comments