@@ -278,7 +278,7 @@ def infer_constraints(
278278 actual : Type ,
279279 direction : int ,
280280 skip_neg_op : bool = False ,
281- can_have_union_overlaping : bool = True ,
281+ can_have_union_overlapping : bool = True ,
282282) -> list [Constraint ]:
283283 """Infer type constraints.
284284
@@ -318,15 +318,15 @@ def infer_constraints(
318318 res = _infer_constraints (template , actual , direction , skip_neg_op )
319319 type_state .inferring .pop ()
320320 return res
321- return _infer_constraints (template , actual , direction , skip_neg_op , can_have_union_overlaping )
321+ return _infer_constraints (template , actual , direction , skip_neg_op , can_have_union_overlapping )
322322
323323
324324def _infer_constraints (
325325 template : Type ,
326326 actual : Type ,
327327 direction : int ,
328328 skip_neg_op : bool ,
329- can_have_union_overlaping : bool = True ,
329+ can_have_union_overlapping : bool = True ,
330330) -> list [Constraint ]:
331331 orig_template = template
332332 template = get_proper_type (template )
@@ -380,11 +380,11 @@ def _infer_constraints(
380380 if direction == SUPERTYPE_OF and isinstance (actual , UnionType ):
381381 res = []
382382
383- def _can_have_overlaping (_item : Type , _actual : UnionType ) -> bool :
384- # There is a special overlaping case, where we have a Union of where two types
383+ def _can_have_overlapping (_item : Type , _actual : UnionType ) -> bool :
384+ # There is a special overlapping case, where we have a Union of where two types
385385 # are the same, but one of them contains the other.
386386 # For example, we have Union[Sequence[T], Sequence[Sequence[T]]]
387- # In this case, only the second one can have overlaping because it contains the other.
387+ # In this case, only the second one can have overlapping because it contains the other.
388388 # So, in case of list[list[int]], second one would be chosen.
389389 if isinstance (p_item := get_proper_type (_item ), Instance ) and p_item .args :
390390 other_items = [o_item for o_item in _actual .items if o_item is not a_item ]
@@ -411,7 +411,7 @@ def _can_have_overlaping(_item: Type, _actual: UnionType) -> bool:
411411 orig_template ,
412412 a_item ,
413413 direction ,
414- can_have_union_overlaping = _can_have_overlaping (a_item , actual ),
414+ can_have_union_overlapping = _can_have_overlapping (a_item , actual ),
415415 )
416416 )
417417 return res
@@ -435,8 +435,8 @@ def _can_have_overlaping(_item: Type, _actual: UnionType) -> bool:
435435 # type variables indeterminate. This helps with some special
436436 # cases, though this isn't very principled.
437437
438- def _is_item_overlaping_actual_type (_item : Type ) -> bool :
439- # Overlaping occurs when we have a Union where two types are
438+ def _is_item_overlapping_actual_type (_item : Type ) -> bool :
439+ # Overlapping occurs when we have a Union where two types are
440440 # compatible and the more generic one is chosen.
441441 # For example, in Union[T, Sequence[T]], we have to choose
442442 # Sequence[T] if actual type is list[int].
@@ -456,7 +456,7 @@ def _is_item_overlaping_actual_type(_item: Type) -> bool:
456456 for t_item in [
457457 item
458458 for item in template .items
459- if not (can_have_union_overlaping and _is_item_overlaping_actual_type (item ))
459+ if not (can_have_union_overlapping and _is_item_overlapping_actual_type (item ))
460460 ]
461461 ],
462462 eager = False ,
0 commit comments