(🐞) Column marker for `for` target is wrong, it's where the `for` keyword is, not where the target is
Open
Nobody has claimed this yet.
bug
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
from typing import Any
b: Any
for a in b:
...
if True:
for a in b:
...
Expected
> mypy test.py
test.py:4:5: error: Expression has type "Any" [no-any-expr]
for a in b:
^
test.py:8:9: error: Expression has type "Any" [no-any-expr]
for a in b:
^
Found 2 errors in 1 file (checked 1 source file)
Actual
> mypy test.py
test.py:4:1: error: Expression has type "Any" [no-any-expr]
for a in b:
^
test.py:8:5: error: Expression has type "Any" [no-any-expr]
for a in b:
^
Found 2 errors in 1 file (checked 1 source file)
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
Reproduce the issue with the Python snippet and compare the reported caret positions for both top-level and nested for loops. Trace the diagnostic location handling for the for target, then verify that the caret points under the target expression in both cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100