Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: preserve generator error context #18161

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bzoracler
Copy link
Contributor

@bzoracler bzoracler commented Nov 18, 2024

Fixes #12498.

The callable return type's line number is preserved across dmypy run invocations, while the callable type is not.

The reporting context imitates the following:

mypy/mypy/checker.py

Lines 1210 to 1212 in 8ef2197

self.fail(
message_registry.RETURN_TYPE_CANNOT_BE_CONTRAVARIANT, typ.ret_type
)

That didn't work - trying again with the function definition context...

This comment has been minimized.

Copy link
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.

dmypy: Line number disappears when invoking multiple times
1 participant