Annotations in typing.Annotated are not checked
Open
Nobody has claimed this yet.
bug
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
Bug Report
To Reproduce
import typing_extensions as te
x: te.Annotated[int, Foobar] = 42
Expected Behavior
Mypy complains about Foobar not being defined. In other cases, e.g. when a function is called in an Annotated argument, it checks if the arguments passed to the function are valid (or number of arguments match, etc. etc.).
Actual Behavior
Mypy does not complain about Foobar not being defined.
Your Environment
- Mypy version used: 0.910
- Mypy command-line flags: n/a
- Mypy configuration options from
mypy.ini(and other config files): n/a - Python version used: 3.8.2
- Operating system and version: OSX
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the supplied Python reproducer and trace mypy's handling of typing_extensions.Annotated; the report names no source file or test. Done means the undefined Foobar annotation is diagnosed and the relevant Annotated cases are covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100