Skip to content

Commit 7a45523

Browse files
committed
Ad hoc fix to allow comparison of two unpacked types in overload
Currently, mypy crashes at comparison of two overloads that use unpacking on unbounded tuple types. This adds an ad hoc fix by adding the correspond check in the function and instead compares the two wrapped inner types that are unpacked. See mypy issue python#17319: python#17319
1 parent 93dac05 commit 7a45523

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

mypy/meet.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,9 @@ def _type_object_overlap(left: Type, right: Type) -> bool:
547547
# Note: it's unclear however, whether returning False is the right thing
548548
# to do when inferring reachability -- see https://github.com/python/mypy/issues/5529
549549

550+
if isinstance(left, UnpackType) and isinstance(right, UnpackType):
551+
return _is_overlapping_types(left.type, right.type)
552+
550553
assert type(left) != type(right), f"{type(left)} vs {type(right)}"
551554
return False
552555

0 commit comments

Comments
 (0)