Skip to content

Commit 2f1264b

Browse files
committed
fix meet
1 parent 6a4df2b commit 2f1264b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

mypy/meet.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,15 @@ def meet_types(s: Type, t: Type) -> ProperType:
9090
return t
9191

9292
if not isinstance(s, UnboundType) and not isinstance(t, UnboundType):
93+
swap = isinstance(s, Instance) and not isinstance(t, Instance)
94+
if swap:
95+
s, t = t, s
9396
if is_proper_subtype(s, t, ignore_promotions=True):
9497
return s
9598
if is_proper_subtype(t, s, ignore_promotions=True):
9699
return t
100+
if swap:
101+
s, t = t, s
97102

98103
if isinstance(s, ErasedType):
99104
return s

0 commit comments

Comments
 (0)