@@ -1409,25 +1409,29 @@ def semantic_analysis_pass_three(self) -> None:
1409
1409
if self .options .dump_type_stats :
1410
1410
dump_type_stats (self .tree , self .xpath )
1411
1411
1412
- def type_check (self ) -> None :
1412
+ def type_check_first_pass (self ) -> None :
1413
1413
manager = self .manager
1414
1414
if self .options .semantic_analysis_only :
1415
1415
return
1416
1416
with self .wrap_context ():
1417
- type_checker = TypeChecker (manager .errors , manager .modules , self .options ,
1418
- self .tree , self .xpath )
1419
- type_checker .check_first_pass ()
1420
- type_checker .check_second_pass ()
1421
- manager .all_types .update (type_checker .type_map )
1417
+ self .type_checker = TypeChecker (manager .errors , manager .modules , self .options ,
1418
+ self .tree , self .xpath )
1419
+ self .type_checker .check_first_pass ()
1420
+
1421
+ def type_check_second_pass (self ) -> None :
1422
+ manager = self .manager
1423
+ with self .wrap_context ():
1424
+ self .type_checker .check_second_pass ()
1425
+ manager .all_types .update (self .type_checker .type_map )
1422
1426
1423
1427
if self .options .incremental :
1424
- self ._patch_indirect_dependencies (type_checker .module_refs ,
1425
- type_checker .type_map )
1428
+ self ._patch_indirect_dependencies (self . type_checker .module_refs ,
1429
+ self . type_checker .type_map )
1426
1430
1427
1431
if self .options .dump_inference_stats :
1428
1432
dump_type_stats (self .tree , self .xpath , inferred = True ,
1429
- typemap = type_checker .type_map )
1430
- manager .report_file (self .tree , type_checker .type_map )
1433
+ typemap = self . type_checker .type_map )
1434
+ manager .report_file (self .tree , self . type_checker .type_map )
1431
1435
1432
1436
def _patch_indirect_dependencies (self ,
1433
1437
module_refs : Set [str ],
@@ -1736,7 +1740,10 @@ def process_stale_scc(graph: Graph, scc: List[str]) -> None:
1736
1740
for id in scc :
1737
1741
graph [id ].semantic_analysis_pass_three ()
1738
1742
for id in scc :
1739
- graph [id ].type_check ()
1743
+ graph [id ].type_check_first_pass ()
1744
+ for id in scc :
1745
+ graph [id ].type_check_second_pass ()
1746
+ for id in scc :
1740
1747
graph [id ].write_cache ()
1741
1748
graph [id ].mark_as_rechecked ()
1742
1749
0 commit comments