Skip to content
Closed
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
4 changes: 4 additions & 0 deletions mypy/subtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,10 @@ def visit_instance(self, left: Instance) -> bool:
or mapped.type.has_type_var_tuple_type
):
return True
# A NamedTuple Instance is a subtype of its own TupleType
# representation (they are two views of the same type).
if mapped.type.is_named_tuple and mapped.type is right.partial_fallback.type:
return True
return False
if isinstance(right, TypeVarTupleType):
# tuple[Any, ...] is like Any in the world of tuples (see special case above).
Expand Down
Loading