Skip to content

Commit b6abcbb

Browse files
simplification
1 parent 52b5a53 commit b6abcbb

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

mypy/join.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,6 @@ def join_instances(self, t: Instance, s: Instance) -> ProperType:
6969
# Simplest case: join two types with the same base type (but
7070
# potentially different arguments).
7171

72-
last_known_value = (
73-
None if t.last_known_value != s.last_known_value else t.last_known_value
74-
)
75-
7672
# Combine type arguments.
7773
args: list[Type] = []
7874
# N.B: We use zip instead of indexing because the lengths might have
@@ -145,7 +141,8 @@ def join_instances(self, t: Instance, s: Instance) -> ProperType:
145141
new_type = join_types(ta, sa, self)
146142
assert new_type is not None
147143
args.append(new_type)
148-
result: ProperType = Instance(t.type, args, last_known_value=last_known_value)
144+
lkv = t.last_known_value if t.last_known_value == s.last_known_value else None
145+
result: ProperType = Instance(t.type, args, last_known_value=lkv)
149146
elif t.type.bases and is_proper_subtype(
150147
t, s, subtype_context=SubtypeContext(ignore_type_params=True)
151148
):

0 commit comments

Comments
 (0)