Skip to content

Commit b10d540

Browse files
authored
Fixes corner case for comparing nested overloads (python#9259)
This is for a 3rd party plugin: dry-python/returns#410 - Closes python#9147 - Closes python#8978
1 parent 781caff commit b10d540

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

mypy/subtypes.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,10 @@ def visit_overloaded(self, left: Overloaded) -> bool:
399399
return True
400400
return False
401401
elif isinstance(right, Overloaded):
402+
if left == self.right:
403+
# When it is the same overload, then the types are equal.
404+
return True
405+
402406
# Ensure each overload in the right side (the supertype) is accounted for.
403407
previous_match_left_index = -1
404408
matched_overloads = set()

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy