Skip to content

Check self type variable bounds for overloads#21652

Open
thesammyagent wants to merge 1 commit into
python:masterfrom
thesammyagent:ci/issue-21646-list-sort-self-type-overload
Open

Check self type variable bounds for overloads#21652
thesammyagent wants to merge 1 commit into
python:masterfrom
thesammyagent:ci/issue-21646-list-sort-self-type-overload

Conversation

@thesammyagent

@thesammyagent thesammyagent commented Jun 29, 2026

Copy link
Copy Markdown

Fixes #21646.

Summary

  • re-check inferred explicit self type variables against their bounds when filtering overload items by receiver type
  • add a focused regression for list[int | None].sort() and [2, None].sort()
  • keep key-based sorting and comparable zero-argument sorting accepted

Tests

Automated local verification ran:

  • PATH="$PWD/.venv/bin:$PATH" ./.venv/bin/python runtests.py check-selftype.test check-overloading.test
    • check-selftype.test: 120 passed
    • check-overloading.test: 269 passed, 1 skipped
  • PATH="$PWD/.venv/bin:$PATH" pytest mypy/test/testcheck.py::TypeCheckSuite::check-selftype.test mypy/test/testcheck.py::TypeCheckSuite::check-overloading.test
    • 389 passed, 1 skipped
  • git diff --check
  • git diff --cached --check

AI assistance disclosure

This PR was produced by an automated AI-agent workflow. The workflow investigated the issue, drafted the focused patch and regression test, ran automated local verification, and performed automated review passes before submission.

Workflow provenance: the AI-agent workflow/software is created and operated by @thesammygit.

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

Labels

None yet

2 participants