-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Fix disappearing errors when re-running dmypy check #14835
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
Changes from all commits
b4569fa
1831cbd
6094fc4
eac851b
5bfb6b5
3d8d2b7
520f8e8
6c14e7d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -667,6 +667,8 @@ def restore(ids: list[str]) -> None: | |
state.type_check_first_pass() | ||
state.type_check_second_pass() | ||
state.detect_possibly_undefined_vars() | ||
state.generate_unused_ignore_notes() | ||
state.generate_ignore_without_code_notes() | ||
t2 = time.time() | ||
state.finish_passes() | ||
t3 = time.time() | ||
|
@@ -1027,6 +1029,10 @@ def key(node: FineGrainedDeferredNode) -> int: | |
if graph[module_id].type_checker().check_second_pass(): | ||
more = True | ||
|
||
graph[module_id].detect_possibly_undefined_vars() | ||
graph[module_id].generate_unused_ignore_notes() | ||
graph[module_id].generate_ignore_without_code_notes() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that it may be more correct to only perform these after the end of a build increment, after we've propagated all changes. After a call of @ilevkivskyi What do you think? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know TBH, I thought we clear those "intermediate" errors. So I guess we may clear them for some reason? If yes, this should be fixed. But if we fixing that is hard, then yes, we can delay generating these errors. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi both -- thank you for your comments on this. Apologies for not addressing your points before. I've re-opened this PR (with some minor changes to address a regression) in #15043, and I'd appreciate your feedback there. In particular, I'd really welcome your thoughts on what should be done to address the comments you left here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FWIW, I have removed these three lines from the new PR. |
||
|
||
if manager.options.export_types: | ||
manager.all_types.update(graph[module_id].type_map()) | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: I haven't added a call to
finish_passes()
here. I'm not sure what it does... should it be here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so, since
finish_passes
seems to only perform things related to non-fine-grained builds.I think that there may be another issue here:
detect_possible_undefined_vars()
is somewhat expensive, as it runs over the entire file. In this function it would be better to only analyze the nodes that are being processed. For example, we could pass the set of targets todetect_possibly_undefined_vars
, and it would only catch errors in these targets. I'm not sure if processing the entire file causes correctness issues, but plausibly it could.