diff --git a/src/services/inference/merge_service.ml b/src/services/inference/merge_service.ml index 064c6d08a89..19074e5aff4 100644 --- a/src/services/inference/merge_service.ml +++ b/src/services/inference/merge_service.ml @@ -168,6 +168,7 @@ let merge_strict_component ~options (component: filename list) = let cx = List.hd component_cxs in let errors = Context.errors cx in Context.remove_all_errors cx; + Context.clear_intermediates cx; Context_cache.add_sig ~audit:Expensive.ok cx; file, errors ) diff --git a/src/typing/context.ml b/src/typing/context.ml index a21d9338a7d..ac905d94e77 100644 --- a/src/typing/context.ml +++ b/src/typing/context.ml @@ -263,6 +263,11 @@ let set_type_graph cx type_graph = let set_tvar cx id node = cx.graph <- IMap.add id node cx.graph +let clear_intermediates cx = + Hashtbl.clear cx.type_table; + Hashtbl.clear cx.annot_table; + cx.all_unresolved <- IMap.empty + (* constructors *) let make_property_map cx pmap = let id = Reason.mk_id () in diff --git a/src/typing/context.mli b/src/typing/context.mli index b2242b20dc6..7cb1e961f12 100644 --- a/src/typing/context.mli +++ b/src/typing/context.mli @@ -116,5 +116,7 @@ val set_module_exports_type: t -> module_exports_type -> unit val set_property_maps: t -> Type.properties IMap.t -> unit val set_tvar: t -> Constraint.ident -> Constraint.node -> unit +val clear_intermediates: t -> unit + (* constructors *) val make_property_map: t -> Type.properties -> Constraint.ident