|
10 | 10 | from mypy.literals import Key, literal, literal_hash, subkeys |
11 | 11 | from mypy.nodes import Expression, IndexExpr, MemberExpr, NameExpr, RefExpr, TypeInfo, Var |
12 | 12 | from mypy.subtypes import is_same_type, is_subtype |
13 | | -from mypy.typeops import make_simplified_union |
14 | 13 | from mypy.types import ( |
15 | 14 | AnyType, |
16 | 15 | Instance, |
@@ -238,22 +237,8 @@ def update_from_options(self, frames: list[Frame]) -> bool: |
238 | 237 | type = AnyType(TypeOfAny.from_another_any, source_any=declaration_type) |
239 | 238 | else: |
240 | 239 | for other in resulting_values[1:]: |
241 | | - |
242 | 240 | assert other is not None |
243 | | - |
244 | | - if ( |
245 | | - isinstance(t1 := get_proper_type(type), TupleType) |
246 | | - and isinstance(t2 := get_proper_type(other.type), TupleType) |
247 | | - and (len(l1 := t1.items) == len(l2 := t2.items)) |
248 | | - and (find_unpack_in_list(l1) is None) |
249 | | - and (find_unpack_in_list(l2) is None) |
250 | | - ): |
251 | | - type = t1.copy_modified( |
252 | | - items=[make_simplified_union([i1, i2]) for i1, i2 in zip(l1, l2)] |
253 | | - ) |
254 | | - else: |
255 | | - type = make_simplified_union([type, other.type]) |
256 | | - |
| 241 | + type = join_simple(self.declarations[key], type, other.type) |
257 | 242 | # Try simplifying resulting type for unions involving variadic tuples. |
258 | 243 | # Technically, everything is still valid without this step, but if we do |
259 | 244 | # not do this, this may create long unions after exiting an if check like: |
|
0 commit comments