Skip to content

Commit 65e00ff

Browse files
committed
Refactor: replace make_simplified_union with UnionType.make_union in meet.py (#8624)
This commit replaces all calls to make_simplified_union with UnionType.make_union in this file, as part of the codebase modernization effort in issue #8624.
1 parent 4ad5492 commit 65e00ff

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

mypy/meet.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def narrow_declared_type(declared: Type, narrowed: Type) -> Type:
127127
if declared == narrowed:
128128
return original_declared
129129
if isinstance(declared, UnionType):
130-
return make_simplified_union(
130+
return UnionType.make_union(
131131
[
132132
narrow_declared_type(x, narrowed)
133133
for x in declared.relevant_items()
@@ -146,7 +146,7 @@ def narrow_declared_type(declared: Type, narrowed: Type) -> Type:
146146
# Quick check before reaching `is_overlapping_types`. If it's enum/literal overlap,
147147
# avoid full expansion and make it faster.
148148
assert isinstance(narrowed, UnionType)
149-
return make_simplified_union(
149+
return UnionType.make_union(
150150
[narrow_declared_type(declared, x) for x in narrowed.relevant_items()]
151151
)
152152
elif not is_overlapping_types(declared, narrowed, prohibit_none_typevar_overlap=True):
@@ -155,7 +155,7 @@ def narrow_declared_type(declared: Type, narrowed: Type) -> Type:
155155
else:
156156
return NoneType()
157157
elif isinstance(narrowed, UnionType):
158-
return make_simplified_union(
158+
return UnionType.make_union(
159159
[narrow_declared_type(declared, x) for x in narrowed.relevant_items()]
160160
)
161161
elif isinstance(narrowed, AnyType):
@@ -745,7 +745,7 @@ def visit_union_type(self, t: UnionType) -> ProperType:
745745
meets.append(meet_types(x, y))
746746
else:
747747
meets = [meet_types(x, self.s) for x in t.items]
748-
return make_simplified_union(meets)
748+
return UnionType.make_union(meets)
749749

750750
def visit_none_type(self, t: NoneType) -> ProperType:
751751
if state.strict_optional:

0 commit comments

Comments
 (0)