Skip to content

Conversation

@randolf-scholz
Copy link
Contributor

Fixes #20720

  • added a new flag --strict-overload-subtyping:

    Require subtype overload order to match supertype overload order.

    when this flag is not set then subtypes can change the overload order compared to supertypes.

  • added a test based on the cases in Relax default overload subtyping checks #20720

This is a first round proof of concept to see what the primer finds.
A possible refinement is to only allow overload order swapping if the supertype comes from a Protocol. But I am not quite sure if its always possible to easily tell if that's the case.

@randolf-scholz randolf-scholz force-pushed the relax_overload_subtyping branch from ff95659 to e5b2785 Compare February 2, 2026 20:04
@github-actions
Copy link
Contributor

github-actions bot commented Feb 3, 2026

Diff from mypy_primer, showing the effect of this PR on open source code:

pywin32 (https://github.com/mhammond/pywin32)
+ win32/Lib/win32timezone.py:1160: error: Unused "type: ignore" comment  [unused-ignore]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Relax default overload subtyping checks

1 participant