Skip to content

Commit 5057f82

Browse files
committed
Ensure errors persist after dmypy update
Before this change, if a module was removed with `update` in the `FineGrainedBuildManager`, then some errors would not re-appear. This change ensures that three types of error are maintained when running `reprocess_nodes`: - possibly undefined vars - unused ignores - ignores without codes By adding targets to ErrorInfos, this also fixes an issue where unused ignore and ignores without codes errors didn't get re-processed when they were the only issue in the file. Fixes #9655
1 parent cb61a61 commit 5057f82

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

mypy/errors.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,6 +668,8 @@ def generate_unused_ignore_errors(self, file: str) -> None:
668668
False,
669669
False,
670670
False,
671+
origin=(self.file, [line]),
672+
target=self.target_module,
671673
)
672674
self._add_error_info(file, info)
673675

@@ -720,6 +722,8 @@ def generate_ignore_without_code_errors(
720722
False,
721723
False,
722724
False,
725+
origin=(self.file, [line]),
726+
target=self.target_module,
723727
)
724728
self._add_error_info(file, info)
725729

mypy/server/update.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,6 +1028,10 @@ def key(node: FineGrainedDeferredNode) -> int:
10281028
if graph[module_id].type_checker().check_second_pass():
10291029
more = True
10301030

1031+
graph[module_id].detect_possibly_undefined_vars()
1032+
graph[module_id].generate_unused_ignore_notes()
1033+
graph[module_id].generate_ignore_without_code_notes()
1034+
10311035
if manager.options.export_types:
10321036
manager.all_types.update(graph[module_id].type_map())
10331037

0 commit comments

Comments
 (0)