diff --git a/mypy/build.py b/mypy/build.py index 344221a3cfcc0..aad8b3a58e98a 100644 --- a/mypy/build.py +++ b/mypy/build.py @@ -1669,10 +1669,6 @@ def is_fresh(self) -> bool: def is_interface_fresh(self) -> bool: return self.externally_same - def has_new_submodules(self) -> bool: - """Return if this module has new submodules after being loaded from a warm cache.""" - return self.meta is not None and self.child_modules != set(self.meta.child_modules) - def mark_as_rechecked(self) -> None: """Marks this module as having been fully re-analyzed by the type-checker.""" self.manager.rechecked_modules.add(self.id) @@ -2405,11 +2401,6 @@ def load_graph(sources: List[BuildSource], manager: BuildManager, if dep in st.suppressed: st.suppressed.remove(dep) st.dependencies.append(dep) - for id, g in graph.items(): - if g.has_new_submodules(): - g.parse_file() - g.fix_suppressed_dependencies(graph) - g.mark_interface_stale() return graph diff --git a/mypy/server/update.py b/mypy/server/update.py index e74e01738a221..6bdd9c3057fa5 100644 --- a/mypy/server/update.py +++ b/mypy/server/update.py @@ -399,8 +399,9 @@ def ensure_trees_loaded(manager: BuildManager, graph: Dict[str, State], """Ensure that the modules in initial and their deps have loaded trees.""" to_process = find_unloaded_deps(manager, graph, initial) if to_process: - manager.log_fine_grained("Calling process_fresh_modules on set of size {} ({})".format( - len(to_process), to_process)) + if is_verbose(manager): + manager.log_fine_grained("Calling process_fresh_modules on set of size {} ({})".format( + len(to_process), sorted(to_process))) process_fresh_modules(graph, to_process, manager) diff --git a/test-data/unit/check-incremental.test b/test-data/unit/check-incremental.test index 6856afc9400d0..acc0413c7f238 100644 --- a/test-data/unit/check-incremental.test +++ b/test-data/unit/check-incremental.test @@ -946,7 +946,8 @@ from parent import b [file parent/b.py.2] -[stale parent, parent.a, parent.b] +[stale parent.a, parent.b] +[rechecked parent, parent.a, parent.b] [case testIncrementalReferenceExistingFileWithImportFrom] from parent import a, b diff --git a/test-data/unit/fine-grained-modules.test b/test-data/unit/fine-grained-modules.test index 21777daf656ee..c59e61fadf93e 100644 --- a/test-data/unit/fine-grained-modules.test +++ b/test-data/unit/fine-grained-modules.test @@ -436,6 +436,18 @@ main:1: error: Cannot find module named 'p.q' main:1: note: (Perhaps setting MYPYPATH or using the "--ignore-missing-imports" flag would help) == +[case testDeleteSubpackageWithNontrivialParent1] +[file p/__init__.py] +def g() -> None: + pass +[file p/b.py.2] +def foo() -> None: pass +foo() +[delete p/b.py.3] +[out] +== +== + [case testDeleteModuleWithError] import a [file a.py]