@@ -1474,6 +1474,9 @@ class State:
1474
1474
# Whether to ignore all errors
1475
1475
ignore_all = False
1476
1476
1477
+ # Whether the module has an error or any of its dependencies have one.
1478
+ transitive_error = False
1479
+
1477
1480
# Type checker used for checking this file. Use type_checker() for
1478
1481
# access and to construct this on demand.
1479
1482
_type_checker = None # type: Optional[TypeChecker]
@@ -1944,7 +1947,7 @@ def write_cache(self) -> None:
1944
1947
if self .manager .options .quick_and_dirty :
1945
1948
is_errors = self .manager .errors .is_errors_for_file (self .path )
1946
1949
else :
1947
- is_errors = self .manager . errors . is_errors ()
1950
+ is_errors = self .transitive_error
1948
1951
if is_errors :
1949
1952
delete_cache (self .id , self .path , self .manager )
1950
1953
self .meta = None
@@ -2257,6 +2260,10 @@ def process_graph(graph: Graph, manager: BuildManager) -> None:
2257
2260
else :
2258
2261
fresh_msg = "stale due to deps (%s)" % " " .join (sorted (stale_deps ))
2259
2262
2263
+ if any (graph [dep ].transitive_error for dep in deps if dep in graph ):
2264
+ for id in scc :
2265
+ graph [id ].transitive_error = True
2266
+
2260
2267
scc_str = " " .join (scc )
2261
2268
if fresh :
2262
2269
if not maybe_reuse_in_memory_tree (graph , scc , manager ):
@@ -2464,6 +2471,9 @@ def process_stale_scc(graph: Graph, scc: List[str], manager: BuildManager) -> No
2464
2471
for id in stale :
2465
2472
if graph [id ].type_check_second_pass ():
2466
2473
more = True
2474
+ if any (manager .errors .is_errors_for_file (graph [id ].path ) for id in stale ):
2475
+ for id in stale :
2476
+ graph [id ].transitive_error = True
2467
2477
for id in stale :
2468
2478
graph [id ].finish_passes ()
2469
2479
graph [id ].write_cache ()
0 commit comments