Skip to content

Commit 3ef78e8

Browse files
committed
fix
1 parent 4cc6db9 commit 3ef78e8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

mypy/join.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,11 +172,12 @@ def join_instances_via_supertype(self, t: Instance, s: Instance) -> ProperType:
172172
# Go over both sets of bases in case there's an explicit Protocol base. This is important
173173
# to ensure commutativity of join (although in cases where both classes have relevant
174174
# Protocol bases this maybe might still not be commutative)
175-
base_types: dict[TypeInfo, None] = {}
175+
base_types: dict[TypeInfo, None] = {} # dict to deduplicate but preserve order
176176
for base in t.type.bases:
177177
base_types[base.type] = None
178178
for base in s.type.bases:
179-
base_types[base.type] = None
179+
if is_subtype(t, base):
180+
base_types[base.type] = None
180181

181182
best: ProperType | None = None
182183
for base_type in base_types:

0 commit comments

Comments
 (0)