Fix bug with dmypy not respecting @no_type_check after change in dependency - #21626
thomasbbrunner wants to merge 1 commit into
Conversation
|
@ilevkivskyi I cannot assign a reviewer for this PR. What's the process here? Just wait for a contributor to pick this up? |
|
According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅ |
|
We keep hitting this issue in our codebases, would be great to get the fix merged. What's the process for getting an MR reviewed? |
|
As per our policy we don't accept LLM generated PRs from new contributors. |
This is not what your contributor's guide says (I read it before submitting this PR). If this is your policy in practice, you should update the guide. I wouldn't have bothered with this PR if I knew this. This is not a "Claude, find a bug and submit" type of PR. This is a bug my team and I face every day in our codebase. I vouch for the code here and the repro is clear. Either way, it seems there's no interest in fixing this, which is yet another reason for us to migrate to a different type checker. |
Currently, in daemon mode, the body of a
@no_type_checkfunction is type-checked anyway when the function is reprocessed because a type-check-dependency changed. This is even the case if the @no_type_check function isn't changed at all.This leads to false positives, where mypy flags typing issues in a function that is not supposed to be type checked.
Other similar typing decorators are already correctly handled in the code. In this PR, I'm proposing to do the same for
typing.no_type_check.Moreover, this adds a fine-grained regression test.
Reproduction
To reproduce the bug described above:
b.SCALEtriggers a reprocess ofa.func. Even though the function is still decorated with@no_type_check, it gets type checked:Disclaimer
I've read the contributor guide. This was really hard to debug, so I've employed an LLM to come up with a reproduction, find the bug in the mypy codebase and implement a fix. I've reviewed the generated code and I'm happy with its quality. Happy to iterate over the code.