diff --git a/mypy/sametypes.py b/mypy/sametypes.py index acb4e7c987c2b..d0e5866440c53 100644 --- a/mypy/sametypes.py +++ b/mypy/sametypes.py @@ -2,7 +2,7 @@ from mypy.types import ( Type, UnboundType, ErrorType, AnyType, NoneTyp, Void, TupleType, UnionType, CallableType, - TypeVarType, Instance, TypeVisitor, ErasedType, TypeList + TypeVarType, Instance, TypeVisitor, ErasedType, TypeList, Overloaded ) @@ -91,3 +91,9 @@ def visit_union_type(self, left: UnionType) -> bool: return is_same_types(left.items, cast(UnionType, self.right).items) else: return False + + def visit_overloaded(self, left: Overloaded) -> bool: + if isinstance(self.right, Overloaded): + return is_same_types(cast(List[Type], left.items()), cast(List[Type], cast(Overloaded, self.right).items())) + else: + return False