@@ -20,8 +20,18 @@ open Delayed
2020let rec signature :
2121 Cpath. module_ -> ?canonical :Cpath.module_ -> Signature.t -> Signature.t =
2222 fun prefix ?canonical sg ->
23+ let sg', strengthened_modules = sig_items prefix ?canonical sg in
24+ (* Format.eprintf "Invalidating modules: %a\n%!" (Format.pp_print_list Ident.fmt) strengthened_modules; *)
25+ let substs =
26+ List. fold_left
27+ (fun s mid -> Subst. path_invalidate_module (mid :> Ident.path_module ) s)
28+ Subst. identity strengthened_modules
29+ in
30+ Subst. signature substs sg'
31+
32+ and sig_items prefix ?canonical sg =
2333 let open Signature in
24- let items, strengthened_modules =
34+ let items, ids =
2535 List. fold_left
2636 (fun (items , s ) item ->
2737 match item with
@@ -51,19 +61,15 @@ let rec signature :
5161 type_decl (`Dot (prefix, Ident.Name. type_ id)) (get t)) )
5262 :: items,
5363 s )
64+ | Include i ->
65+ let i', strengthened = include_ prefix i in
66+ (Include i' :: items, strengthened @ s)
5467 | Exception _ | TypExt _ | Value _ | External _ | Class _ | ClassType _
55- | Include _ | ModuleSubstitution _ | TypeSubstitution _ | Comment _
56- | Open _ ->
68+ | ModuleSubstitution _ | TypeSubstitution _ | Comment _ | Open _ ->
5769 (item :: items, s))
5870 ([] , [] ) sg.items
5971 in
60- (* Format.eprintf "Invalidating modules: %a\n%!" (Format.pp_print_list Ident.fmt) strengthened_modules; *)
61- let substs =
62- List. fold_left
63- (fun s mid -> Subst. path_invalidate_module (mid :> Ident.path_module ) s)
64- Subst. identity strengthened_modules
65- in
66- Subst. signature substs { sg with items = List. rev items }
72+ ({ sg with items = List. rev items }, ids)
6773
6874and module_ :
6975 ?canonical :Cpath. module_ ->
@@ -109,3 +115,8 @@ and type_decl : Cpath.type_ -> TypeDecl.t -> TypeDecl.t =
109115 }
110116 in
111117 { t with equation }
118+
119+ and include_ : Cpath.module_ -> Include.t -> Include.t * Ident.module_ list =
120+ fun path i ->
121+ let expansion_, strengthened = sig_items path i.expansion_ in
122+ ({ i with expansion_; strengthened = Some path }, strengthened)
0 commit comments