@@ -59,8 +59,8 @@ let parse_longident lid =
5959 with Parser_raw. Error -> None
6060
6161let lookup_module name env =
62- let path, md = Env. find_module_by_name name env in
63- (path, md.Types. md_type, md. Types . md_attributes)
62+ let path, md = Env. find_module_by_name_lazy name env in
63+ (path, md.md_type, md.md_attributes)
6464
6565let verbosity = ref Verbosity. default
6666
@@ -155,22 +155,22 @@ module Printtyp = struct
155155 let_ref verbosity v (fun () -> wrap_printing_env env f)
156156end
157157
158- let si_modtype_opt = function
159- | Types. Sig_modtype (_ , m , _ ) -> m.mtd_type
160- | Types. Sig_module (_ , _ , m , _ , _ ) -> Some m.md_type
158+ let si_modtype_opt : Subst.Lazy.signature_item -> _ = function
159+ | Sig_modtype (_ , m , _ ) -> m.mtd_type
160+ | Sig_module (_ , _ , m , _ , _ ) -> Some m.md_type
161161 | _ -> None
162162
163163(* Check if module is smaller (= has less definition, counting nested ones)
164164 * than a particular threshold. Return (Some n) if module has size n, or None
165165 * otherwise (module is bigger than threshold).
166166 * Used to skip printing big modules in completion. *)
167- let rec mod_smallerthan n m =
167+ let rec mod_smallerthan n ( m : Subst.Lazy.module_type ) =
168168 if n < 0 then None
169169 else
170- let open Types in
171170 match m with
172171 | Mty_ident _ -> Some 1
173172 | Mty_signature s -> begin
173+ let s = Subst.Lazy. force_signature_once s in
174174 match List. length_lessthan n s with
175175 | None -> None
176176 | Some _ ->
@@ -190,17 +190,15 @@ let rec mod_smallerthan n m =
190190 | Some n' , _ -> Some (succ n')
191191 end
192192 end
193- | Mty_functor _ ->
194- let m1, m2 = unpack_functor m in
195- begin
196- match (mod_smallerthan n m2, m1) with
197- | None , _ -> None
198- | result , Unit -> result
199- | Some n1 , Named (_ , mt ) -> (
200- match mod_smallerthan (n - n1) mt with
201- | None -> None
202- | Some n2 -> Some (n1 + n2))
203- end
193+ | Mty_functor (m1 , m2 ) -> begin
194+ match (mod_smallerthan n m2, m1) with
195+ | None , _ -> None
196+ | result , Unit -> result
197+ | Some n1 , Named (_ , mt ) -> (
198+ match mod_smallerthan (n - n1) mt with
199+ | None -> None
200+ | Some n2 -> Some (n1 + n2))
201+ end
204202 | _ -> Some 1
205203
206204let print_short_modtype verbosity env ppf md =
@@ -209,7 +207,9 @@ let print_short_modtype verbosity env ppf md =
209207 match mod_smallerthan 1000 md with
210208 | None when verbosity = 0 ->
211209 Format. pp_print_string ppf " (* large signature, repeat to confirm *)"
212- | _ -> Printtyp. modtype env ppf md
210+ | _ ->
211+ let md = Subst.Lazy. force_modtype md in
212+ Printtyp. modtype env ppf md
213213
214214let print_type_with_decl ~verbosity env ppf typ =
215215 match verbosity with
@@ -260,13 +260,13 @@ let print_type ppf verbosity env lid =
260260 end
261261
262262let print_modtype ppf verbosity env lid =
263- let _p, mtd = Env. find_modtype_by_name lid.Asttypes. txt env in
263+ let _p, mtd = Env. find_modtype_by_name_lazy lid.Asttypes. txt env in
264264 match mtd.mtd_type with
265265 | Some mt -> print_short_modtype verbosity env ppf mt
266266 | None -> Format. pp_print_string ppf " (* abstract module *)"
267267
268268let print_modpath ppf verbosity env lid =
269- let _path, md = Env. find_module_by_name lid.Asttypes. txt env in
269+ let _path, md = Env. find_module_by_name_lazy lid.Asttypes. txt env in
270270 print_short_modtype verbosity env ppf md.md_type
271271
272272let print_cstr_desc ppf cstr_desc =
0 commit comments