Skip to content

Commit fa65250

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 6094fc4 commit fa65250

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, None),
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, None),
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
@@ -1027,6 +1027,10 @@ def key(node: FineGrainedDeferredNode) -> int:
10271027
if graph[module_id].type_checker().check_second_pass():
10281028
more = True
10291029

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

0 commit comments

Comments
 (0)