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:
5245
5245
return False
5246
5246
return super ().visit_callable_type (t )
5247
5247
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
+
5248
5260
5249
5261
def has_coroutine_decorator (t : Type ) -> bool :
5250
5262
"""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:
548
548
new_id = TypeVarId .new (meta_level = 1 )
549
549
return old .copy_modified (id = new_id )
550
550
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
+
551
557
552
558
class TypeVarType (TypeVarLikeType ):
553
559
"""Type that refers to a type variable."""
You can’t perform that action at this time.
0 commit comments