We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ece4d41 commit 47ebf8dCopy full SHA for 47ebf8d
1 file changed
mypy/join.py
@@ -297,10 +297,15 @@ def visit_erased_type(self, t: ErasedType) -> ProperType:
297
return self.s
298
299
def visit_type_var(self, t: TypeVarType) -> ProperType:
300
- if isinstance(self.s, TypeVarType) and self.s.id == t.id:
301
- if self.s.upper_bound == t.upper_bound:
302
- return self.s
303
- 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
304
+ return self.s.copy_modified(
305
+ upper_bound=join_types(self.s.upper_bound, t.upper_bound)
306
+ )
307
+ # Fix non-commutative joins
308
+ return get_proper_type(join_types(self.s.upper_bound, t.upper_bound))
309
else:
310
return self.default(self.s)
311
0 commit comments