Skip to content

Conversation

@lsrafael13
Copy link

This PR replaces calls to make_simplified_union with the more modern UnionType.make_union across several files, as part of the cleanup and modernization discussed in issue #8624.

This change does not modify behavior but standardizes the way union types are created in the type system, improving code consistency.

Affected files:

  • binder.py
  • checker.py
  • checkexpr.py
  • checkmember.py
  • checkpattern.py
  • erasetype.py
  • meet.py
  • mypy/plugins/attrs.py
  • mypy/plugins/ctypes.py
  • mypy/plugins/default.py
  • mypy/plugins/enums.py
  • semanal_shared.py
  • suggestions.py
  • typeops.py

lsrafael13 and others added 15 commits May 4, 2025 17:09
…binder.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.
…checker.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.
…checkexpr.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.
…checkmember.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.
…checkpattern.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.
…erasetype.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.
…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.
…plugins/attrs.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.
…plugins/ctypes.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.
…plugins/default.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.
…plugins/enums.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.
…semanal_shared.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.
…typeops.py (#8624)

This commit replaces all calls to make_simplified_union with UnionType.make_union in typeops.py, as part of the codebase modernization and consistency improvements proposed in issue #8624.
…suggestions.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.
@sterliakov
Copy link
Collaborator

Okay, was this generated by some LLM? That's not the difference between UnionType.make_union and make_simplified_union - the former is a fast factory while the latter is a deep check that produces a minimal union (such that no item in the returned union is a subtype of some other item).

lsrafael13 and others added 3 commits May 4, 2025 18:18
This commit fixes code formatting issues automatically using `ruff --fix` and `black .` as recommended by the Mypy maintainers.
@hauntsaninja hauntsaninja added the pending Issues that may be closed label May 4, 2025
@lsrafael13
Copy link
Author

I'm closing this PR after realizing that UnionType.make_union is not a safe drop-in replacement for make_simplified_union.
These two functions serve different purposes:
make_simplified_union simplifies unions by removing subtypes and redundancies.
UnionType.make_union is a fast constructor that skips simplification.
My initial intention was to help with the refactoring proposed in issue #8624, but I misunderstood the functional difference.
Thank you for the feedback — it helped me better understand the internals of mypy. I’ll be more careful in future contributions.

@lsrafael13 lsrafael13 closed this May 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pending Issues that may be closed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants