Skip to content

Commit d9fb485

Browse files
committed
Remove duplicate HasTypeVarQuery
1 parent 9405bfd commit d9fb485

File tree

2 files changed

+4
-17
lines changed

2 files changed

+4
-17
lines changed

mypy/checkexpr.py

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@
181181
get_proper_type,
182182
get_proper_types,
183183
has_recursive_types,
184+
has_type_vars,
184185
is_named_instance,
185186
split_with_prefix_and_suffix,
186187
)
@@ -6350,23 +6351,7 @@ def __init__(self) -> None:
63506351

63516352
def visit_callable_type(self, t: CallableType) -> bool:
63526353
# TODO: we need to check only for type variables of original callable.
6353-
return self.query_types(t.arg_types) or t.accept(HasTypeVarQuery())
6354-
6355-
6356-
class HasTypeVarQuery(types.BoolTypeQuery):
6357-
"""Visitor for querying whether a type has a type variable component."""
6358-
6359-
def __init__(self) -> None:
6360-
super().__init__(types.ANY_STRATEGY)
6361-
6362-
def visit_type_var(self, t: TypeVarType) -> bool:
6363-
return True
6364-
6365-
def visit_param_spec(self, t: ParamSpecType) -> bool:
6366-
return True
6367-
6368-
def visit_type_var_tuple(self, t: TypeVarTupleType) -> bool:
6369-
return True
6354+
return self.query_types(t.arg_types) or has_type_vars(t)
63706355

63716356

63726357
def has_erased_component(t: Type | None) -> bool:

mypy/types.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3612,6 +3612,8 @@ def visit_type_alias_type(self, typ: TypeAliasType) -> None:
36123612

36133613

36143614
class HasTypeVars(BoolTypeQuery):
3615+
"""Visitor for querying whether a type has a type variable component."""
3616+
36153617
def __init__(self) -> None:
36163618
super().__init__(ANY_STRATEGY)
36173619
self.skip_alias_target = True

0 commit comments

Comments
 (0)