diff --git a/mypy/newsemanal/semanal_main.py b/mypy/newsemanal/semanal_main.py index 48fb7ea36c9d..3a60df68f85a 100644 --- a/mypy/newsemanal/semanal_main.py +++ b/mypy/newsemanal/semanal_main.py @@ -41,6 +41,7 @@ from mypy.errors import Errors from mypy.newsemanal.semanal_infer import infer_decorator_signature_if_simple from mypy.checker import FineGrainedDeferredNode +import mypy.build MYPY = False if MYPY: @@ -278,6 +279,11 @@ def semantic_analyze_target(target: str, analyzer.refresh_partial(refresh_node, patches, final_iteration) if isinstance(node, Decorator): infer_decorator_signature_if_simple(node, analyzer) + for dep in analyzer.imports: + state.dependencies.append(dep) + priority = mypy.build.PRI_LOW + if priority <= state.priorities.get(dep, priority): + state.priorities[dep] = priority if analyzer.deferred: return [target], analyzer.incomplete, analyzer.progress else: diff --git a/test-data/unit/check-newsemanal.test b/test-data/unit/check-newsemanal.test index 8dd3064bdb7b..f9bea2d6fd97 100644 --- a/test-data/unit/check-newsemanal.test +++ b/test-data/unit/check-newsemanal.test @@ -2020,3 +2020,18 @@ class C(Generic[T]): ... class A: ... class D: ... + +[case testNewAnalyzerAddedSubStarImport_incremental] +# TODO: This can be removed once testAddedSubStarImport is enabled in check-incremental.test. +# cmd: mypy -m a pack pack.mod b +# cmd2: mypy -m other +[file a.py] +from pack import * +[file pack/__init__.py] +[file pack/mod.py] +[file b.py] +import pack.mod +[file other.py] +import a +[out] +[out2]