Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mypy/typeops.py
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ def _remove_redundant_union_items(items: list[Type], keep_erased: bool) -> list[
continue

if is_proper_subtype(
proper_ti, tj, keep_erased_types=keep_erased, ignore_promotions=True
ti, tj, keep_erased_types=keep_erased, ignore_promotions=True
):
duplicate_index = j
break
Expand Down
14 changes: 14 additions & 0 deletions test-data/unit/check-recursive-types.test
Original file line number Diff line number Diff line change
Expand Up @@ -923,3 +923,17 @@ def dummy() -> None:
pass
reveal_type(bar) # N: Revealed type is "def [T <: builtins.dict[builtins.str, builtins.dict[builtins.str, builtins.str]]] (x: T`-1) -> T`-1"
[builtins fixtures/dict.pyi]

[case testAliasRecursiveUnpackMultiple]
from typing import Tuple, TypeVar, Optional

T = TypeVar("T")
S = TypeVar("S")

A = Tuple[T, S, Optional[A[T, S]]]
x: A[int, str]

*_, last = x
if last is not None:
reveal_type(last) # N: Revealed type is "Tuple[builtins.int, builtins.str, Union[Tuple[builtins.int, builtins.str, Union[..., None]], None]]"
[builtins fixtures/tuple.pyi]