Skip to content

Reject plain Concatenate ellipsis annotations#21531

Open
puneetdixit200 wants to merge 1 commit into
python:masterfrom
puneetdixit200:fix/21425-concatenate-location
Open

Reject plain Concatenate ellipsis annotations#21531
puneetdixit200 wants to merge 1 commit into
python:masterfrom
puneetdixit200:fix/21425-concatenate-location

Conversation

@puneetdixit200
Copy link
Copy Markdown

Fixes #21425.

Summary:

  • route Concatenate through the operator path before generic alias handling
  • reject direct Concatenate[...] annotations when ParamSpec values are not valid in that location
  • add a regression case alongside the existing ParamSpec location checks

Testing:

  • python -m mypy -c "from typing import Concatenate; x: Concatenate[...]"
  • .venv/bin/python -m pytest mypy/test/testcheck.py::TypeCheckSuite::check-parameter-specification.test -q
  • .venv/bin/python -m mypy --config-file mypy_self_check.ini mypy/typeanal.py
  • .venv/bin/python runtests.py self
  • PATH="$PWD/.venv/bin:$PATH" .venv/bin/python runtests.py lint
  • git diff --check

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

Disallow plain Concatenate[...] as type hint

1 participant