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. ✅

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