123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408openOdoc_modelmoduleTools_error=structopenPaths(** Errors raised by Tools *)typehandle_subs_error=[`UnresolvedPathof[`ModuleofCpath.module_](* Failed to resolve a module path when applying a fragment item *)]typereference_kind=[`S|`T|`C|`CT|`Page|`Cons|`Field|`Label]typeexpansion_of_module_error=[`OpaqueModule(* The module does not have an expansion *)|`UnresolvedForwardPath(* The module signature depends upon a forward path *)|`UnresolvedPathof[`ModuleofCpath.module_*simple_module_lookup_error|`ModuleTypeofCpath.module_type*simple_module_type_lookup_error](* The path to the module or module type could not be resolved *)|`UnexpandedTypeOfofComponent.ModuleType.type_of_desc(* The `module type of` expression could not be expanded *)]andsimple_module_lookup_error=[`LocalofEnv.t*Ident.path_module(* Internal error: Found local path during lookup *)|`Find_failure|(* Internal error: the module was not found in the parent signature *)`Lookup_failureofIdentifier.Path.Module.t(* Could not find the module in the environment *)|`Lookup_failure_rootofstring(* Could not find the root module *)|`Parentofparent_lookup_error]andsimple_module_type_expr_of_module_error=[`ApplyNotFunctor(* Internal error: attempt made to apply a module that's not a functor *)|`OpaqueModule(* The module does not have an expansion *)|`UnresolvedForwardPath(* The module signature depends upon a forward path *)|`UnresolvedPathof[`ModuleofCpath.module_*simple_module_lookup_error|`ModuleTypeofCpath.module_type*simple_module_type_lookup_error]|`Parentofparent_lookup_error]andsimple_module_type_lookup_error=[`LocalMTofEnv.t*Ident.module_type(* Internal error: Found local path during lookup *)|`Find_failure(* Internal error: the module was not found in the parent signature *)|`Lookup_failureMTofIdentifier.ModuleType.t(* Could not find the module in the environment *)|`Parentofparent_lookup_error]andsimple_type_lookup_error=[`LocalTypeofEnv.t*Ident.path_type(* Internal error: Found local path during lookup *)|`Class_replaced(* Class was replaced with a destructive substitution and we're not sure
what to do now *)|`OpaqueClass(* Couldn't resolve class signature. *)|`Find_failure(* Internal error: the type was not found in the parent signature *)|`Lookup_failureTofIdentifier.Path.Type.t(* Could not find the module in the environment *)|`Parentofparent_lookup_error]andsimple_datatype_lookup_error=[`LocalDataTypeofEnv.t*Ident.path_datatype(* Internal error: Found local path during lookup *)|`Find_failure(* Internal error: the type was not found in the parent signature *)|`Lookup_failureTofIdentifier.Path.Type.t(* Could not find the module in the environment *)|`Parentofparent_lookup_error]andsimple_value_lookup_error=[`LocalValueofEnv.t*Ident.path_value(* Internal error: Found local path during lookup *)|`Find_failure(* Internal error: the type was not found in the parent signature *)|`Lookup_failureVofIdentifier.Path.Value.t(* Could not find the module in the environment *)|`Parentofparent_lookup_error]andsimple_constructor_lookup_error=[`LocalConstructorofEnv.t*Ident.constructor(* Internal error: Found local path during lookup *)|`Find_failure(* Internal error: the type was not found in the parent signature *)|`Lookup_failureCofIdentifier.Path.Constructor.t(* Could not find the module in the environment *)|`ParentCofsimple_datatype_lookup_error]andparent_lookup_error=[`Parent_sigofexpansion_of_module_error(* Error found while calculating the parent signature *)|`Parent_module_typeofsimple_module_type_lookup_error(* Error found while looking up parent module type *)|`Parent_exprofsimple_module_type_expr_of_module_error(* Error found while evaluating parent module expression *)|`Parent_moduleofsimple_module_lookup_error(* Error found while looking up parent module *)|`Parent_typeofsimple_type_lookup_error|`Fragment_root(* Encountered unexpected fragment root *)|`Parentofparent_lookup_error|`Referenceofreference_lookup_error]andreference_lookup_error=[`Wrong_kindofreference_kindlist*reference_kind(* Expected, got *)|`Lookup_by_nameof[reference_kind|`Any]*string|`Find_by_nameof[reference_kind|`Any]*string|`Parentofparent_lookup_error]typeany=[simple_type_lookup_error|simple_value_lookup_error|simple_constructor_lookup_error|simple_datatype_lookup_error|simple_module_type_lookup_error|simple_module_type_expr_of_module_error|simple_module_lookup_error|expansion_of_module_error|parent_lookup_error]letpp_reference_kindfmtk=letk=matchkwith|`S->"signature"|`T->"type"|`C->"class"|`CT->"class type"|`Page->"page"|`Cons->"constructor"|`Field->"field"|`Label->"label"inFormat.pp_print_stringfmtkletrecpp:Format.formatter->any->unit=funfmterr->matcherrwith|`OpaqueModule->Format.fprintffmt"OpaqueModule"|`OpaqueClass->Format.fprintffmt"Class is abstract"|`UnresolvedForwardPath->Format.fprintffmt"Unresolved forward path"|`UnresolvedPath(`Module(p,e))->Format.fprintffmt"Unresolved module path %a (%a)"Component.Fmt.module_pathppp(e:>any)|`UnresolvedPath(`ModuleType(p,e))->Format.fprintffmt"Unresolved module type path %a (%a)"Component.Fmt.module_type_pathppp(e:>any)|`LocalMT(_,id)->Format.fprintffmt"Local id found: %a"Ident.fmtid|`Local(_,id)->Format.fprintffmt"Local id found: %a"Ident.fmtid|`LocalType(_,id)->Format.fprintffmt"Local id found: %a"Ident.fmtid|`LocalDataType(_,id)->Format.fprintffmt"Local id found: %a"Ident.fmtid|`LocalConstructor(_,id)->Format.fprintffmt"Local id found: %a"Ident.fmtid|`LocalValue(_,id)->Format.fprintffmt"Local id found: %a"Ident.fmtid|`Find_failure->Format.fprintffmt"Find failure"|`Lookup_failurem->Format.fprintffmt"Lookup failure (module): %a"Component.Fmt.model_identifier(m:>Odoc_model.Paths.Identifier.t)|`Lookup_failure_rootr->Format.fprintffmt"Lookup failure (root module): %s"r|`Lookup_failureMTm->Format.fprintffmt"Lookup failure (module type): %a"Component.Fmt.model_identifier(m:>Odoc_model.Paths.Identifier.t)|`Lookup_failureTm->Format.fprintffmt"Lookup failure (type): %a"Component.Fmt.model_identifier(m:>Odoc_model.Paths.Identifier.t)|`Lookup_failureVm->Format.fprintffmt"Lookup failure (value): %a"Component.Fmt.model_identifier(m:>Odoc_model.Paths.Identifier.t)|`Lookup_failureCm->Format.fprintffmt"Lookup failure (value): %a"Component.Fmt.model_identifier(m:>Odoc_model.Paths.Identifier.t)|`ApplyNotFunctor->Format.fprintffmt"Apply module is not a functor"|`Class_replaced->Format.fprintffmt"Class replaced"|`Parentp->ppfmt(p:>any)|`ParentCp->ppfmt(p:>any)|`UnexpandedTypeOft->Format.fprintffmt"Unexpanded `module type of` expression: %a"Component.Fmt.module_type_type_of_desct|`Parent_sige->Format.fprintffmt"Parent_sig: %a"pp(e:>any)|`Parent_module_typee->Format.fprintffmt"Parent_module_type: %a"pp(e:>any)|`Parent_expre->Format.fprintffmt"Parent_expr: %a"pp(e:>any)|`Parent_modulee->Format.fprintffmt"Parent_module: %a"pp(e:>any)|`Fragment_root->Format.fprintffmt"Fragment root"|`Parent_typee->Format.fprintffmt"Parent_type: %a"pp(e:>any)|`Referencee->pp_reference_lookup_errorfmteandpp_reference_lookup_errorfmt=function|`Wrong_kind(expected,got)->letpp_sepfmt()=Format.fprintffmt" or "inFormat.fprintffmt"is of kind %a but expected %a"pp_reference_kindgot(Format.pp_print_list~pp_seppp_reference_kind)expected|`Lookup_by_name(kind,name)|`Find_by_name(kind,name)->(matchkindwith|`Any->Format.fprintffmt"Couldn't find %S"name|#reference_kindaskind->Format.fprintffmt"Couldn't find %a %S"pp_reference_kindkindname)|`Parente->ppfmt(e:>any)end(* Ugh. we need to determine whether this was down to an unexpanded module type error. This is horrendous. *)letis_unexpanded_module_type_of=letopenTools_errorinletrecinner:any->bool=function|`Local_->false|`Find_failure->false|`Lookup_failure_->false|`Lookup_failure_root_->false|`Lookup_failureC_->false|`Parentp->inner(p:>any)|`ParentCp->inner(p:>any)|`Parent_sigp->inner(p:>any)|`Parent_module_typep->inner(p:>any)|`Parent_exprp->inner(p:>any)|`Parent_modulep->inner(p:>any)|`Parent_typep->inner(p:>any)|`Fragment_root->false|`OpaqueModule->false|`UnresolvedForwardPath->false|`UnexpandedTypeOf_->true(* woo *)|`LocalMT_->false|`Lookup_failureMT_->false|`ApplyNotFunctor->false|`UnresolvedPath(`Module(_,e))->inner(e:>any)|`UnresolvedPath(`ModuleType(_,e))->inner(e:>any)|`Lookup_failureT_->false|`Lookup_failureV_->false|`LocalType_->false|`LocalDataType_->false|`LocalConstructor_->false|`LocalValue_->false|`Class_replaced->false|`OpaqueClass->false|`Reference(`Parentp)->inner(p:>any)|`Reference_->falseininnertypekind=[`OpaqueModule|`Rootofstring]letreckind_of_module_cpath=function|`Rootname->Some(`Rootname)|`Substitutedp'|`Dot(p',_)->kind_of_module_cpathp'|`Apply(a,b)->(matchkind_of_module_cpathawith|Some_asa->a|None->kind_of_module_cpathb)|_->Noneletreckind_of_module_type_cpath=function|`Substitutedp'->kind_of_module_type_cpathp'|`Dot(p',_)->kind_of_module_cpathp'|_->None(** [Some (`Root _)] for errors during lookup of root modules or [None] for
other errors. *)letreckind_of_error:Tools_error.any->kindoption=function|`UnresolvedPath(`Module(cp,e))->(matchkind_of_module_cpathcpwith|None->kind_of_error(e:>Tools_error.any)|x->x)|`UnresolvedPath(`ModuleType(cp,e))->(matchkind_of_module_type_cpathcpwith|None->kind_of_error(e:>Tools_error.any)|x->x)|`Lookup_failure{iv=`Root(_,name);_}->Some(`Root(Names.ModuleName.to_stringname))|`UnexpandedTypeOftype_of_desc->kind_of_type_of_desctype_of_desc|`Lookup_failure_rootname->Some(`Rootname)|`Parent(`Parent_sige)->kind_of_error(e:>Tools_error.any)|`Parent(`Parent_module_typee)->kind_of_error(e:>Tools_error.any)|`Parent(`Parent_expre)->kind_of_error(e:>Tools_error.any)|`Parent(`Parent_modulee)->kind_of_error(e:>Tools_error.any)|`Parent(`Parent_ase)->kind_of_error(e:>Tools_error.any)|`OpaqueModule->(* Don't turn OpaqueModule warnings into errors *)Some`OpaqueModule|_->Noneandkind_of_type_of_desc:Component.ModuleType.type_of_desc->kindoption=function|ModPathcp->kind_of_module_cpathcp|StructIncludecp->kind_of_module_cpathcpletkind_of_error~what=function|Somee->kind_of_error(e:>Tools_error.any)|None->(matchwhatwith|`Include(Component.Include.Aliascp)->kind_of_module_cpathcp|`Module{Odoc_model.Paths.Identifier.iv=`Root(_,name);_}->Some(`Root(Names.ModuleName.to_stringname))|_->None)openPathstypewhat=[`Functor_parameterofIdentifier.FunctorParameter.t|`ValueofIdentifier.Value.t|`Value_pathofCpath.value|`ClassofIdentifier.Class.t|`Class_typeofIdentifier.ClassType.t|`ModuleofIdentifier.Module.t|`Module_typeofIdentifier.Signature.t|`Module_pathofCpath.module_|`Constructor_pathofCpath.constructor|`Module_type_pathofCpath.module_type|`Module_type_UofComponent.ModuleType.U.expr|`IncludeofComponent.Include.decl|`PackageofCpath.module_type|`TypeofCfrag.type_|`Type_pathofCpath.type_|`Class_type_pathofCpath.class_type|`With_moduleofCfrag.module_|`With_module_typeofCfrag.module_type|`With_typeofCfrag.type_|`Module_type_exprofComponent.ModuleType.expr|`Module_type_u_exprofComponent.ModuleType.U.expr|`Child_moduleofstring|`Child_pageofstring|`ReferenceofReference.t]letreport~(what:what)?tools_erroraction=letaction=matchactionwith|`Lookup->"lookup"|`Expand->"compile expansion for"|`Resolve_module_type->"resolve type of"|`Resolve->"resolve"|`Compile->"compile"inletpp_tools_errorfmt=function|Somee->Format.fprintffmt" %a"Tools_error.pp(e:>Tools_error.any)|None->()inletopenComponent.Fmtinletreport_internal_error()=letrsubjectpp_aa=Lookup_failures.report_internal"Failed to %s %s %a%a"actionsubjectpp_aapp_tools_errortools_errorinletfmt_idfmtid=model_identifierfmt(id:>Paths.Identifier.t)inmatchwhatwith|`Functor_parameterid->r"functor parameter"fmt_idid|`Valueid->r"value"fmt_idid|`Classid->r"class"fmt_idid|`Class_typeid->r"class type"fmt_idid|`Moduleid->r"module"fmt_idid|`Module_typeid->r"module type"fmt_idid|`Module_pathpath->r"module path"module_pathpath|`Module_type_pathpath->r"module type path"module_type_pathpath|`Module_type_Uexpr->r"module type expr"u_module_type_exprexpr|`Includedecl->r"include"include_decldecl|`Packagepath->r"module package"module_type_path(path:>Cpath.module_type)|`Typecfrag->r"type"type_fragmentcfrag|`Type_pathpath->r"type"type_pathpath|`Value_pathpath->r"value"value_pathpath|`Constructor_pathpath->r"constructor"constructor_pathpath|`Class_type_pathpath->r"class_type"class_type_pathpath|`With_modulefrag->r"module substitution"module_fragmentfrag|`With_module_typefrag->r"module type substitution"module_type_fragmentfrag|`With_typefrag->r"type substitution"type_fragmentfrag|`Module_type_exprcexpr->r"module type expression"module_type_exprcexpr|`Module_type_u_exprcexpr->r"module type u expression"u_module_type_exprcexpr|`Child_modulerf->r"child module"Astring.String.pprf|`Child_pagerf->r"child page"Astring.String.pprf|`Referenceref->r"reference"model_referencerefinmatchkind_of_error~whattools_errorwith|Some(`Rootname)->Lookup_failures.report_root~name|Some`OpaqueModule->report_internal_error()|None->report_internal_error()