Skip to content

Fix TypeForm inference in union parameters - #21966

Open
LouisDeconinck wants to merge 1 commit into
python:masterfrom
LouisDeconinck:fix/typeform-union-inference-21964
Open

Fix TypeForm inference in union parameters#21966
LouisDeconinck wants to merge 1 commit into
python:masterfrom
LouisDeconinck:fix/typeform-union-inference-21964

Conversation

@LouisDeconinck

Copy link
Copy Markdown

Fixes #21964

Summary

  • Recognize type expressions passed to generic parameters whose type is a union containing TypeForm.
  • Erase type variables only for the recognition subtype check, preserving the original context for argument checking and inference.
  • Add a regression test for a TypeForm union parameter.

Tests

  • PATH=".venv/bin:$PATH" .venv/bin/python runtests.py check-typeform.test
  • PATH=".venv/bin:$PATH" .venv/bin/python -m mypy --config-file mypy_self_check.ini mypy/checkexpr.py
  • git diff --check

AI assistance: OpenAI Codex helped investigate and implement this change; I reviewed the final diff and tests.

@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

wolfgang-aura added a commit to wolfgang-aura/Mailman that referenced this pull request Sep 11, 2026
`--superseded-by` was stored and never shown, so an unfiled run overtaken
upstream read as plain `unsubmitted`. Two such runs are on disk: the starlette
fix superseded by Kludex/starlette#3498 and the mypy#21964 fix superseded by
python/mypy#21966, which the new competitor check found before filing.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

Type expression arguments aren't recognized as TypeForm when the parameter type is a union containing a TypeForm

1 participant