Skip to content

Commit

Permalink
fix: avoid unnecessary union members when proposed type is current ty…
Browse files Browse the repository at this point in the history
…pe (without crashing pattern matching)
  • Loading branch information
tyralla committed Apr 5, 2024
1 parent 325f190 commit bb63532
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mypy/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -7581,7 +7581,10 @@ def _get_instance_path_from_current_to_proposed(
break

# Transfer the current type's type variable argument or type variable tuple arguments:
if (pos2 is not None) and isinstance(proposed_args[pos2], (AnyType, UnpackType)):
if (
(pos2 is not None) and
isinstance(get_proper_type(proposed_args[pos2]), (AnyType, UnpackType))
):
if current.type.has_type_var_tuple_type:
assert (prefix := current.type.type_var_tuple_prefix) is not None
assert (suffix := current.type.type_var_tuple_suffix) is not None
Expand Down

0 comments on commit bb63532

Please sign in to comment.