@@ -72,6 +72,21 @@ module Tools_error = struct
7272 (* Could not find the module in the environment *)
7373 | `Parent of parent_lookup_error ]
7474
75+ and simple_datatype_lookup_error =
76+ [ `LocalDataType of
77+ Env. t * Ident. path_datatype
78+ (* Internal error: Found local path during lookup *)
79+ | `Class_replaced
80+ (* Class was replaced with a destructive substitution and we're not sure
81+ what to do now *)
82+ | `OpaqueClass (* Couldn't resolve class signature. *)
83+ | `Find_failure
84+ (* Internal error: the type was not found in the parent signature *)
85+ | `Lookup_failureT of
86+ Identifier.Path.Type. t
87+ (* Could not find the module in the environment *)
88+ | `Parent of parent_lookup_error ]
89+
7590 and simple_value_lookup_error =
7691 [ `LocalValue of
7792 Env. t * Ident. path_value
@@ -83,6 +98,17 @@ module Tools_error = struct
8398 (* Could not find the module in the environment *)
8499 | `Parent of parent_lookup_error ]
85100
101+ and simple_constructor_lookup_error =
102+ [ `LocalConstructor of
103+ Env. t * Ident. constructor
104+ (* Internal error: Found local path during lookup *)
105+ | `Find_failure
106+ (* Internal error: the type was not found in the parent signature *)
107+ | `Lookup_failureC of
108+ Identifier.Path.Constructor. t
109+ (* Could not find the module in the environment *)
110+ | `ParentC of simple_datatype_lookup_error ]
111+
86112 and parent_lookup_error =
87113 [ `Parent_sig of
88114 expansion_of_module_error
@@ -110,6 +136,8 @@ module Tools_error = struct
110136 type any =
111137 [ simple_type_lookup_error
112138 | simple_value_lookup_error
139+ | simple_constructor_lookup_error
140+ | simple_datatype_lookup_error
113141 | simple_module_type_lookup_error
114142 | simple_module_type_expr_of_module_error
115143 | simple_module_lookup_error
@@ -147,6 +175,10 @@ module Tools_error = struct
147175 | `LocalMT (_ , id ) -> Format. fprintf fmt " Local id found: %a" Ident. fmt id
148176 | `Local (_ , id ) -> Format. fprintf fmt " Local id found: %a" Ident. fmt id
149177 | `LocalType (_ , id ) -> Format. fprintf fmt " Local id found: %a" Ident. fmt id
178+ | `LocalDataType (_ , id ) ->
179+ Format. fprintf fmt " Local id found: %a" Ident. fmt id
180+ | `LocalConstructor (_ , id ) ->
181+ Format. fprintf fmt " Local id found: %a" Ident. fmt id
150182 | `LocalValue (_ , id ) ->
151183 Format. fprintf fmt " Local id found: %a" Ident. fmt id
152184 | `Find_failure -> Format. fprintf fmt " Find failure"
@@ -168,9 +200,14 @@ module Tools_error = struct
168200 Format. fprintf fmt " Lookup failure (value): %a"
169201 Component.Fmt. model_identifier
170202 (m :> Odoc_model.Paths.Identifier.t )
203+ | `Lookup_failureC m ->
204+ Format. fprintf fmt " Lookup failure (value): %a"
205+ Component.Fmt. model_identifier
206+ (m :> Odoc_model.Paths.Identifier.t )
171207 | `ApplyNotFunctor -> Format. fprintf fmt " Apply module is not a functor"
172208 | `Class_replaced -> Format. fprintf fmt " Class replaced"
173209 | `Parent p -> pp fmt (p :> any )
210+ | `ParentC p -> pp fmt (p :> any )
174211 | `UnexpandedTypeOf t ->
175212 Format. fprintf fmt " Unexpanded `module type of` expression: %a"
176213 Component.Fmt. module_type_type_of_desc t
@@ -206,7 +243,9 @@ let is_unexpanded_module_type_of =
206243 | `Find_failure -> false
207244 | `Lookup_failure _ -> false
208245 | `Lookup_failure_root _ -> false
246+ | `Lookup_failureC _ -> false
209247 | `Parent p -> inner (p :> any )
248+ | `ParentC p -> inner (p :> any )
210249 | `Parent_sig p -> inner (p :> any )
211250 | `Parent_module_type p -> inner (p :> any )
212251 | `Parent_expr p -> inner (p :> any )
@@ -224,6 +263,8 @@ let is_unexpanded_module_type_of =
224263 | `Lookup_failureT _ -> false
225264 | `Lookup_failureV _ -> false
226265 | `LocalType _ -> false
266+ | `LocalDataType _ -> false
267+ | `LocalConstructor _ -> false
227268 | `LocalValue _ -> false
228269 | `Class_replaced -> false
229270 | `OpaqueClass -> false
@@ -298,6 +339,7 @@ type what =
298339 | `Module of Identifier.Module .t
299340 | `Module_type of Identifier.Signature .t
300341 | `Module_path of Cpath .module_
342+ | `Constructor_path of Cpath .constructor
301343 | `Module_type_path of Cpath .module_type
302344 | `Module_type_U of Component.ModuleType .U .expr
303345 | `Include of Component.Include .decl
@@ -350,6 +392,7 @@ let report ~(what : what) ?tools_error action =
350392 | `Type cfrag -> r " type" type_fragment cfrag
351393 | `Type_path path -> r " type" type_path path
352394 | `Value_path path -> r " value" value_path path
395+ | `Constructor_path path -> r " constructor" constructor_path path
353396 | `Class_type_path path -> r " class_type" class_type_path path
354397 | `With_module frag -> r " module substitution" module_fragment frag
355398 | `With_module_type frag ->
0 commit comments