Skip to content
Open
Changes from 1 commit
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
13 changes: 9 additions & 4 deletions mypy/join.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,15 @@ def visit_erased_type(self, t: ErasedType) -> ProperType:
return self.s

def visit_type_var(self, t: TypeVarType) -> ProperType:
if isinstance(self.s, TypeVarType) and self.s.id == t.id:
if self.s.upper_bound == t.upper_bound:
return self.s
return self.s.copy_modified(upper_bound=join_types(self.s.upper_bound, t.upper_bound))
if isinstance(self.s, TypeVarType):
if self.s.id == t.id:
if self.s.upper_bound == t.upper_bound:
return self.s
return self.s.copy_modified(
upper_bound=join_types(self.s.upper_bound, t.upper_bound)
)
# Fix non-commutative joins
return get_proper_type(join_types(self.s.upper_bound, t.upper_bound))
else:
return self.default(self.s)

Expand Down