123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515moduleString_map=Misc.String.MapmoduleIdent=structtypet=Ident.tletequalt1t2=Ident.equalt1t2letcomparet1t2=Ident.comparet1t2letname=Ident.nameletglobalname=Ident.create_persistentnameletprint_with_scopet=Ident.print_with_scopetendmoduleIdent_map=Map.Make(Ident)moduleIdent_set=Set.Make(Ident)modulePath=structtypet=Path.t=|PidentofIdent.t|Pdotoft*string|Papplyoft*t|Pextra_tyoft*Path.extra_ty(* open Path *)letequalt1t2=Path.samet1t2letcomparet1t2=Path.comparet1t2endmodulePath_map=Map.Make(Path)modulePath_set=Set.Make(Path)moduleDesc=structtypedeprecated=|Deprecated|Not_deprecatedmoduleType=structtypet=|Fresh|Nthofint|SubstofPath.t*intlist|AliasofPath.tendmoduleModule_type=structtypet=|Fresh|AliasofPath.tendmoduleClass_type=structtypet=|Fresh|SubstofPath.t*intlist|AliasofPath.tendmoduleModule=structtypecomponent=|Typeofstring*Type.t*deprecated|Class_typeofstring*Class_type.t*deprecated|Module_typeofstring*Module_type.t*deprecated|Moduleofstring*t*deprecatedandcomponents=componentlistandkind=|SignatureofcomponentsLazy.t|Functorof(Path.t->t)andt=|Freshofkind|AliasofPath.tendtypesource=|Local|Opentypet=|TypeofIdent.t*Type.t*source*deprecated|Class_typeofIdent.t*Class_type.t*source*deprecated|Module_typeofIdent.t*Module_type.t*source*deprecated|ModuleofIdent.t*Module.t*source*deprecated|Declare_typeofIdent.t|Declare_class_typeofIdent.t|Declare_module_typeofIdent.t|Declare_moduleofIdent.tendmoduleSort=structtypet=|Defined|DeclaredofIdent_set.tletapplicationt1t2=matcht1,t2with|Defined,Defined->Defined|Defined,Declared_->t2|Declared_,Defined->t1|Declaredids1,Declaredids2->Declared(Ident_set.unionids1ids2)endmoduleAge=Natural.Make()moduleDependency=Natural.Make()moduleOrigin=structtypet=|DependencyofDependency.t|DependenciesofDependency.tlist|EnvironmentofAge.tletrecdeps_adddepdeps=matchdepswith|[]->[dep]|dep'::rest->ifDependency.equaldepdep'thendepselseifDependency.less_thandepdep'thendep::depselsedep'::deps_adddeprestletrecdeps_uniondeps1deps2=matchdeps1,deps2with|[],_->deps2|_,[]->deps1|dep1::rest1,dep2::rest2->ifDependency.equaldep1dep2thendep1::deps_unionrest1rest2elseifDependency.less_thandep1dep2thendep1::deps_unionrest1deps2elsedep2::deps_uniondeps1rest2letrecdeps_equaldeps1deps2=matchdeps1,deps2with|[],[]->true|[],_::_->false|_::_,[]->false|dep1::rest1,dep2::rest2->Dependency.equaldep1dep2&&deps_equalrest1rest2letapplicationt1t2=matcht1,t2with|Dependencydep1,Dependencydep2->ifDependency.equaldep1dep2thent1elseifDependency.less_thandep1dep2thenDependencies[dep1;dep2]elseDependencies[dep2;dep1]|Dependencydep1,Dependenciesdeps2->Dependencies(deps_adddep1deps2)|Dependency_,Environment_->t2|Dependenciesdeps1,Dependencydep2->Dependencies(deps_adddep2deps1)|Dependenciesdeps1,Dependenciesdeps2->Dependencies(deps_uniondeps1deps2)|Dependencies_,Environment_->t2|Environment_,Dependency_->t1|Environment_,Dependencies_->t1|Environmentage1,Environmentage2->Environment(Age.maxage1age2)letequalt1t2=matcht1,t2with|Dependencydep1,Dependencydep2->Dependency.equaldep1dep2|Dependency_,Dependencies_->false|Dependency_,Environment_->false|Dependencies_,Dependency_->false|Dependenciesdeps1,Dependenciesdeps2->deps_equaldeps1deps2|Dependencies_,Environment_->false|Environment_,Dependency_->false|Environment_,Dependencies_->false|Environmentenv1,Environmentenv2->Age.equalenv1env2lethash=Hashtbl.hashendlethidden_namename=ifname<>""&&name.[0]='_'thentrueelsetryfori=1toString.lengthname-2doifname.[i]='_'&&name.[i+1]='_'thenraiseExitdone;falsewithExit->truelethidden_identid=(* if !Clflags.unsafe_string && Ident.equal id Predef.ident_bytes then true
else
Since 5.0.0 unsafe_string is always false *)hidden_name(Ident.nameid)lethidden_definitiondeprecatedname=matchdeprecatedwith|Desc.Deprecated->true|Desc.Not_deprecated->hidden_namenamelethidden_base_definitiondeprecatedid=matchdeprecatedwith|Desc.Deprecated->true|Desc.Not_deprecated->hidden_identidmodulerecType:sigtypetvalbase:Origin.t->Ident.t->Desc.Type.toption->Desc.deprecated->tvalchild:Module.normalized->string->Desc.Type.toption->Desc.deprecated->tvaldeclare:Origin.t->Ident.t->tvaldeclaration:t->Origin.toptionvalorigin:Graph.t->t->Origin.tvalpath:Graph.t->t->Path.tvalhidden:t->boolvalsort:Graph.t->t->Sort.ttyperesolved=|Nthofint|Pathofintlistoption*tvalresolve:Graph.t->t->resolvedend=structopenDesc.Typetypedefinition=|AliasofPath.t|Defined|Nthofint|SubstofPath.t*intlist|Unknowntypet=|Declarationof{origin:Origin.t;id:Ident.t;hidden:bool;}|Definitionof{origin:Origin.t;path:Path.t;hidden:bool;sort:Sort.t;definition:definition;}letdefinition_of_desc(desc:Desc.Type.toption)=matchdescwith|None->Unknown|SomeFresh->Defined|Some(Nthn)->Nthn|Some(Subst(p,ns))->Subst(p,ns)|Some(Aliasalias)->Aliasaliasletbaseoriginiddescdeprecated=letpath=Path.Pidentidinlethidden=hidden_base_definitiondeprecatedidinletsort=Sort.Definedinletdefinition=definition_of_descdescinDefinition{origin;path;hidden;sort;definition}letchildmdnamedescdeprecated=letorigin=Module.raw_originmdinletsort=Module.raw_sortmdinletpath=Path.Pdot(Module.raw_pathmd,name)inlethidden=hidden_definitiondeprecatednameinletdefinition=definition_of_descdescinDefinition{origin;path;hidden;sort;definition}letdeclareoriginid=lethidden=hidden_identidinDeclaration{origin;id;hidden}letdeclarationt=matchtwith|Definition_->None|Declaration{origin;_}->Someoriginlethiddent=matchtwith|Definition{hidden;_}->hidden|Declaration{hidden;_}->hiddenletraw_origint=matchtwith|Declaration{origin;_}|Definition{origin;_}->originletraw_patht=matchtwith|Declaration{id;_}->Path.Pidentid|Definition{path;_}->pathletraw_sortt=matchtwith|Declaration{id;_}->Sort.Declared(Ident_set.singletonid)|Definition{sort;_}->sortletrecnormalize_looproott=matchtwith|Declaration_->t|Definition{definition=Defined|Unknown|Nth_|Subst_}->t|Definition({definition=Aliasalias}asr)->beginmatchGraph.find_typerootaliaswith|exceptionNot_found->Definition{rwithdefinition=Unknown}|aliased->normalize_looprootaliasedendletnormalizeroott=matchtwith|Definition{sort=Sort.Defined}->normalize_looproott|Definition{sort=Sort.Declared_}|Declaration_->matchGraph.find_typeroot(raw_patht)with|exceptionNot_found->normalize_looproott|t->normalize_looproottletoriginroott=raw_origin(normalizeroott)letpathroott=raw_path(normalizeroott)letsortroott=raw_sort(normalizeroott)typeresolved=|Nthofint|Pathofintlistoption*tletsubstns=function|Nthn->Nth(List.nthnsn)|Path(None,p)->Path(Somens,p)|Path(Somems,p)->Path(Some(List.map(List.nthns)ms),p)letrecresolveroott=matchnormalizeroottwith|Declaration_->Path(None,t)|Definition{definition=Defined|Unknown}->Path(None,t)|Definition{definition=Nthn}->Nthn|Definition{definition=Subst(p,ns)}->beginmatchGraph.find_typerootpwith|exceptionNot_found->Path(None,t)|aliased->substns(resolverootaliased)end|Definition{definition=Alias_}->assertfalseendandClass_type:sigtypetvalbase:Origin.t->Ident.t->Desc.Class_type.toption->Desc.deprecated->tvalchild:Module.normalized->string->Desc.Class_type.toption->Desc.deprecated->tvaldeclare:Origin.t->Ident.t->tvaldeclaration:t->Origin.toptionvalorigin:Graph.t->t->Origin.tvalpath:Graph.t->t->Path.tvalhidden:t->boolvalsort:Graph.t->t->Sort.ttyperesolved=intlistoption*tvalresolve:Graph.t->t->resolvedend=structopenDesc.Class_typetypedefinition=|AliasofPath.t|Defined|SubstofPath.t*intlist|Unknowntypet=|Declarationof{origin:Origin.t;id:Ident.t;hidden:bool;}|Definitionof{origin:Origin.t;path:Path.t;hidden:bool;sort:Sort.t;definition:definition;}letdefinition_of_desc(desc:Desc.Class_type.toption)=matchdescwith|None->Unknown|SomeFresh->Defined|Some(Subst(p,ns))->Subst(p,ns)|Some(Aliasalias)->Aliasaliasletbaseoriginiddescdeprecated=letpath=Path.Pidentidinlethidden=hidden_base_definitiondeprecatedidinletsort=Sort.Definedinletdefinition=definition_of_descdescinDefinition{origin;path;hidden;sort;definition}letchildmdnamedescdeprecated=letorigin=Module.raw_originmdinletsort=Module.raw_sortmdinletpath=Path.Pdot(Module.raw_pathmd,name)inlethidden=hidden_definitiondeprecatednameinletdefinition=definition_of_descdescinDefinition{origin;path;hidden;sort;definition}letdeclareoriginid=lethidden=hidden_identidinDeclaration{origin;id;hidden}letdeclarationt=matchtwith|Definition_->None|Declaration{origin;_}->Someoriginlethiddent=matchtwith|Definition{hidden;_}->hidden|Declaration{hidden;_}->hiddenletraw_origint=matchtwith|Declaration{origin;_}|Definition{origin;_}->originletraw_patht=matchtwith|Declaration{id;_}->Path.Pidentid|Definition{path;_}->pathletraw_sortt=matchtwith|Declaration{id;_}->Sort.Declared(Ident_set.singletonid)|Definition{sort;_}->sortletrecnormalize_looproott=matchtwith|Declaration_->t|Definition{definition=Defined|Unknown|Subst_}->t|Definition({definition=Aliasalias}asr)->beginmatchGraph.find_class_typerootaliaswith|exceptionNot_found->Definition{rwithdefinition=Unknown}|aliased->normalize_looprootaliasedendletnormalizeroott=matchtwith|Definition{sort=Sort.Defined}->normalize_looproott|Definition{sort=Sort.Declared_}|Declaration_->matchGraph.find_class_typeroot(raw_patht)with|exceptionNot_found->normalize_looproott|t->normalize_looproottletoriginroott=raw_origin(normalizeroott)letpathroott=raw_path(normalizeroott)letsortroott=raw_sort(normalizeroott)typeresolved=intlistoption*tletsubstns=function|(None,p)->(Somens,p)|(Somems,p)->(Some(List.map(List.nthns)ms),p)letrecresolveroott=matchnormalizeroottwith|Declaration_->(None,t)|Definition{definition=Defined|Unknown}->(None,t)|Definition{definition=Subst(p,ns)}->beginmatchGraph.find_class_typerootpwith|exceptionNot_found->(None,t)|aliased->substns(resolverootaliased)end|Definition{definition=Alias_}->assertfalseendandModule_type:sigtypetvalbase:Origin.t->Ident.t->Desc.Module_type.toption->Desc.deprecated->tvalchild:Module.normalized->string->Desc.Module_type.toption->Desc.deprecated->tvaldeclare:Origin.t->Ident.t->tvaldeclaration:t->Origin.toptionvalorigin:Graph.t->t->Origin.tvalpath:Graph.t->t->Path.tvalhidden:t->boolvalsort:Graph.t->t->Sort.tend=structopenDesc.Module_typetypedefinition=|AliasofPath.t|Defined|Unknowntypet=|Declarationof{origin:Origin.t;id:Ident.t;hidden:bool;}|Definitionof{origin:Origin.t;path:Path.t;hidden:bool;sort:Sort.t;definition:definition;}letbaseoriginiddescdeprecated=letpath=Path.Pidentidinlethidden=hidden_base_definitiondeprecatedidinletsort=Sort.Definedinletdefinition=matchdescwith|None->Unknown|SomeFresh->Defined|Some(Aliasalias)->AliasaliasinDefinition{origin;path;hidden;sort;definition}letchildmdnamedescdeprecated=letorigin=Module.raw_originmdinletsort=Module.raw_sortmdinletpath=Path.Pdot(Module.raw_pathmd,name)inlethidden=hidden_definitiondeprecatednameinletdefinition=matchdescwith|None->Unknown|SomeFresh->Defined|Some(Aliasalias)->AliasaliasinDefinition{origin;path;hidden;sort;definition}letdeclareoriginid=lethidden=hidden_identidinDeclaration{origin;id;hidden}letdeclarationt=matchtwith|Definition_->None|Declaration{origin;_}->Someoriginlethiddent=matchtwith|Definition{hidden;_}->hidden|Declaration{hidden;_}->hiddenletraw_origint=matchtwith|Declaration{origin;_}|Definition{origin;_}->originletraw_patht=matchtwith|Declaration{id;_}->Path.Pidentid|Definition{path;_}->pathletraw_sortt=matchtwith|Declaration{id;_}->Sort.Declared(Ident_set.singletonid)|Definition{sort;_}->sortletrecnormalize_looproott=matchtwith|Declaration_->t|Definition{definition=Defined|Unknown}->t|Definition({definition=Aliasalias}asr)->beginmatchGraph.find_module_typerootaliaswith|exceptionNot_found->Definition{rwithdefinition=Unknown}|aliased->normalize_looprootaliasedendletnormalizeroott=matchtwith|Definition{sort=Sort.Defined}->normalize_looproott|Definition{sort=Sort.Declared_}|Declaration_->matchGraph.find_module_typeroot(raw_patht)with|exceptionNot_found->normalize_looproott|t->normalize_looproottletoriginroott=raw_origin(normalizeroott)letpathroott=raw_path(normalizeroott)letsortroott=raw_sort(normalizeroott)endandModule:sigtypettypenormalizedvalbase:Origin.t->Ident.t->Desc.Module.toption->Desc.deprecated->tvalchild:normalized->string->Desc.Module.toption->Desc.deprecated->tvalapplication:normalized->t->Desc.Module.toption->tvaldeclare:Origin.t->Ident.t->tvaldeclaration:t->Origin.toptionvalorigin:Graph.t->t->Origin.tvalpath:Graph.t->t->Path.tvalhidden:t->boolvalsort:Graph.t->t->Sort.tvaltypes:Graph.t->t->Type.tString_map.toptionvalclass_types:Graph.t->t->Class_type.tString_map.toptionvalmodule_types:Graph.t->t->Module_type.tString_map.toptionvalmodules:Graph.t->t->Module.tString_map.toptionvalfind_type:Graph.t->t->string->Type.tvalfind_class_type:Graph.t->t->string->Class_type.tvalfind_module_type:Graph.t->t->string->Module_type.tvalfind_module:Graph.t->t->string->Module.tvalfind_application:Graph.t->t->Path.t->Module.tvalnormalize:Graph.t->t->normalizedvalunnormalize:normalized->tvalraw_origin:normalized->Origin.tvalraw_path:normalized->Path.tvalraw_sort:normalized->Sort.tend=structopenDesc.Moduletypecomponents=|UnforcedofDesc.Module.componentsLazy.t|Forcedof{types:Type.tString_map.t;class_types:Class_type.tString_map.t;module_types:Module_type.tString_map.t;modules:tString_map.t;}anddefinition=|AliasofPath.t|Signatureof{mutablecomponents:components}|Functorof{apply:Path.t->Desc.Module.t;mutableapplications:tPath_map.t;}|Unknownandt=|Declarationof{origin:Origin.t;id:Ident.t;hidden:bool;}|Definitionof{origin:Origin.t;path:Path.t;hidden:bool;sort:Sort.t;definition:definition;}letbaseoriginiddescdeprecated=letpath=Path.Pidentidinlethidden=hidden_base_definitiondeprecatedidinletsort=Sort.Definedinletdefinition=matchdescwith|None->Unknown|Some(Fresh(Signaturecomponents))->letcomponents=UnforcedcomponentsinSignature{components}|Some(Fresh(Functorapply))->letapplications=Path_map.emptyinFunctor{apply;applications}|Some(Aliasalias)->AliasaliasinDefinition{origin;path;hidden;sort;definition}letchildmdnamedescdeprecated=letorigin=Module.raw_originmdinletsort=Module.raw_sortmdinletpath=Path.Pdot(Module.raw_pathmd,name)inlethidden=hidden_definitiondeprecatednameinletdefinition=matchdescwith|None->Unknown|Some(Fresh(Signaturecomponents))->letcomponents=UnforcedcomponentsinSignature{components}|Some(Fresh(Functorapply))->letapplications=Path_map.emptyinFunctor{apply;applications}|Some(Aliasalias)->AliasaliasinDefinition{origin;path;hidden;sort;definition}letapplicationfuncargdesc=letfunc_origin=Module.raw_originfuncinletarg_origin=Module.raw_originarginletorigin=Origin.applicationfunc_originarg_origininletfunc_sort=Module.raw_sortfuncinletarg_sort=Module.raw_sortarginletsort=Sort.applicationfunc_sortarg_sortinletfunc_path=Module.raw_pathfuncinletarg_path=Module.raw_patharginletpath=Path.Papply(func_path,arg_path)inlethidden=falseinletdefinition=matchdescwith|None->Unknown|Some(Fresh(Signaturecomponents))->letcomponents=UnforcedcomponentsinSignature{components}|Some(Fresh(Functorapply))->letapplications=Path_map.emptyinFunctor{apply;applications}|Some(Aliasalias)->AliasaliasinDefinition{origin;path;hidden;sort;definition}letdeclareoriginid=lethidden=hidden_identidinDeclaration{origin;id;hidden}letdeclarationt=matchtwith|Definition_->None|Declaration{origin;_}->Someoriginlethiddent=matchtwith|Definition{hidden;_}->hidden|Declaration{hidden;_}->hiddenletraw_origint=matchtwith|Declaration{origin;_}|Definition{origin;_}->originletraw_patht=matchtwith|Declaration{id;_}->Path.Pidentid|Definition{path;_}->pathletraw_sortt=matchtwith|Declaration{id;_}->Sort.Declared(Ident_set.singletonid)|Definition{sort;_}->sorttypenormalized=tletrecnormalize_looproott=matchtwith|Declaration_->t|Definition{definition=Signature_|Functor_|Unknown}->t|Definition({definition=Aliasalias}asr)->beginmatchGraph.find_modulerootaliaswith|exceptionNot_found->Definition{rwithdefinition=Unknown}|aliased->normalize_looprootaliasedendletnormalizeroott=matchtwith|Definition{sort=Sort.Defined}->normalize_looproott|Definition{sort=Sort.Declared_}|Declaration_->matchGraph.find_moduleroot(raw_patht)with|exceptionNot_found->normalize_looproott|t->normalize_looproottletunnormalizet=tletoriginroott=raw_origin(normalizeroott)letpathroott=raw_path(normalizeroott)letsortroott=raw_sort(normalizeroott)letdefinitiont=matchModule.unnormalizetwith|Declaration_->Unknown|Definition{definition;_}->definitionletforceroott=lett=Module.normalizeroottinmatchdefinitiontwith|Alias_->assertfalse|Unknown|Functor_|Signature{components=Forced_}->t|Signature({components=Unforcedcomponents;_}asr)->beginletreclooptypesclass_typesmodule_typesmodules=function|[]->Forced{types;class_types;module_types;modules}|Type(name,desc,dpr)::rest->lettyp=Type.childtname(Somedesc)dprinlettypes=String_map.addnametyptypesinlooptypesclass_typesmodule_typesmodulesrest|Class_type(name,desc,dpr)::rest->letclty=Class_type.childtname(Somedesc)dprinletclass_types=String_map.addnamecltyclass_typesinlooptypesclass_typesmodule_typesmodulesrest|Module_type(name,desc,dpr)::rest->letmty=Module_type.childtname(Somedesc)dprinletmodule_types=String_map.addnamemtymodule_typesinlooptypesclass_typesmodule_typesmodulesrest|Module(name,desc,dpr)::rest->letmd=Module.childtname(Somedesc)dprinletmodules=String_map.addnamemdmodulesinlooptypesclass_typesmodule_typesmodulesrestinletempty=String_map.emptyinletcomponents=loopemptyemptyemptyempty(Lazy.forcecomponents)inr.components<-components;tendlettypesroott=lett=forceroottinmatchdefinitiontwith|Alias_|Signature{components=Unforced_}->assertfalse|Unknown|Functor_->None|Signature{components=Forced{types;_};_}->Sometypesletclass_typesroott=lett=forceroottinmatchdefinitiontwith|Alias_|Signature{components=Unforced_}->assertfalse|Unknown|Functor_->None|Signature{components=Forced{class_types;_}}->Someclass_typesletmodule_typesroott=lett=forceroottinmatchdefinitiontwith|Alias_|Signature{components=Unforced_}->assertfalse|Unknown|Functor_->None|Signature{components=Forced{module_types;_}}->Somemodule_typesletmodulesroott=lett=forceroottinmatchdefinitiontwith|Alias_|Signature{components=Unforced_}->assertfalse|Unknown|Functor_->None|Signature{components=Forced{modules;_}}->Somemodulesletfind_typeroottname=lett=forceroottinmatchdefinitiontwith|Alias_|Signature{components=Unforced_}->assertfalse|Unknown->Type.childtnameNoneNot_deprecated|Functor_->raiseNot_found|Signature{components=Forced{types;_};_}->String_map.findnametypesletfind_class_typeroottname=lett=forceroottinmatchdefinitiontwith|Alias_|Signature{components=Unforced_}->assertfalse|Unknown->Class_type.childtnameNoneNot_deprecated|Functor_->raiseNot_found|Signature{components=Forced{class_types;_};_}->String_map.findnameclass_typesletfind_module_typeroottname=lett=forceroottinmatchdefinitiontwith|Alias_|Signature{components=Unforced_}->assertfalse|Unknown->Module_type.childtnameNoneNot_deprecated|Functor_->raiseNot_found|Signature{components=Forced{module_types;_};_}->String_map.findnamemodule_typesletfind_moduleroottname=lett=forceroottinmatchdefinitiontwith|Alias_|Signature{components=Unforced_}->assertfalse|Unknown->Module.childtnameNoneNot_deprecated|Functor_->raiseNot_found|Signature{components=Forced{modules;_};_}->String_map.findnamemodulesletfind_applicationroottpath=lett=Module.normalizeroottinmatchdefinitiontwith|Alias_->assertfalse|Signature_->raiseNot_found|Unknown->letarg=Graph.find_modulerootpathinModule.applicationtargNone|Functor({apply;applications}asr)->letarg=Graph.find_modulerootpathinletarg_path=Module.pathrootarginmatchPath_map.findarg_pathapplicationswith|md->md|exceptionNot_found->letmd=Module.applicationtarg(Some(applyarg_path))inr.applications<-Path_map.addarg_pathmdapplications;mdendandDiff:sigmoduleItem:sigtypet=|TypeofIdent.t*Type.t*Origin.toption|Class_typeofIdent.t*Class_type.t*Origin.toption|Module_typeofIdent.t*Module_type.t*Origin.toption|ModuleofIdent.t*Module.t*Origin.toptionvalorigin:Graph.t->t->Origin.tvalid:Graph.t->t->Ident.tvalprevious:Graph.t->t->Origin.toptionendtypet=Item.tlistend=structmoduleItem=structtypet=|TypeofIdent.t*Type.t*Origin.toption|Class_typeofIdent.t*Class_type.t*Origin.toption|Module_typeofIdent.t*Module_type.t*Origin.toption|ModuleofIdent.t*Module.t*Origin.toptionletoriginroot=function|Type(_,typ,_)->Type.originroottyp|Class_type(_,clty,_)->Class_type.originrootclty|Module_type(_,mty,_)->Module_type.originrootmty|Module(_,md,_)->Module.originrootmdletid_root=function|Type(id,_,_)->id|Class_type(id,_,_)->id|Module_type(id,_,_)->id|Module(id,_,_)->idletprevious_root=function|Type(_,_,prev)->prev|Class_type(_,_,prev)->prev|Module_type(_,_,prev)->prev|Module(_,_,prev)->prevendtypet=Item.tlistendandComponent:sigtypesource=|Global|Local|Opentypet=|TypeofOrigin.t*Ident.t*Desc.Type.t*source*Desc.deprecated|Class_typeofOrigin.t*Ident.t*Desc.Class_type.t*source*Desc.deprecated|Module_typeofOrigin.t*Ident.t*Desc.Module_type.t*source*Desc.deprecated|ModuleofOrigin.t*Ident.t*Desc.Module.t*source*Desc.deprecated|Declare_typeofOrigin.t*Ident.t|Declare_class_typeofOrigin.t*Ident.t|Declare_module_typeofOrigin.t*Ident.t|Declare_moduleofOrigin.t*Ident.tend=ComponentandGraph:sigtypetvalempty:tvaladd:t->Component.tlist->t*Diff.tvalmerge:t->Diff.t->tvalfind_type:t->Path.t->Type.tvalfind_class_type:t->Path.t->Class_type.tvalfind_module_type:t->Path.t->Module_type.tvalfind_module:t->Path.t->Module.tvalis_type_path_visible:t->Path.t->boolvalis_class_type_path_visible:t->Path.t->boolvalis_module_type_path_visible:t->Path.t->boolvalis_module_path_visible:t->Path.t->boolvalis_type_ident_visible:t->Ident.t->boolvalis_class_type_ident_visible:t->Ident.t->boolvalis_module_type_ident_visible:t->Ident.t->boolvalis_module_ident_visible:t->Ident.t->boolend=structtypedefs=|GlobalofIdent.t|LocalofIdent.t|UnambiguousofIdent.t|AmbiguousofIdent.t*Ident.tlisttypet={types:Type.tIdent_map.t;class_types:Class_type.tIdent_map.t;module_types:Module_type.tIdent_map.t;modules:Module.tIdent_map.t;type_names:defsString_map.t;class_type_names:defsString_map.t;module_type_names:defsString_map.t;module_names:defsString_map.t;}letempty={types=Ident_map.empty;class_types=Ident_map.empty;module_types=Ident_map.empty;modules=Ident_map.empty;type_names=String_map.empty;class_type_names=String_map.empty;module_type_names=String_map.empty;module_names=String_map.empty;}letfailwith_idmsgid=failwith(Format_doc.asprintf"%s: %a"msgIdent.print_with_scopeid)letprevious_type_desctid=matchIdent_map.findidt.typeswith|exceptionNot_found->None|prev->matchType.declarationprevwith|None->failwith_id"Graph.add: type already defined"id|Some_aso->oletprevious_class_typetid=matchIdent_map.findidt.class_typeswith|exceptionNot_found->None|prev->matchClass_type.declarationprevwith|None->failwith_id"Graph.add: class type already defined"id|Some_aso->oletprevious_module_typetid=matchIdent_map.findidt.module_typeswith|exceptionNot_found->None|prev->matchModule_type.declarationprevwith|None->failwith_id"Graph.add: module type already defined"id|Some_aso->oletprevious_moduletid=matchIdent_map.findidt.moduleswith|exceptionNot_found->None|prev->matchModule.declarationprevwith|None->failwith_id"Graph.add: module already defined"id|Some_aso->oletadd_namesourceidnames=letname=Ident.nameidinletdefs=matchsourcewith|Component.Global->Globalid|Component.Local->Localid|Component.Open->beginmatchString_map.findnamenameswith|exceptionNot_found->Unambiguousid|Globalid'->Unambiguousid'|Localid'->Ambiguous(id,[id'])|Unambiguousid'->Ambiguous(id,[id'])|Ambiguous(id',ids)->Ambiguous(id,id'::ids)endinString_map.addnamedefsnamesletmerge_nameidnames=letname=Ident.nameidinmatchString_map.findnamenameswith|exceptionNot_found->String_map.addname(Globalid)names|_->namesletaddtdescs=letrecloopaccdiffdeclarations=function|[]->loop_declarationsaccdiffdeclarations|Component.Type(origin,id,desc,source,dpr)::rest->letprev=previous_typedescaccidinlettyp=Type.baseoriginid(Somedesc)dprinlettypes=Ident_map.addidtypacc.typesinlettype_names=add_namesourceidacc.type_namesinletitem=Diff.Item.Type(id,typ,prev)inletdiff=item::diffinletacc={accwithtypes;type_names}inloopaccdiffdeclarationsrest|Component.Class_type(origin,id,desc,source,dpr)::rest->letprev=previous_class_typeaccidinletclty=Class_type.baseoriginid(Somedesc)dprinletclass_types=Ident_map.addidcltyacc.class_typesinletclass_type_names=add_namesourceidacc.class_type_namesinletitem=Diff.Item.Class_type(id,clty,prev)inletdiff=item::diffinletacc={accwithclass_types;class_type_names}inloopaccdiffdeclarationsrest|Component.Module_type(origin,id,desc,source,dpr)::rest->letprev=previous_module_typeaccidinletmty=Module_type.baseoriginid(Somedesc)dprinletmodule_types=Ident_map.addidmtyacc.module_typesinletmodule_type_names=add_namesourceidacc.module_type_namesinletitem=Diff.Item.Module_type(id,mty,prev)inletdiff=item::diffinletacc={accwithmodule_types;module_type_names}inloopaccdiffdeclarationsrest|Component.Module(origin,id,desc,source,dpr)::rest->letprev=previous_moduleaccidinletmd=Module.baseoriginid(Somedesc)dprinletmodules=Ident_map.addidmdacc.modulesinletmodule_names=add_namesourceidacc.module_namesinletitem=Diff.Item.Module(id,md,prev)inletdiff=item::diffinletacc={accwithmodules;module_names}inloopaccdiffdeclarationsrest|Component.Declare_type(_,id)asdecl::rest->letdeclarations=decl::declarationsinlettype_names=(* CR lwhite: This should probably not always be [Global] *)add_nameComponent.Globalidacc.type_namesinletacc={accwithtype_names}inloopaccdiffdeclarationsrest|Component.Declare_class_type(_,id)asdecl::rest->letdeclarations=decl::declarationsinletclass_type_names=(* CR lwhite: This should probably not always be [Global] *)add_nameComponent.Globalidacc.class_type_namesinletacc={accwithclass_type_names}inloopaccdiffdeclarationsrest|Component.Declare_module_type(_,id)asdecl::rest->letdeclarations=decl::declarationsinletmodule_type_names=(* CR lwhite: This should probably not always be [Global] *)add_nameComponent.Globalidacc.module_type_namesinletacc={accwithmodule_type_names}inloopaccdiffdeclarationsrest|Component.Declare_module(_,id)asdecl::rest->letdeclarations=decl::declarationsinletmodule_names=(* CR lwhite: This should probably not always be [Global] *)add_nameComponent.Globalidacc.module_namesinletacc={accwithmodule_names}inloopaccdiffdeclarationsrestandloop_declarationsaccdiff=function|[]->acc,diff|Component.Declare_type(origin,id)::rest->ifIdent_map.memidacc.typesthenbeginloop_declarationsaccdiffrestendelsebeginlettyp=Type.declareoriginidinlettypes=Ident_map.addidtypacc.typesinletacc={accwithtypes}inloop_declarationsaccdiffrestend|Component.Declare_class_type(origin,id)::rest->ifIdent_map.memidacc.class_typesthenbeginloop_declarationsaccdiffrestendelsebeginletclty=Class_type.declareoriginidinletclass_types=Ident_map.addidcltyacc.class_typesinletacc={accwithclass_types}inloop_declarationsaccdiffrestend|Component.Declare_module_type(origin,id)::rest->ifIdent_map.memidacc.module_typesthenbeginloop_declarationsaccdiffrestendelsebeginletmty=Module_type.declareoriginidinletmodule_types=Ident_map.addidmtyacc.module_typesinletacc={accwithmodule_types}inloop_declarationsaccdiffrestend|Component.Declare_module(origin,id)::rest->ifIdent_map.memidacc.modulesthenbeginloop_declarationsaccdiffrestendelsebeginletmd=Module.declareoriginidinletmodules=Ident_map.addidmdacc.modulesinletacc={accwithmodules}inloop_declarationsaccdiffrestend|(Component.Type_|Component.Class_type_|Component.Module_type_|Component.Module_)::_->assertfalseinloopt[][]descsletmergetdiff=letrecloopacc=function|[]->acc|Diff.Item.Type(id,typ,_)::rest->lettypes=Ident_map.addidtypacc.typesinlettype_names=merge_nameidacc.type_namesinletacc={accwithtypes;type_names}inloopaccrest|Diff.Item.Class_type(id,clty,_)::rest->letclass_types=Ident_map.addidcltyacc.class_typesinletclass_type_names=merge_nameidacc.class_type_namesinletacc={accwithclass_types;class_type_names}inloopaccrest|Diff.Item.Module_type(id,mty,_)::rest->letmodule_types=Ident_map.addidmtyacc.module_typesinletmodule_type_names=merge_nameidacc.module_type_namesinletacc={accwithmodule_types;module_type_names}inloopaccrest|Diff.Item.Module(id,md,_)::rest->letmodules=Ident_map.addidmdacc.modulesinletmodule_names=merge_nameidacc.module_namesinletacc={accwithmodules;module_names}inloopaccrestinlooptdiffletrecfind_moduletpath=matchpathwith|Path.Pidentid->Ident_map.findidt.modules|Path.Pdot(p,name)->letmd=find_moduletpinModule.find_moduletmdname|Path.Papply(p,arg)->letmd=find_moduletpinModule.find_applicationtmdarg|Path.Pextra_ty_->raiseNot_foundletfind_typetpath=matchpathwith|Path.Pidentid->Ident_map.findidt.types|Path.Pdot(p,name)->letmd=find_moduletpinModule.find_typetmdname|Path.Papply_|Path.Pextra_ty_->raiseNot_foundletfind_class_typetpath=matchpathwith|Path.Pidentid->Ident_map.findidt.class_types|Path.Pdot(p,name)->letmd=find_moduletpinModule.find_class_typetmdname|Path.Papply_|Path.Pextra_ty_->raiseNot_foundletfind_module_typetpath=matchpathwith|Path.Pidentid->Ident_map.findidt.module_types|Path.Pdot(p,name)->letmd=find_moduletpinModule.find_module_typetmdname|Path.Papply_|Path.Pextra_ty_->raiseNot_foundletcanonical_type_pathtid=matchIdent_map.findidt.typeswith|exceptionNot_found->Path.Pidentid|md->Type.pathtmdletcanonical_class_type_pathtid=matchIdent_map.findidt.class_typeswith|exceptionNot_found->Path.Pidentid|md->Class_type.pathtmdletcanonical_module_type_pathtid=matchIdent_map.findidt.module_typeswith|exceptionNot_found->Path.Pidentid|md->Module_type.pathtmdletcanonical_module_pathtid=matchIdent_map.findidt.moduleswith|exceptionNot_found->Path.Pidentid|md->Module.pathtmdletis_module_ident_visibletid=letname=Ident.nameidinmatchString_map.findnamet.module_nameswith|exceptionNot_found->false|Localid'->Ident.equalidid'|Globalid'->Ident.equalidid'|Unambiguousid'->Ident.equalidid'|Ambiguous(id',ids)->ifnot(Ident.equalidid')thenfalseelsebeginletpaths=List.map(canonical_module_patht)idsinletpath=canonical_module_pathtidinList.for_all(Path.equalpath)pathsendletrecis_module_path_visiblet=function|Path.Pidentid->is_module_ident_visibletid|Path.Pdot(path,_)|Pextra_ty(path,_)->is_module_path_visibletpath|Path.Papply(path1,path2)->is_module_path_visibletpath1&&is_module_path_visibletpath2letis_type_ident_visibletid=letname=Ident.nameidinmatchString_map.findnamet.type_nameswith|exceptionNot_found->false|Localid'->Ident.equalidid'|Globalid'->Ident.equalidid'|Unambiguousid'->Ident.equalidid'|Ambiguous(id',ids)->ifnot(Ident.equalidid')thenfalseelsebeginletpaths=List.map(canonical_type_patht)idsinletpath=canonical_type_pathtidinList.for_all(Path.equalpath)pathsendletis_type_path_visiblet=function|Path.Pidentid->is_type_ident_visibletid|Path.Pdot(path,_)|Pextra_ty(path,_)->is_module_path_visibletpath|Path.Papply_->failwith"Short_paths_graph.Graph.is_type_path_visible: \
invalid type path"letis_class_type_ident_visibletid=letname=Ident.nameidinmatchString_map.findnamet.class_type_nameswith|exceptionNot_found->false|Localid'->Ident.equalidid'|Globalid'->Ident.equalidid'|Unambiguousid'->Ident.equalidid'|Ambiguous(id',ids)->ifnot(Ident.equalidid')thenfalseelsebeginletpaths=List.map(canonical_class_type_patht)idsinletpath=canonical_class_type_pathtidinList.for_all(Path.equalpath)pathsendletis_class_type_path_visiblet=function|Path.Pidentid->is_class_type_ident_visibletid|Path.Pdot(path,_)->is_module_path_visibletpath|Path.Papply_|Path.Pextra_ty_->failwith"Short_paths_graph.Graph.is_class_type_path_visible: \
invalid class type path"letis_module_type_ident_visibletid=letname=Ident.nameidinmatchString_map.findnamet.module_type_nameswith|exceptionNot_found->false|Localid'->Ident.equalidid'|Globalid'->Ident.equalidid'|Unambiguousid'->Ident.equalidid'|Ambiguous(id',ids)->ifnot(Ident.equalidid')thenfalseelsebeginletpaths=List.map(canonical_module_type_patht)idsinletpath=canonical_module_type_pathtidinList.for_all(Path.equalpath)pathsendletis_module_type_path_visiblet=function|Path.Pidentid->is_module_type_ident_visibletid|Path.Pdot(path,_)->is_module_path_visibletpath|Path.Papply_|Path.Pextra_ty_->failwith"Short_paths_graph.Graph.is_module_type_path_visible: \
invalid module type path"endtypegraph=Graph.t