Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions mypy/server/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,8 @@ def restore(ids: list[str]) -> None:

# Find any other modules brought in by imports.
changed_modules = [(st.id, st.xpath) for st in new_modules]
for m in new_modules:
manager.import_map[m.id] = set(m.dependencies + m.suppressed)

# If there are multiple modules to process, only process one of them and return
# the remaining ones to the caller.
Expand Down
16 changes: 16 additions & 0 deletions test-data/unit/fine-grained-modules.test
Original file line number Diff line number Diff line change
Expand Up @@ -2244,3 +2244,19 @@ undefined
a.py:1: error: Cannot find implementation or library stub for module named "foobar"
a.py:1: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
==

[case testDaemonImportMapRefresh]
# cmd: mypy main.py
[file main.py]
[file main.py.2]
import a.b
reveal_type(a.b.foo())
[file a/__init__.pyi]
[file a/b.pyi]
import a.c
def foo() -> a.c.C: ...
[file a/c.pyi]
class C: ...
[out]
==
main.py:2: note: Revealed type is "a.c.C"