KEMBAR78
Start propagating end columns/lines through for `type-arg` errors by A5rocks · Pull Request #18533 · python/mypy · GitHub
Skip to content

Conversation

A5rocks
Copy link
Collaborator

@A5rocks A5rocks commented Jan 26, 2025

Fixes #18531

It feels like this is a completely unsupported case given how major elements of mypy such as semanal don't pass through end columns/lines. Is this intentional? If so I'm fine closing this PR/the relevant issue as not planned.

@A5rocks A5rocks added the topic-error-reporting How we report errors label Jan 26, 2025
@A5rocks
Copy link
Collaborator Author

A5rocks commented Jan 26, 2025

@ilevkivskyi you said in #17535 (comment) that you would like to get rid of using types as error contexts. I assume this means this PR is a step in the wrong direction: what exactly should happen instead?

(At the very least I don't think there's something else with the necessary information to improve --pretty's output like this.)

(... reading through the issue, is there a reason why error context can't just include the file? it would be a bit more memory but otherwise seems like a fine solution)

@github-actions
Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

sphinx (https://github.com/sphinx-doc/sphinx)
- sphinx/search/__init__.py:198: error: Name "nodes.meta" is not defined  [name-defined]
+ sphinx/search/__init__.py:198:11: error: Name "nodes.meta" is not defined  [name-defined]

pywin32 (https://github.com/mhammond/pywin32)
- win32/Lib/win32timezone.py:913: error: Name "winreg._KeyType" is not defined  [name-defined]
+ win32/Lib/win32timezone.py:913:29: error: Name "winreg._KeyType" is not defined  [name-defined]
- win32/Lib/win32timezone.py:920: error: Name "winreg._KeyType" is not defined  [name-defined]
+ win32/Lib/win32timezone.py:920:19: error: Name "winreg._KeyType" is not defined  [name-defined]

@ilevkivskyi
Copy link
Member

I assume this means this PR is a step in the wrong direction: what exactly should happen instead?

Not necessarily, I think this is a meaningful quick fix. Long term type annotations (essentially what UnboundTypes are) should be part of syntax tree. While actual types should have a base class that doesn't inherit from Context. TBH I didn't thought it through yet, but this is a rough idea.

@ilevkivskyi ilevkivskyi merged commit 82f4e88 into python:master Jan 27, 2025
18 checks passed
@A5rocks A5rocks deleted the end-columns-are-good-1 branch January 27, 2025 23:16
x612skm pushed a commit to x612skm/mypy-dev that referenced this pull request Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic-error-reporting How we report errors

Projects

None yet

Development

Successfully merging this pull request may close these issues.

type-arg errors are over a larger node than necessary

2 participants