12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618moduleMaps=Odoc_model.Paths.Identifier.MapsmoduleModuleMap=Map.Make(structtypet=Ident.module_letcompareab=Ident.compare(a:>Ident.any)(b:>Ident.any)end)moduleTypeMap=Map.Make(structtypet=Ident.type_letcompareab=Ident.compare(a:>Ident.any)(b:>Ident.any)end)modulePathModuleMap=Map.Make(structtypet=Ident.path_moduleletcompareab=Ident.compare(a:>Ident.any)(b:>Ident.any)end)moduleModuleTypeMap=Map.Make(structtypet=Ident.module_typeletcompareab=Ident.compare(a:>Ident.any)(b:>Ident.any)end)modulePathTypeMap=Map.Make(structtypet=Ident.path_typeletcompareab=Ident.compare(a:>Ident.any)(b:>Ident.any)end)modulePathValueMap=Map.Make(structtypet=Ident.path_valueletcompareab=Ident.compare(a:>Ident.any)(b:>Ident.any)end)modulePathClassTypeMap=Map.Make(structtypet=Ident.path_class_typeletcompareab=Ident.compare(a:>Ident.any)(b:>Ident.any)end)moduleIdentMap=Map.Make(structtypet=Ident.anyletcompare=Ident.compareend)moduleDelayed=structleteager=reffalsetype'at={mutablev:'aoption;mutableget:(unit->'a)option}letget:'at->'a=funx->match(x.v,x.get)with|Somex,_->x|None,Someget->letv=get()inx.v<-Somev;x.get<-None;v|_,_->failwith"bad delayed"letput:(unit->'a)->'at=funf->if!eagerthen{v=Some(f());get=None}else{v=None;get=Somef}letput_val:'a->'at=funv->{v=Somev;get=None}endmoduleOpt=structletmapf=functionSomex->Some(fx)|None->NoneendmodulerecModule:sigtypedecl=|AliasofCpath.module_*ModuleType.simple_expansionoption|ModuleTypeofModuleType.exprtypet={locs:Odoc_model.Paths.Identifier.SourceLocation.toption;doc:CComment.docs;type_:decl;canonical:Odoc_model.Paths.Path.Module.toption;hidden:bool;}end=ModuleandModuleSubstitution:sigtypet={doc:CComment.docs;manifest:Cpath.module_}end=ModuleSubstitutionandModuleTypeSubstitution:sigtypet={doc:CComment.docs;manifest:ModuleType.expr}end=ModuleTypeSubstitutionandTypeExpr:sigmodulePolymorphic_variant:sigtypekind=Odoc_model.Lang.TypeExpr.Polymorphic_variant.kindmoduleConstructor:sigtypet={name:string;constant:bool;arguments:TypeExpr.tlist;doc:CComment.docs;}endtypeelement=TypeofTypeExpr.t|ConstructorofConstructor.ttypet={kind:kind;elements:elementlist}endmoduleObject:sigtypemethod_={name:string;type_:TypeExpr.t}typefield=Methodofmethod_|InheritofTypeExpr.ttypet={fields:fieldlist;open_:bool}endmodulePackage:sigtypesubstitution=Cfrag.type_*TypeExpr.ttypet={path:Cpath.module_type;substitutions:substitutionlist}endtypelabel=Odoc_model.Lang.TypeExpr.labeltypet=|Varofstring|Any|Aliasoft*string|Arrowoflabeloption*t*t|Tupleoftlist|ConstrofCpath.type_*tlist|Polymorphic_variantofTypeExpr.Polymorphic_variant.t|ObjectofTypeExpr.Object.t|ClassofCpath.class_type*tlist|Polyofstringlist*t|PackageofTypeExpr.Package.tend=TypeExprandExtension:sigmoduleConstructor:sigtypet={name:string;locs:Odoc_model.Paths.Identifier.SourceLocation.toption;doc:CComment.docs;args:TypeDecl.Constructor.argument;res:TypeExpr.toption;}endtypet={type_path:Cpath.type_;doc:CComment.docs;type_params:TypeDecl.paramlist;private_:bool;constructors:Constructor.tlist;}end=ExtensionandException:sigtypet={locs:Odoc_model.Paths.Identifier.SourceLocation.toption;doc:CComment.docs;args:TypeDecl.Constructor.argument;res:TypeExpr.toption;}end=ExceptionandFunctorParameter:sigtypeparameter={id:Ident.functor_parameter;expr:ModuleType.expr}typet=Namedofparameter|Unitend=FunctorParameterandModuleType:sigtypesubstitution=|ModuleEqofCfrag.module_*Module.decl|ModuleSubstofCfrag.module_*Cpath.module_|ModuleTypeEqofCfrag.module_type*ModuleType.expr|ModuleTypeSubstofCfrag.module_type*ModuleType.expr|TypeEqofCfrag.type_*TypeDecl.Equation.t|TypeSubstofCfrag.type_*TypeDecl.Equation.ttypetype_of_desc=|ModPathofCpath.module_|StructIncludeofCpath.module_typesimple_expansion=|SignatureofSignature.t|FunctorofFunctorParameter.t*simple_expansiontypetypeof_t={t_desc:type_of_desc;t_expansion:simple_expansionoption;}moduleU:sigtypeexpr=|PathofCpath.module_type|SignatureofSignature.t|Withofsubstitutionlist*expr|TypeOfoftypeof_tendtypepath_t={p_expansion:simple_expansionoption;p_path:Cpath.module_type;}typewith_t={w_substitutions:substitutionlist;w_expansion:simple_expansionoption;w_expr:U.expr;}typeexpr=|Pathofpath_t|SignatureofSignature.t|Withofwith_t|FunctorofFunctorParameter.t*expr|TypeOfoftypeof_ttypet={locs:Odoc_model.Paths.Identifier.SourceLocation.toption;doc:CComment.docs;canonical:Odoc_model.Paths.Path.ModuleType.toption;expr:exproption;}end=ModuleTypeandTypeDecl:sigmoduleField:sigtypet={name:string;doc:CComment.docs;mutable_:bool;type_:TypeExpr.t;}endmoduleConstructor:sigtypeargument=TupleofTypeExpr.tlist|RecordofField.tlisttypet={name:string;doc:CComment.docs;args:argument;res:TypeExpr.toption;}endmoduleRepresentation:sigtypet=|VariantofConstructor.tlist|RecordofField.tlist|Extensibleendtypeparam=Odoc_model.Lang.TypeDecl.parammoduleEquation:sigtypet={params:paramlist;private_:bool;manifest:TypeExpr.toption;constraints:(TypeExpr.t*TypeExpr.t)list;}endtypet={locs:Odoc_model.Paths.Identifier.SourceLocation.toption;doc:CComment.docs;canonical:Odoc_model.Paths.Path.Type.toption;equation:Equation.t;representation:Representation.toption;}end=TypeDeclandValue:sigtypevalue=Odoc_model.Lang.Value.valuetypet={locs:Odoc_model.Paths.Identifier.SourceLocation.toption;doc:CComment.docs;type_:TypeExpr.t;value:value;}end=ValueandSignature:sigtyperecursive=Odoc_model.Lang.Signature.recursivetypeitem=|ModuleofIdent.module_*recursive*Module.tDelayed.t|ModuleSubstitutionofIdent.module_*ModuleSubstitution.t|ModuleTypeofIdent.module_type*ModuleType.tDelayed.t|ModuleTypeSubstitutionofIdent.module_type*ModuleTypeSubstitution.t|TypeofIdent.type_*recursive*TypeDecl.tDelayed.t|TypeSubstitutionofIdent.type_*TypeDecl.t|ExceptionofIdent.exception_*Exception.t|TypExtofExtension.t|ValueofIdent.value*Value.tDelayed.t|ClassofIdent.class_*recursive*Class.t|ClassTypeofIdent.class_type*recursive*ClassType.t|IncludeofInclude.t|OpenofOpen.t|CommentofCComment.docs_or_stop(* When doing destructive substitution we keep track of the items that have been removed,
and the path they've been substituted with *)typeremoved_item=|RModuleofIdent.module_*Cpath.Resolved.module_|RTypeofIdent.type_*TypeExpr.t*TypeDecl.Equation.t(** [RType (_, texpr, eq)], [eq.manifest = Some texpr] *)|RModuleTypeofIdent.module_type*ModuleType.exprtypet={items:itemlist;compiled:bool;removed:removed_itemlist;doc:CComment.docs;}end=SignatureandOpen:sigtypet={expansion:Signature.t;doc:CComment.docs}end=OpenandInclude:sigtypedecl=AliasofCpath.module_|ModuleTypeofModuleType.U.exprtypet={parent:Odoc_model.Paths.Identifier.Signature.t;strengthened:Cpath.module_option;doc:CComment.docs;status:[`Default|`Inline|`Closed|`Open];shadowed:Odoc_model.Lang.Include.shadowed;expansion_:Signature.t;decl:decl;loc:Odoc_model.Location_.span;}end=IncludeandClass:sigtypedecl=|ClassTypeofClassType.expr|ArrowofTypeExpr.labeloption*TypeExpr.t*decltypet={locs:Odoc_model.Paths.Identifier.SourceLocation.toption;doc:CComment.docs;virtual_:bool;params:TypeDecl.paramlist;type_:decl;expansion:ClassSignature.toption;}end=ClassandClassType:sigtypeexpr=|ConstrofCpath.class_type*TypeExpr.tlist|SignatureofClassSignature.ttypet={locs:Odoc_model.Paths.Identifier.SourceLocation.toption;doc:CComment.docs;virtual_:bool;params:TypeDecl.paramlist;expr:expr;expansion:ClassSignature.toption;}end=ClassTypeandClassSignature:sigmoduleConstraint:sigtypet={left:TypeExpr.t;right:TypeExpr.t;doc:CComment.docs}endmoduleInherit:sigtypet={expr:ClassType.expr;doc:CComment.docs}endtypeitem=|MethodofIdent.method_*Method.t|InstanceVariableofIdent.instance_variable*InstanceVariable.t|ConstraintofConstraint.t|InheritofInherit.t|CommentofCComment.docs_or_stoptypet={self:TypeExpr.toption;items:itemlist;doc:CComment.docs}end=ClassSignatureandMethod:sigtypet={doc:CComment.docs;private_:bool;virtual_:bool;type_:TypeExpr.t;}end=MethodandInstanceVariable:sigtypet={doc:CComment.docs;mutable_:bool;virtual_:bool;type_:TypeExpr.t;}end=InstanceVariableandSubstitution:sigtypesubst_module=[`PrefixedofCpath.module_*Cpath.Resolved.module_|`Substituted|`RenamedofIdent.path_module]typesubst_module_type=[`PrefixedofCpath.module_type*Cpath.Resolved.module_type|`RenamedofIdent.module_type]typesubst_type=[`PrefixedofCpath.type_*Cpath.Resolved.type_|`RenamedofIdent.path_type]typesubst_class_type=[`PrefixedofCpath.class_type*Cpath.Resolved.class_type|`RenamedofIdent.path_class_type]typet={module_:subst_modulePathModuleMap.t;module_type:subst_module_typeModuleTypeMap.t;type_:subst_typePathTypeMap.t;class_type:subst_class_typePathClassTypeMap.t;type_replacement:(TypeExpr.t*TypeDecl.Equation.t)PathTypeMap.t;module_type_replacement:ModuleType.exprModuleTypeMap.t;path_invalidating_modules:Ident.path_modulelist;module_type_of_invalidating_modules:Ident.path_modulelist;unresolve_opaque_paths:bool;}end=SubstitutionandCComment:sigtypeblock_element=[Odoc_model.Comment.nestable_block_element|`HeadingofLabel.t|`TagofOdoc_model.Comment.tag]typedocs=block_elementOdoc_model.Comment.with_locationlisttypedocs_or_stop=[`Docsofdocs|`Stop]end=CCommentandLabel:sigtypet={attrs:Odoc_model.Comment.heading_attrs;label:Ident.label;text:Odoc_model.Comment.paragraph;location:Odoc_model.Location_.span;}end=LabelmoduleElement=structopenOdoc_model.Pathstypemodule_=[`ModuleofIdentifier.Path.Module.t*Module.tDelayed.t]typemodule_type=[`ModuleTypeofIdentifier.ModuleType.t*ModuleType.t]typedatatype=[`TypeofIdentifier.Type.t*TypeDecl.t]typevalue=[`ValueofIdentifier.Value.t*Value.t]typelabel=[`LabelofIdentifier.Label.t*Label.t]typeclass_=[`ClassofIdentifier.Class.t*Class.t]typeclass_type=[`ClassTypeofIdentifier.ClassType.t*ClassType.t]typetype_=[datatype|class_|class_type]typesignature=[module_|module_type]typeconstructor=[`ConstructorofIdentifier.Constructor.t*TypeDecl.Constructor.t]typeexception_=[`ExceptionofIdentifier.Exception.t*Exception.t]typeextension=[`ExtensionofIdentifier.Extension.t*Extension.Constructor.t*Extension.t]typeextension_decl=[`ExtensionDeclofIdentifier.Extension.t*Extension.Constructor.t]typefield=[`FieldofIdentifier.Field.t*TypeDecl.Field.t](* No component for pages yet *)typepage=[`PageofIdentifier.Page.t*Odoc_model.Lang.Page.t]typelabel_parent=[signature|type_|page]typefragment_type_parent=[signature|datatype]typeany=[signature|value|datatype|label|class_|class_type|constructor|exception_|extension|extension_decl|field|page]letidentifier:[<any]->Odoc_model.Paths.Identifier.t=letopenOdoc_model.Paths.Identifierinfunction|`Module(id,_)->(id:>t)|`ModuleType(id,_)->(id:>t)|`Type(id,_)->(id:>t)|`ClassType(id,_)->(id:>t)|`Class(id,_)->(id:>t)|`Value(id,_)->(id:>t)|`Label(id,_)->(id:>t)|`Constructor(id,_)->(id:>t)|`Exception(id,_)->(id:>t)|`Field(id,_)->(id:>t)|`Extension(id,_,_)->(id:>t)|`ExtensionDecl(id,_)->(id:>t)|`Page(id,_)->(id:>t)endmoduleFmt=structopenOdoc_model.Namesletfpf=Format.fprintfletfpp_optfmtpp_appf=function|Somet->fpfppffmtpp_at|None->()letfpp_listfmt_sepfmt_outerpp_appft=letpp_sepppf()=fpfppffmt_sepinmatchtwith|[]->()|t->fpfppffmt_outer(Format.pp_print_list~pp_seppp_a)tletrecsignatureppfsg=letopenSignatureinFormat.fprintfppf"@[<v>";List.iter(function|Module(id,_,m)->Format.fprintfppf"@[<v 2>module %a %a@]@,"Ident.fmtidmodule_(Delayed.getm)|ModuleSubstitution(id,m)->Format.fprintfppf"@[<v 2>module %a := %a@]@,"Ident.fmtidmodule_pathm.ModuleSubstitution.manifest|ModuleType(id,mt)->Format.fprintfppf"@[<v 2>module type %a %a@]@,"Ident.fmtidmodule_type(Delayed.getmt)|ModuleTypeSubstitution(id,mts)->Format.fprintfppf"@[<v 2>module type %a := %a@]@,"Ident.fmtidmodule_type_exprmts.ModuleTypeSubstitution.manifest|Type(id,_,t)->Format.fprintfppf"@[<v 2>type %a%a@]@,"Ident.fmtidtype_decl(Delayed.gett)|TypeSubstitution(id,t)->Format.fprintfppf"@[<v 2>type %a :=%a@]@,"Ident.fmtidtype_declt|Exception(id,e)->Format.fprintfppf"@[<v 2>exception %a %a@]@,"Ident.fmtidexception_e|TypExte->Format.fprintfppf"@[<v 2>type_extension %a@]@,"extensione|Value(id,v)->Format.fprintfppf"@[<v 2>val %a %a@]@,"Ident.fmtidvalue(Delayed.getv)|Class(id,_,c)->Format.fprintfppf"@[<v 2>class %a %a@]@,"Ident.fmtidclass_c|ClassType(id,_,c)->Format.fprintfppf"@[<v 2>class type %a %a@]@,"Ident.fmtidclass_typec|Includei->Format.fprintfppf"@[<v 2>include %a@]@,"include_i|Openo->Format.fprintfppf"open [ %a ]"signatureo.expansion|Comment_c->())sg.items;Format.fprintfppf"@] (removed=[%a])"removed_item_listsg.removedandoption:typea.(Format.formatter->a->unit)->Format.formatter->aoption->unit=funppppfx->matchxwith|Somex->Format.fprintfppf"Some(%a)"ppx|None->Format.fprintfppf"None"andclass_signatureppfsg=letopenClassSignatureinFormat.fprintfppf"@[<v>self=%a@,"(optiontype_expr)sg.self;List.iter(function|Method(id,m)->Format.fprintfppf"@[<v 2>method %a : %a@]@,"Ident.fmtidmethod_m|InstanceVariable(id,i)->Format.fprintfppf"@[<v 2>instance variable %a : %a@]@,"Ident.fmtidinstance_variablei|Constraintcst->Format.fprintfppf"@[<v 2>constraint %a = %a@]@,"type_exprcst.Constraint.lefttype_exprcst.right|Inheriti->Format.fprintfppf"@[<v 2>inherit %a"class_type_expri.Inherit.expr|Comment_->())sg.itemsandmethod_ppfm=letopenMethodinFormat.fprintfppf"%s%s%a"(ifm.private_then"private "else"")(ifm.virtual_then"virtual "else"")type_exprm.type_andinstance_variableppfi=letopenInstanceVariableinFormat.fprintfppf"%s%s%a"(ifi.mutable_then"mutable "else"")(ifi.virtual_then"virtual "else"")type_expri.type_andlistppppfls=matchlswith|x::y::rest->Format.fprintfppf"%a, %a"ppx(listpp)(y::rest)|[x]->Format.fprintfppf"%a"ppx|[]->()andclass_type_exprppfc=letopenClassTypeinmatchcwith|Constr(p,ts)->Format.fprintfppf"constr(%a,%a)"class_type_pathp(listtype_expr)ts|Signaturesg->Format.fprintfppf"(%a)"class_signaturesgandremoved_itemppfr=letopenSignatureinmatchrwith|RModule(id,path)->Format.fprintfppf"module %a (%a)"Ident.fmtidresolved_module_pathpath|RType(id,texpr,eq)->Format.fprintfppf"type %a %a = (%a)"type_paramseq.paramsIdent.fmtidtype_exprtexpr|RModuleType(id,mty)->Format.fprintfppf"module type %a = %a"Ident.fmtidmodule_type_exprmtyandremoved_item_listppfr=matchrwith|[]->()|[x]->Format.fprintfppf"%a"removed_itemx|x::ys->Format.fprintfppf"%a;%a"removed_itemxremoved_item_listysandclass_declppfc=letopenClassinmatchcwith|ClassTypecty->Format.fprintfppf"%a"class_type_exprcty|Arrow(lbl,ty,decl)->Format.fprintfppf"%a%a -> %a"type_expr_labellbltype_exprtyclass_decldeclandclass_ppfc=Format.fprintfppf"%a"class_declc.type_andclass_typeppf_c=Format.fprintfppf"<todo>"andinclude_ppfi=Format.fprintfppf"%a (sig = %a)"include_decli.declsignaturei.expansion_andinclude_declppf=letopenIncludeinfunction|Aliasp->Format.fprintfppf"= %a"module_pathp|ModuleTypemt->Format.fprintfppf": %a"u_module_type_exprmtandvalueppfv=letopenValueinFormat.fprintfppf": %a"type_exprv.type_andmodule_declppfd=letopenModuleinmatchdwith|Alias(p,_)->Format.fprintfppf"= %a"module_pathp|ModuleTypemt->Format.fprintfppf": %a"module_type_exprmtandmodule_ppfm=Format.fprintfppf"%a (canonical=%a)"module_declm.type_(optionmodel_path)(m.canonical:>Odoc_model.Paths.Path.toption)andsimple_expansionppf(m:ModuleType.simple_expansion)=matchmwith|ModuleType.Signaturesg->Format.fprintfppf"sig: %a"signaturesg|Functor(arg,sg)->Format.fprintfppf"functor: (%a) -> %a"functor_parameterargsimple_expansionsgandmodule_typeppfmt=matchmt.exprwith|Somex->Format.fprintfppf"= %a"module_type_exprx|None->()andmodule_type_type_of_descppft=matchtwith|ModuleType.ModPathp->Format.fprintfppf"module type of %a"module_pathp|StructIncludep->Format.fprintfppf"module type of struct include %a end"module_pathpandu_module_type_exprppfmt=letopenModuleType.Uinmatchmtwith|Pathp->module_type_pathppfp|Signaturesg->Format.fprintfppf"sig@,@[<v 2>%a@]end"signaturesg|With(subs,e)->Format.fprintfppf"%a with [%a]"u_module_type_expresubstitution_listsubs|TypeOf{t_desc;_}->module_type_type_of_descppft_descandmodule_type_exprppfmt=letopenModuleTypeinmatchmtwith|Path{p_path;_}->module_type_pathppfp_path|Signaturesg->Format.fprintfppf"sig@,@[<v 2>%a@]end"signaturesg|With{w_substitutions=subs;w_expr;_}->Format.fprintfppf"%a with [%a]"u_module_type_exprw_exprsubstitution_listsubs|Functor(arg,res)->Format.fprintfppf"(%a) -> %a"functor_parameterargmodule_type_exprres|TypeOf{t_desc=ModPathp;_}->Format.fprintfppf"module type of %a"module_pathp|TypeOf{t_desc=StructIncludep;_}->Format.fprintfppf"module type of struct include %a end"module_pathpandfunctor_parameterppfx=letopenFunctorParameterinmatchxwith|Unit->()|Namedx->Format.fprintfppf"%a"functor_parameter_parameterxandfunctor_parameter_parameterppfx=Format.fprintfppf"%a : %a"Ident.fmtx.FunctorParameter.idmodule_type_exprx.FunctorParameter.exprandtype_declppft=letopenTypeDeclinmatcht.representationwith|Somerepr->Format.fprintfppf"%a = %a"(fpp_opt" : %a"type_expr)t.equation.Equation.manifesttype_decl_reprrepr|None->(fpp_opt" = %a"type_expr)ppft.equation.Equation.manifestandtype_decl_reprppf=letopenTypeDecl.Representationinfunction|Variantcs->fpp_list" | ""%a"type_decl_constructorppfcs|Recordfs->type_decl_fieldsppffs|Extensible->Format.fprintfppf".."andtype_decl_constructorppft=letopenTypeDecl.Constructorinmatcht.reswith|Someres->fpfppf"%s : %a -> %a"t.nametype_decl_constructor_argt.argstype_exprres|None->fpfppf"%s of %a"t.nametype_decl_constructor_argt.argsandtype_decl_constructor_argppf=letopenTypeDecl.Constructorinfunction|Tuplets->type_tupleppfts|Recordfs->type_decl_fieldsppffsandtype_decl_fieldppft=letopenTypeDecl.Fieldinletmutable_=ift.mutable_then"mutable "else""infpfppf"%s%s : %a"mutable_t.nametype_exprt.type_andtype_decl_fieldsppffs=fpp_list"; ""{ %a }"type_decl_fieldppffsandtype_tupleppfts=fpp_list" * ""%a"type_exprppftsandtype_paramppft=letdesc=matcht.Odoc_model.Lang.TypeDecl.descwithAny->"_"|Varn->nandvariance=matcht.variancewithSomePos->"+"|SomeNeg->"-"|None->""andinjectivity=ift.injectivitythen"!"else""inFormat.fprintfppf"%s%s%s"varianceinjectivitydescandtype_paramsppfts=letpp_sepppf()=Format.fprintfppf", "inFormat.fprintfppf"(%a)"(Format.pp_print_list~pp_septype_param)tsandtype_equationppft=matcht.TypeDecl.Equation.manifestwith|None->()|Somem->Format.fprintfppf" = %a"type_exprmandexception__ppf_e=()andextensionppfe=Format.fprintfppf"%a"type_pathe.Extension.type_pathandsubstitutionppft=letopenModuleTypeinmatchtwith|ModuleEq(frag,decl)->Format.fprintfppf"%a = %a"module_fragmentfragmodule_decldecl|ModuleSubst(frag,mpath)->Format.fprintfppf"%a := %a"module_fragmentfragmodule_pathmpath|ModuleTypeEq(frag,mty)->Format.fprintfppf"%a = %a"module_type_fragmentfragmodule_type_exprmty|ModuleTypeSubst(frag,mty)->Format.fprintfppf"%a := %a"module_type_fragmentfragmodule_type_exprmty|TypeEq(frag,decl)->Format.fprintfppf"%a%a"type_fragmentfragtype_equationdecl|TypeSubst(frag,decl)->Format.fprintfppf"%a%a"type_fragmentfragtype_equationdeclandsubstitution_listppfl=matchlwith|[sub]->Format.fprintfppf"%a"substitutionsub|sub::subs->Format.fprintfppf"%a; %a"substitutionsubsubstitution_listsubs|[]->()andtype_expr_labelppfl=matchlwith|Some(Odoc_model.Lang.TypeExpr.Labell)->Format.fprintfppf"%s:"l|Some(Optionalo)->Format.fprintfppf"?%s:"o|None->()andtype_expr_listppfl=matchlwith|[t]->Format.fprintfppf"%a"type_exprt|t::ts->Format.fprintfppf"%a * %a"type_exprttype_expr_listts|[]->()andtype_objectppf_o=Format.fprintfppf"(object)"andtype_classppf(x,ys)=Format.fprintfppf"(class %a %a)"class_type_pathxtype_expr_listysandtype_packageppf_p=Format.fprintfppf"(package)"andtype_expr_polymorphic_variantppfp=letopenTypeExpr.Polymorphic_variantinletpp_elementppf=function|Typet->type_exprppft|Constructorc->fpfppf"`%s%a"c.Constructor.name(fpp_list" * "" of %a"type_expr)c.argumentsinletpp_elements=fpp_list" | ""%a"pp_elementinmatchp.kindwith|Fixed->fpfppf"[ %a ]"pp_elementsp.elements|Closedxs->fpfppf"[ %a > %a ]"pp_elementsp.elements(fpp_list" ""%a"Format.pp_print_string)xs|Open->fpfppf"[> %a ]"pp_elementsp.elementsandtype_exprppfe=letopenTypeExprinmatchewith|Varx->Format.fprintfppf"%s"x|Any->Format.fprintfppf"_"|Alias(x,y)->Format.fprintfppf"(alias %a %s)"type_exprxy|Arrow(l,t1,t2)->Format.fprintfppf"%a(%a) -> %a"type_expr_labelltype_exprt1type_exprt2|Tuplets->Format.fprintfppf"(%a)"type_expr_listts|Constr(p,args)->(matchargswith|[]->Format.fprintfppf"%a"type_pathp|_->Format.fprintfppf"[%a] %a"type_expr_listargstype_pathp)|Polymorphic_variantpoly->Format.fprintfppf"(poly_var %a)"type_expr_polymorphic_variantpoly|Objectx->type_objectppfx|Class(x,y)->type_classppf(x,y)|Poly(_ss,_t)->Format.fprintfppf"(poly)"|Packagex->type_packageppfxandresolved_module_path:Format.formatter->Cpath.Resolved.module_->unit=funppfp->matchpwith|`Localident->Format.fprintfppf"%a"Ident.fmtident|`Apply(p1,p2)->Format.fprintfppf"%a(%a)"resolved_module_pathp1resolved_module_pathp2|`Gpathp->Format.fprintfppf"%a"model_resolved_path(p:>Odoc_model.Paths.Path.Resolved.t)|`Substitutedp->Format.fprintfppf"substituted(%a)"resolved_module_pathp|`Module(p,m)->Format.fprintfppf"%a.%s"resolved_parent_pathp(Odoc_model.Names.ModuleName.to_stringm)|`Alias(p1,p2,_)->Format.fprintfppf"alias(%a,%a)"resolved_module_pathp1module_pathp2|`Subst(p1,p2)->Format.fprintfppf"subst(%a,%a)"resolved_module_type_pathp1resolved_module_pathp2|`Hiddenp1->Format.fprintfppf"hidden(%a)"resolved_module_pathp1|`Canonical(p1,p2)->Format.fprintfppf"canonical(%a,%a)"resolved_module_pathp1model_path(p2:>Odoc_model.Paths.Path.t)|`OpaqueModulem->Format.fprintfppf"opaquemodule(%a)"resolved_module_pathmandmodule_path:Format.formatter->Cpath.module_->unit=funppfp->matchpwith|`Resolvedp->Format.fprintfppf"r(%a)"resolved_module_pathp|`Dot(p,str)->Format.fprintfppf"%a.%s"module_pathpstr|`Module(p,n)->Format.fprintfppf"%a.%a"resolved_parent_pathpModuleName.fmtn|`Apply(p1,p2)->Format.fprintfppf"%a(%a)"module_pathp1module_pathp2|`Identifier(id,b)->Format.fprintfppf"identifier(%a, %b)"model_identifier(id:>Odoc_model.Paths.Identifier.t)b|`Local(id,b)->Format.fprintfppf"local(%a,%b)"Ident.fmtidb|`Substitutedp->Format.fprintfppf"substituted(%a)"module_pathp|`Forwards->Format.fprintfppf"forward(%s)"s|`Rootr->Format.fprintfppf"unresolvedroot(%s)"randresolved_module_type_path:Format.formatter->Cpath.Resolved.module_type->unit=funppfp->matchpwith|`Localid->Format.fprintfppf"%a"Ident.fmtid|`Gpathp->Format.fprintfppf"%a"model_resolved_path(p:>Odoc_model.Paths.Path.Resolved.t)|`Substitutedx->Format.fprintfppf"substituted(%a)"resolved_module_type_pathx|`ModuleType(p,m)->Format.fprintfppf"%a.%s"resolved_parent_pathp(ModuleTypeName.to_stringm)|`CanonicalModuleType(m1,m2)->Format.fprintfppf"canonicalt(%a,%a)"resolved_module_type_pathm1model_path(m2:>Odoc_model.Paths.Path.t)|`OpaqueModuleTypem->Format.fprintfppf"opaquemoduletype(%a)"resolved_module_type_pathm|`AliasModuleType(mt1,mt2)->Format.fprintfppf"aliasmoduletype(%a,%a)"resolved_module_type_pathmt1resolved_module_type_pathmt2|`SubstT(mt1,mt2)->Format.fprintfppf"subst(%a,%a)"resolved_module_type_pathmt1resolved_module_type_pathmt2andmodule_type_path:Format.formatter->Cpath.module_type->unit=funppfm->matchmwith|`Resolvedp->Format.fprintfppf"r(%a)"resolved_module_type_pathp|`Identifier(id,b)->Format.fprintfppf"identifier(%a, %b)"model_identifier(id:>Odoc_model.Paths.Identifier.t)b|`Local(id,b)->Format.fprintfppf"local(%a,%b)"Ident.fmtidb|`Substituteds->Format.fprintfppf"substituted(%a)"module_type_paths|`Dot(m,s)->Format.fprintfppf"%a.%s"module_pathms|`ModuleType(m,n)->Format.fprintfppf"%a.%a"resolved_parent_pathmModuleTypeName.fmtnandresolved_type_path:Format.formatter->Cpath.Resolved.type_->unit=funppfp->matchpwith|`Localid->Format.fprintfppf"%a"Ident.fmtid|`Gpathp->Format.fprintfppf"%a"model_resolved_path(p:>Odoc_model.Paths.Path.Resolved.t)|`Substitutedx->Format.fprintfppf"substituted(%a)"resolved_type_pathx|`CanonicalType(t1,t2)->Format.fprintfppf"canonicalty(%a,%a)"resolved_type_patht1model_path(t2:>Odoc_model.Paths.Path.t)|`Class(p,t)->Format.fprintfppf"%a.%s"resolved_parent_pathp(Odoc_model.Names.ClassName.to_stringt)|`ClassType(p,t)->Format.fprintfppf"%a.%s"resolved_parent_pathp(Odoc_model.Names.ClassTypeName.to_stringt)|`Type(p,t)->Format.fprintfppf"%a.%s"resolved_parent_pathp(Odoc_model.Names.TypeName.to_stringt)andresolved_datatype_path:Format.formatter->Cpath.Resolved.datatype->unit=funppfp->matchpwith|`Localid->Format.fprintfppf"%a"Ident.fmtid|`Gpathp->Format.fprintfppf"%a"model_resolved_path(p:>Odoc_model.Paths.Path.Resolved.t)|`Substitutedx->Format.fprintfppf"substituted(%a)"resolved_datatype_pathx|`CanonicalDataType(t1,t2)->Format.fprintfppf"canonicalty(%a,%a)"resolved_datatype_patht1model_path(t2:>Odoc_model.Paths.Path.t)|`Type(p,t)->Format.fprintfppf"%a.%s"resolved_parent_pathp(Odoc_model.Names.TypeName.to_stringt)andresolved_value_path:Format.formatter->Cpath.Resolved.value->unit=funppfp->matchpwith|`Value(p,t)->Format.fprintfppf"%a.%s"resolved_parent_pathp(Odoc_model.Names.ValueName.to_stringt)andresolved_constructor_path:Format.formatter->Cpath.Resolved.constructor->unit=funppfp->matchpwith|`Constructor(p,t)->Format.fprintfppf"%a.%s"resolved_datatype_pathp(Odoc_model.Names.ConstructorName.to_stringt)andresolved_parent_path:Format.formatter->Cpath.Resolved.parent->unit=funppfp->matchpwith|`Modulem->resolved_module_pathppfm|`ModuleTypem->Format.fprintfppf">>%a<<"resolved_module_type_pathm|`FragmentRoot->Format.fprintfppf"FragmentRoot"andtype_path:Format.formatter->Cpath.type_->unit=funppfp->matchpwith|`Resolvedr->Format.fprintfppf"r(%a)"resolved_type_pathr|`Identifier(id,b)->Format.fprintfppf"identifier(%a, %b)"model_identifier(id:>Odoc_model.Paths.Identifier.t)b|`Local(id,b)->Format.fprintfppf"local(%a,%b)"Ident.fmtidb|`Substituteds->Format.fprintfppf"substituted(%a)"type_paths|`Dot(m,s)->Format.fprintfppf"%a.%s"module_pathms|`Class(p,t)->Format.fprintfppf"%a.%s"resolved_parent_pathp(Odoc_model.Names.ClassName.to_stringt)|`ClassType(p,t)->Format.fprintfppf"%a.%s"resolved_parent_pathp(Odoc_model.Names.ClassTypeName.to_stringt)|`Type(p,t)->Format.fprintfppf"%a.%s"resolved_parent_pathp(Odoc_model.Names.TypeName.to_stringt)anddatatype_path:Format.formatter->Cpath.datatype->unit=funppfp->matchpwith|`Resolvedr->Format.fprintfppf"r(%a)"resolved_datatype_pathr|`Identifier(id,b)->Format.fprintfppf"identifier(%a, %b)"model_identifier(id:>Odoc_model.Paths.Identifier.t)b|`Local(id,b)->Format.fprintfppf"local(%a,%b)"Ident.fmtidb|`Substituteds->Format.fprintfppf"substituted(%a)"datatype_paths|`Dot(m,s)->Format.fprintfppf"%a.%s"module_pathms|`Type(p,t)->Format.fprintfppf"%a.%s"resolved_parent_pathp(Odoc_model.Names.TypeName.to_stringt)andvalue_path:Format.formatter->Cpath.value->unit=funppfp->matchpwith|`Resolvedr->Format.fprintfppf"r(%a)"resolved_value_pathr|`Dot(m,s)->Format.fprintfppf"%a.%s"module_pathms|`Value(p,t)->Format.fprintfppf"%a.%s"resolved_parent_pathp(Odoc_model.Names.ValueName.to_stringt)andconstructor_path:Format.formatter->Cpath.constructor->unit=funppfp->matchpwith|`Resolvedr->Format.fprintfppf"r(%a)"resolved_constructor_pathr|`Dot(m,s)->Format.fprintfppf"%a.%s"datatype_pathms|`Constructor(p,t)->Format.fprintfppf"%a.%s"resolved_datatype_pathp(Odoc_model.Names.ConstructorName.to_stringt)andresolved_class_type_path:Format.formatter->Cpath.Resolved.class_type->unit=funppfp->matchpwith|`Localid->Format.fprintfppf"%a"Ident.fmtid|`Gpathp->Format.fprintfppf"%a"model_resolved_path(p:>Odoc_model.Paths.Path.Resolved.t)|`Substituteds->Format.fprintfppf"substituted(%a)"resolved_class_type_paths|`Class(p,t)->Format.fprintfppf"%a.%s"resolved_parent_pathp(Odoc_model.Names.ClassName.to_stringt)|`ClassType(p,t)->Format.fprintfppf"%a.%s"resolved_parent_pathp(Odoc_model.Names.ClassTypeName.to_stringt)andclass_type_path:Format.formatter->Cpath.class_type->unit=funppfp->matchpwith|`Resolvedr->Format.fprintfppf"%a"resolved_class_type_pathr|`Identifier(id,b)->Format.fprintfppf"identifier(%a, %b)"model_identifier(id:>Odoc_model.Paths.Identifier.t)b|`Local(id,b)->Format.fprintfppf"local(%a,%b)"Ident.fmtidb|`Substituteds->Format.fprintfppf"substituted(%a)"class_type_paths|`Dot(m,s)->Format.fprintfppf"%a.%s"module_pathms|`Class(p,t)->Format.fprintfppf"%a.%s"resolved_parent_pathp(Odoc_model.Names.ClassName.to_stringt)|`ClassType(p,t)->Format.fprintfppf"%a.%s"resolved_parent_pathp(Odoc_model.Names.ClassTypeName.to_stringt)andmodel_path:Format.formatter->Odoc_model.Paths.Path.t->unit=funppf(p:Odoc_model.Paths.Path.t)->matchpwith|`Resolvedrp->Format.fprintfppf"r(%a)"model_resolved_pathrp|`Identifier(id,b)->Format.fprintfppf"identifier(%a, %b)"model_identifier(id:>Odoc_model.Paths.Identifier.t)b|`Roots->Format.fprintfppf"root(%s)"s|`Forwards->Format.fprintfppf"forward(%s)"s|`Dot(parent,s)->Format.fprintfppf"%a.%s"model_path(parent:>Odoc_model.Paths.Path.t)s|`Apply(func,arg)->Format.fprintfppf"%a(%a)"model_path(func:>Odoc_model.Paths.Path.t)model_path(arg:>Odoc_model.Paths.Path.t)andmodel_resolved_pathppf(p:Odoc_model.Paths.Path.Resolved.t)=letopenOdoc_model.Paths.Path.Resolvedinmatchpwith|`Identifierid->Format.fprintfppf"%a"model_identifier(id:>Odoc_model.Paths.Identifier.t)|`Module(parent,name)->Format.fprintfppf"%a.%s"model_resolved_path(parent:>t)(Odoc_model.Names.ModuleName.to_stringname)|`ModuleType(parent,name)->Format.fprintfppf"%a.%s"model_resolved_path(parent:>t)(Odoc_model.Names.ModuleTypeName.to_stringname)|`Type(parent,name)->Format.fprintfppf"%a.%s"model_resolved_path(parent:>t)(Odoc_model.Names.TypeName.to_stringname)|`Constructor(parent,name)->Format.fprintfppf"%a.%s"model_resolved_path(parent:>t)(Odoc_model.Names.ConstructorName.to_stringname)|`Value(parent,name)->Format.fprintfppf"%a.%s"model_resolved_path(parent:>t)(Odoc_model.Names.ValueName.to_stringname)|`Alias(dest,src)->Format.fprintfppf"alias(%a,%a)"model_resolved_path(dest:>t)model_path(src:>Odoc_model.Paths.Path.t)|`AliasModuleType(path,realpath)->Format.fprintfppf"aliasmoduletype(%a,%a)"model_resolved_path(path:>t)model_resolved_path(realpath:>t)|`Subst(modty,m)->Format.fprintfppf"subst(%a,%a)"model_resolved_path(modty:>t)model_resolved_path(m:>t)|`SubstT(t1,t2)->Format.fprintfppf"substt(%a,%a)"model_resolved_path(t1:>t)model_resolved_path(t2:>t)|`CanonicalModuleType(t1,t2)->Format.fprintfppf"canonicalt(%a,%a)"model_resolved_path(t1:>t)model_path(t2:>Odoc_model.Paths.Path.t)|`CanonicalType(t1,t2)->Format.fprintfppf"canonicalty(%a,%a)"model_resolved_path(t1:>t)model_path(t2:>Odoc_model.Paths.Path.t)|`CanonicalDataType(t1,t2)->Format.fprintfppf"canonicaldaty(%a,%a)"model_resolved_path(t1:>t)model_path(t2:>Odoc_model.Paths.Path.t)|`Apply(funct,arg)->Format.fprintfppf"%a(%a)"model_resolved_path(funct:>t)model_resolved_path(arg:>t)|`Canonical(p1,p2)->Format.fprintfppf"canonical(%a,%a)"model_resolved_path(p1:>t)model_path(p2:>Odoc_model.Paths.Path.t)|`Hiddenp->Format.fprintfppf"hidden(%a)"model_resolved_path(p:>t)|`Class(parent,name)->Format.fprintfppf"%a.%s"model_resolved_path(parent:>t)(Odoc_model.Names.ClassName.to_stringname)|`ClassType(parent,name)->Format.fprintfppf"%a.%s"model_resolved_path(parent:>t)(Odoc_model.Names.ClassTypeName.to_stringname)|`OpaqueModulem->Format.fprintfppf"opaquemodule(%a)"model_resolved_path(m:>t)|`OpaqueModuleTypem->Format.fprintfppf"opaquemoduletype(%a)"model_resolved_path(m:>t)andmodel_identifierppf(p:Odoc_model.Paths.Identifier.t)=matchp.ivwith|`Root(_,unit_name)->Format.fprintfppf"(root %s)"(Odoc_model.Names.ModuleName.to_stringunit_name)|`Module(parent,name)->Format.fprintfppf"%a.%s"model_identifier(parent:>Odoc_model.Paths.Identifier.t)(Odoc_model.Names.ModuleName.to_stringname)|`ModuleType(parent,name)->Format.fprintfppf"%a.%s"model_identifier(parent:>Odoc_model.Paths.Identifier.t)(Odoc_model.Names.ModuleTypeName.to_stringname)|`Type(parent,name)->Format.fprintfppf"%a.%s"model_identifier(parent:>Odoc_model.Paths.Identifier.t)(Odoc_model.Names.TypeName.to_stringname)|`Parameter(parent,name)->Format.fprintfppf"(param %a %s)"model_identifier(parent:>Odoc_model.Paths.Identifier.t)(Odoc_model.Names.ModuleName.to_stringname)|`Resultparent->Format.fprintfppf"%a.result"model_identifier(parent:>Odoc_model.Paths.Identifier.t)|`CoreTypename->Format.fprintfppf"%s"(Odoc_model.Names.TypeName.to_stringname)|`Constructor(ty,x)->Format.fprintfppf"%a.%s"model_identifier(ty:>Odoc_model.Paths.Identifier.t)(ConstructorName.to_stringx)|`Value(parent,name)->Format.fprintfppf"%a.%s"model_identifier(parent:>Odoc_model.Paths.Identifier.t)(ValueName.to_stringname)|`CoreExceptionname->Format.fprintfppf"%s"(ExceptionName.to_stringname)|`Class(sg,name)->Format.fprintfppf"%a.%s"model_identifier(sg:>Odoc_model.Paths.Identifier.t)(ClassName.to_stringname)|`ClassType(sg,name)->Format.fprintfppf"%a.%s"model_identifier(sg:>Odoc_model.Paths.Identifier.t)(ClassTypeName.to_stringname)|`InstanceVariable(sg,name)->Format.fprintfppf"%a.%s"model_identifier(sg:>Odoc_model.Paths.Identifier.t)(InstanceVariableName.to_stringname)|`Method(sg,name)->Format.fprintfppf"%a.%s"model_identifier(sg:>Odoc_model.Paths.Identifier.t)(MethodName.to_stringname)|`Label(parent,name)->Format.fprintfppf"%a.%s"model_identifier(parent:>Odoc_model.Paths.Identifier.t)(LabelName.to_stringname)|`Field(ty,name)->Format.fprintfppf"%a.%s"model_identifier(ty:>Odoc_model.Paths.Identifier.t)(FieldName.to_stringname)|`Exception(p,name)->Format.fprintfppf"%a.%s"model_identifier(p:>Odoc_model.Paths.Identifier.t)(ExceptionName.to_stringname)|`Extension(p,name)->Format.fprintfppf"%a.%s"model_identifier(p:>Odoc_model.Paths.Identifier.t)(ExtensionName.to_stringname)|`ExtensionDecl(p,_,name)->Format.fprintfppf"%a.%s"model_identifier(p:>Odoc_model.Paths.Identifier.t)(ExtensionName.to_stringname)|`Page(_,name)|`LeafPage(_,name)->Format.fprintfppf"%s"(PageName.to_stringname)|`SourcePage(p,name)|`SourceDir(p,name)->Format.fprintfppf"%a/%s"model_identifier(p:>Odoc_model.Paths.Identifier.t)name|`SourceLocation(p,def)->Format.fprintfppf"%a#%s"model_identifier(p:>Odoc_model.Paths.Identifier.t)(DefName.to_stringdef)|`SourceLocationInternal(p,def)->Format.fprintfppf"%a#%s"model_identifier(p:>Odoc_model.Paths.Identifier.t)(LocalName.to_stringdef)|`SourceLocationModp->Format.fprintfppf"%a#"model_identifier(p:>Odoc_model.Paths.Identifier.t)|`AssetFile(p,name)->Format.fprintfppf"%a/%s"model_identifier(p:>Odoc_model.Paths.Identifier.t)nameandmodel_fragmentppf(f:Odoc_model.Paths.Fragment.t)=matchfwith|`Resolvedrf->model_resolved_fragmentppfrf|`Dot(sg,d)->Format.fprintfppf"*%a.%s"model_fragment(sg:>Odoc_model.Paths.Fragment.t)d|`Root->()andmodel_resolved_fragmentppf(f:Odoc_model.Paths.Fragment.Resolved.t)=letopenOdoc_model.Paths.Fragment.Resolvedinmatchfwith|`Root(`ModuleTypep)->Format.fprintfppf"root(%a)"model_resolved_path(p:>Odoc_model.Paths.Path.Resolved.t)|`Root(`Modulep)->Format.fprintfppf"root(%a)"model_resolved_path(p:>Odoc_model.Paths.Path.Resolved.t)|`Module(sg,m)->Format.fprintfppf"%a.%s"model_resolved_fragment(sg:>t)(Odoc_model.Names.ModuleName.to_stringm)|`Module_type(sg,mty)->Format.fprintfppf"%a.%s"model_resolved_fragment(sg:>t)(Odoc_model.Names.ModuleTypeName.to_stringmty)|`Type(sg,t)->Format.fprintfppf"%a.%s"model_resolved_fragment(sg:>t)(Odoc_model.Names.TypeName.to_stringt)|`Subst(path,m)->Format.fprintfppf"(%a subst -> %a)"model_resolved_path(path:>Odoc_model.Paths.Path.Resolved.t)model_resolved_fragment(m:>t)|`Alias(_,_)->Format.fprintfppf"UNIMPLEMENTED subst alias!?"|`Class(sg,c)->Format.fprintfppf"%a.%s"model_resolved_fragment(sg:>t)(Odoc_model.Names.ClassName.to_stringc)|`ClassType(sg,c)->Format.fprintfppf"%a.%s"model_resolved_fragment(sg:>t)(Odoc_model.Names.ClassTypeName.to_stringc)|`OpaqueModulem->Format.fprintfppf"opaquemodule(%a)"model_resolved_fragment(m:>Odoc_model.Paths.Fragment.Resolved.t)andresolved_root_fragmentppf(f:Cfrag.root)=matchfwith|`ModuleTypep->Format.fprintfppf"root(%a)"resolved_module_type_pathp|`Modulep->Format.fprintfppf"root(%a)"resolved_module_pathpandresolved_signature_fragmentppf(f:Cfrag.resolved_signature)=matchfwith|`Rootr->Format.fprintfppf"%a"resolved_root_fragmentr|(`Subst_|`Alias_|`Module_)asx->resolved_module_fragmentppfx|`OpaqueModulem->Format.fprintfppf"opaquemodule(%a)"resolved_module_fragmentmandresolved_module_fragmentppf(f:Cfrag.resolved_module)=matchfwith|`Subst(s,f)->Format.fprintfppf"subst(%a,%a)"resolved_module_type_pathsresolved_module_fragmentf|`Alias(m,f)->Format.fprintfppf"substalias(%a,%a)"resolved_module_pathmresolved_module_fragmentf|`Module(p,n)->Format.fprintfppf"%a.%s"resolved_signature_fragmentp(ModuleName.to_stringn)|`OpaqueModulem->Format.fprintfppf"opaquemodule(%a)"resolved_module_fragmentmandresolved_module_type_fragmentppf(f:Cfrag.resolved_module_type)=matchfwith|`ModuleType(p,n)->Format.fprintfppf"%a.%s"resolved_signature_fragmentp(ModuleTypeName.to_stringn)andresolved_type_fragmentppf(f:Cfrag.resolved_type)=matchfwith|`Type(s,n)->Format.fprintfppf"%a.%s"resolved_signature_fragments(TypeName.to_stringn)|`Class(s,n)->Format.fprintfppf"%a.%s"resolved_signature_fragments(ClassName.to_stringn)|`ClassType(s,n)->Format.fprintfppf"%a.%s"resolved_signature_fragments(ClassTypeName.to_stringn)andsignature_fragmentppf(f:Cfrag.signature)=matchfwith|`Resolvedr->Format.fprintfppf"r(%a)"resolved_signature_fragmentr|`Dot(s,n)->Format.fprintfppf"%a.%s"signature_fragmentsn|`Root->Format.fprintfppf"root"andmodule_fragmentppf(f:Cfrag.module_)=matchfwith|`Resolvedr->Format.fprintfppf"r(%a)"resolved_module_fragmentr|`Dot(s,n)->Format.fprintfppf"%a.%s"signature_fragmentsnandmodule_type_fragmentppf(f:Cfrag.module_type)=matchfwith|`Resolvedr->Format.fprintfppf"resolved(%a)"resolved_module_type_fragmentr|`Dot(s,n)->Format.fprintfppf"%a.%s"signature_fragmentsnandtype_fragmentppf(f:Cfrag.type_)=matchfwith|`Resolvedr->Format.fprintfppf"r(%a)"resolved_type_fragmentr|`Dot(s,n)->Format.fprintfppf"%a.%s"signature_fragmentsnandmodel_resolved_referenceppf(r:Odoc_model.Paths.Reference.Resolved.t)=letopenOdoc_model.Paths.Reference.Resolvedinmatchrwith|`Identifierid->Format.fprintfppf"%a"model_identifierid|`Hiddenp->Format.fprintfppf"hidden(%a)"model_resolved_reference(p:>t)|`Module(parent,name)->Format.fprintfppf"%a.%s"model_resolved_reference(parent:>t)(ModuleName.to_stringname)|`ModuleType(parent,name)->Format.fprintfppf"%a.%s"model_resolved_reference(parent:>t)(ModuleTypeName.to_stringname)|`Type(parent,name)->Format.fprintfppf"%a.%s"model_resolved_reference(parent:>t)(TypeName.to_stringname)|`Constructor(parent,name)->Format.fprintfppf"%a.%s"model_resolved_reference(parent:>t)(ConstructorName.to_stringname)|`Field(parent,name)->Format.fprintfppf"%a.%s"model_resolved_reference(parent:>t)(FieldName.to_stringname)|`Extension(parent,name)->Format.fprintfppf"%a.%s"model_resolved_reference(parent:>t)(ExtensionName.to_stringname)|`ExtensionDecl(parent,name,_)->Format.fprintfppf"%a.%s"model_resolved_reference(parent:>t)(ExtensionName.to_stringname)|`Exception(parent,name)->Format.fprintfppf"%a.%s"model_resolved_reference(parent:>t)(ExceptionName.to_stringname)|`Value(parent,name)->Format.fprintfppf"%a.%s"model_resolved_reference(parent:>t)(ValueName.to_stringname)|`Class(parent,name)->Format.fprintfppf"%a.%s"model_resolved_reference(parent:>t)(ClassName.to_stringname)|`ClassType(parent,name)->Format.fprintfppf"%a.%s"model_resolved_reference(parent:>t)(ClassTypeName.to_stringname)|`Method(parent,name)->Format.fprintfppf"%a.%s"model_resolved_reference(parent:>t)(MethodName.to_stringname)|`InstanceVariable(parent,name)->Format.fprintfppf"%a.%s"model_resolved_reference(parent:>t)(InstanceVariableName.to_stringname)|`Alias(x,y)->Format.fprintfppf"alias(%a,%a)"model_resolved_path(x:>Odoc_model.Paths.Path.Resolved.t)model_resolved_reference(y:>Odoc_model.Paths.Reference.Resolved.t)|`AliasModuleType(x,y)->Format.fprintfppf"aliasmoduletype(%a,%a)"model_resolved_path(x:>Odoc_model.Paths.Path.Resolved.t)model_resolved_reference(y:>Odoc_model.Paths.Reference.Resolved.t)|`Label(parent,name)->Format.fprintfppf"%a.%s"model_resolved_reference(parent:>t)(LabelName.to_stringname)andmodel_referenceppf(r:Odoc_model.Paths.Reference.t)=letopenOdoc_model.Paths.Referenceinmatchrwith|`Resolvedr'->Format.fprintfppf"r(%a)"model_resolved_referencer'|`Root(name,_)->Format.fprintfppf"unresolvedroot(%s)"name|`Dot(parent,str)->Format.fprintfppf"%a.%s"model_reference(parent:>t)str|`Module(parent,name)->Format.fprintfppf"%a.%s"model_reference(parent:>t)(ModuleName.to_stringname)|`ModuleType(parent,name)->Format.fprintfppf"%a.%s"model_reference(parent:>t)(ModuleTypeName.to_stringname)|`Type(parent,name)->Format.fprintfppf"%a.%s"model_reference(parent:>t)(TypeName.to_stringname)|`Constructor(parent,name)->Format.fprintfppf"%a.%s"model_reference(parent:>t)(ConstructorName.to_stringname)|`Field(parent,name)->Format.fprintfppf"%a.%s"model_reference(parent:>t)(FieldName.to_stringname)|`Extension(parent,name)->Format.fprintfppf"%a.%s"model_reference(parent:>t)(ExtensionName.to_stringname)|`ExtensionDecl(parent,name)->Format.fprintfppf"%a.%s"model_reference(parent:>t)(ExtensionName.to_stringname)|`Exception(parent,name)->Format.fprintfppf"%a.%s"model_reference(parent:>t)(ExceptionName.to_stringname)|`Value(parent,name)->Format.fprintfppf"%a.%s"model_reference(parent:>t)(ValueName.to_stringname)|`Class(parent,name)->Format.fprintfppf"%a.%s"model_reference(parent:>t)(ClassName.to_stringname)|`ClassType(parent,name)->Format.fprintfppf"%a.%s"model_reference(parent:>t)(ClassTypeName.to_stringname)|`Method(parent,name)->Format.fprintfppf"%a.%s"model_reference(parent:>t)(MethodName.to_stringname)|`InstanceVariable(parent,name)->Format.fprintfppf"%a.%s"model_reference(parent:>t)(InstanceVariableName.to_stringname)|`Label(parent,name)->Format.fprintfppf"%a.%s"model_reference(parent:>t)(LabelName.to_stringname)endmoduleLocalIdents=structopenOdoc_model(** The purpose of this module is to extract identifiers
that could be referenced in Paths - that is, modules,
module types, types, classes and class types. That way
we can assign them an Ident.t ahead of time and be
self-consistent. Because we don't need _all_ of the
identifiers we don't traverse the entire structure.
Additionally, we stop at (class_)signature boundaries
since identifiers within these won't be referenced
except within them, so we only do that on demand. *)typet={modules:Paths.Identifier.Module.tlist;module_types:Paths.Identifier.ModuleType.tlist;types:Paths.Identifier.Type.tlist;classes:Paths.Identifier.Class.tlist;class_types:Paths.Identifier.ClassType.tlist;}letempty={modules=[];module_types=[];types=[];classes=[];class_types=[];}openLangletrecsignature_itemssids=letopenSignatureinList.fold_left(funidsc->matchcwith|Module(_,{Module.id;_})->{idswithmodules=id::ids.modules}|ModuleTypem->{idswithmodule_types=m.ModuleType.id::ids.module_types}|ModuleSubstitution{ModuleSubstitution.id;_}->{idswithmodules=id::ids.modules}|ModuleTypeSubstitution{ModuleTypeSubstitution.id;_}->{idswithmodule_types=id::ids.module_types}|Type(_,t)->{idswithtypes=t.TypeDecl.id::ids.types}|TypeSubstitutiont->{idswithtypes=t.TypeDecl.id::ids.types}|Class(_,c)->{idswithclasses=c.Class.id::ids.classes}|ClassType(_,c)->{idswithclass_types=c.ClassType.id::ids.class_types}|TypExt_|Exception_|Value_|Comment_->ids|Includei->signaturei.Include.expansion.contentids|Openo->signatureo.Open.expansionids)idssandsignaturesids=signature_itemss.itemsidsendmoduleOf_Lang=structopenOdoc_modeltypemap={modules:Ident.module_Paths.Identifier.Maps.Module.t;module_types:Ident.module_typePaths.Identifier.Maps.ModuleType.t;functor_parameters:Ident.functor_parameterPaths.Identifier.Maps.FunctorParameter.t;types:Ident.type_Paths.Identifier.Maps.Type.t;path_types:Ident.path_typePaths.Identifier.Maps.Path.Type.t;path_class_types:Ident.path_class_typePaths.Identifier.Maps.Path.ClassType.t;classes:Ident.class_Paths.Identifier.Maps.Class.t;class_types:Ident.class_typePaths.Identifier.Maps.ClassType.t;}letempty()=letopenPaths.Identifier.Mapsin{modules=Module.empty;module_types=ModuleType.empty;functor_parameters=FunctorParameter.empty;types=Type.empty;path_types=Path.Type.empty;path_class_types=Path.ClassType.empty;classes=Class.empty;class_types=ClassType.empty;}letmap_of_identsidsmap=letopenPaths.Identifierin(* New types go into [types_new] and [path_types_new]
New classes go into [classes_new] and [path_class_types_new]
New class_types go into [class_types_new], [path_types_new] and [path_class_types_new] *)lettypes_new,path_types_new=List.fold_left(fun(types,path_types)i->letid=Ident.Of_Identifier.type_iin(Maps.Type.addiidtypes,Maps.Path.Type.add(i:>Path.Type.t)(id:>Ident.path_type)path_types))(map.types,map.path_types)ids.LocalIdents.typesinletclasses_new,path_class_types_new=List.fold_left(fun(classes,path_class_types)i->letid=Ident.Of_Identifier.class_iin(Maps.Class.addiidclasses,Maps.Path.ClassType.add(i:>Path.ClassType.t)(id:>Ident.path_class_type)path_class_types))(map.classes,map.path_class_types)ids.LocalIdents.classesinletclass_types_new,path_types_new,path_class_types_new=List.fold_left(fun(class_types,path_types,path_class_types)i->letid=Ident.Of_Identifier.class_typeiin(Maps.ClassType.addiidclass_types,Maps.Path.Type.add(i:>Path.Type.t)(id:>Ident.path_type)path_types,Maps.Path.ClassType.add(i:>Path.ClassType.t)(id:>Ident.path_class_type)path_class_types))(map.class_types,path_types_new,path_class_types_new)ids.LocalIdents.class_typesinletmodules_new=List.fold_left(funacci->Maps.Module.add(i:>Module.t)(Ident.Of_Identifier.module_i)acc)map.modulesids.LocalIdents.modulesinletmodule_types_new=List.fold_left(funacci->Maps.ModuleType.addi(Ident.Of_Identifier.module_typei)acc)map.module_typesids.LocalIdents.module_typesinletmodules=modules_newinletmodule_types=module_types_newinletfunctor_parameters=map.functor_parametersinlettypes=types_newinletclasses=classes_newinletclass_types=class_types_newinletpath_types=path_types_newinletpath_class_types=path_class_types_newin{modules;module_types;functor_parameters;types;classes;class_types;path_types;path_class_types;}letoptionconvident_mapx=matchxwithNone->None|Somex'->Some(convident_mapx')letidentifierlookupmapi=matchlookupimapwith|x->`Localx|exceptionNot_found->`Identifieriletfind_any_moduleiident_map=matchiwith|{Odoc_model.Paths.Identifier.iv=`Root_|`Module_;_}asid->(Maps.Module.findidident_map.modules:>Ident.path_module)|{Odoc_model.Paths.Identifier.iv=#Paths.Identifier.FunctorParameter.t_pv;_;}asid->(Maps.FunctorParameter.findidident_map.functor_parameters:>Ident.path_module)|_->raiseNot_foundletrecresolved_module_path:_->Odoc_model.Paths.Path.Resolved.Module.t->Cpath.Resolved.module_=funident_mapp->letrecurse=resolved_module_pathident_mapinmatchpwith|`Identifieri->(matchidentifierfind_any_moduleident_mapiwith|`Locall->`Locall|`Identifier_->`Gpathp)|`Module(p,name)->`Module(`Module(recursep),name)|`Apply(p1,p2)->`Apply(recursep1,recursep2)|`Alias(p1,p2)->`Alias(recursep1,module_pathident_mapp2,None)|`Subst(p1,p2)->`Subst(resolved_module_type_pathident_mapp1,recursep2)|`Canonical(p1,p2)->`Canonical(recursep1,p2)|`Hiddenp1->`Hidden(recursep1)|`OpaqueModulem->`OpaqueModule(recursem)andresolved_module_type_path:_->Odoc_model.Paths.Path.Resolved.ModuleType.t->Cpath.Resolved.module_type=funident_mapp->matchpwith|`Identifieri->(matchidentifierMaps.ModuleType.findident_map.module_typesiwith|`Locall->`Locall|`Identifier_->`Gpathp)|`ModuleType(p,name)->`ModuleType(`Module(resolved_module_pathident_mapp),name)|`CanonicalModuleType(p1,p2)->`CanonicalModuleType(resolved_module_type_pathident_mapp1,p2)|`OpaqueModuleTypem->`OpaqueModuleType(resolved_module_type_pathident_mapm)|`AliasModuleType(m1,m2)->`AliasModuleType(resolved_module_type_pathident_mapm1,resolved_module_type_pathident_mapm2)|`SubstT(p1,p2)->`SubstT(resolved_module_type_pathident_mapp1,resolved_module_type_pathident_mapp2)andresolved_type_path:_->Odoc_model.Paths.Path.Resolved.Type.t->Cpath.Resolved.type_=funident_mapp->matchpwith|`Identifieri->(matchidentifierMaps.Path.Type.findident_map.path_typesiwith|`Locall->`Locall|`Identifier_->`Gpathp)|`CanonicalType(p1,p2)->`CanonicalType(resolved_type_pathident_mapp1,p2)|`Type(p,name)->`Type(`Module(resolved_module_pathident_mapp),name)|`Class(p,name)->`Class(`Module(resolved_module_pathident_mapp),name)|`ClassType(p,name)->`ClassType(`Module(resolved_module_pathident_mapp),name)andresolved_datatype_path:_->Odoc_model.Paths.Path.Resolved.DataType.t->Cpath.Resolved.datatype=funident_mapp->matchpwith|`Identifieri->(matchidentifierMaps.Type.findident_map.typesiwith|`Locall->`Locall|`Identifier_->`Gpathp)|`CanonicalDataType(p1,p2)->`CanonicalDataType(resolved_datatype_pathident_mapp1,p2)|`Type(p,name)->`Type(`Module(resolved_module_pathident_mapp),name)andresolved_value_path:_->Odoc_model.Paths.Path.Resolved.Value.t->Cpath.Resolved.value=funident_map(`Value(p,name))->`Value(`Module(resolved_module_pathident_mapp),name)andresolved_constructor_path:_->Odoc_model.Paths.Path.Resolved.Constructor.t->Cpath.Resolved.constructor=funident_map(`Constructor(p,name))->`Constructor(resolved_datatype_pathident_mapp,name)andresolved_class_type_path:_->Odoc_model.Paths.Path.Resolved.ClassType.t->Cpath.Resolved.class_type=funident_mapp->matchpwith|`Identifieri->(matchidentifierMaps.Path.ClassType.findident_map.path_class_typesiwith|`Locall->`Locall|`Identifier_->`Gpathp)|`Class(p,name)->`Class(`Module(resolved_module_pathident_mapp),name)|`ClassType(p,name)->`ClassType(`Module(resolved_module_pathident_mapp),name)andmodule_path:_->Odoc_model.Paths.Path.Module.t->Cpath.module_=funident_mapp->matchpwith|`Resolvedr->`Resolved(resolved_module_pathident_mapr)|`Identifier(i,b)->(matchidentifierfind_any_moduleident_mapiwith|`Identifieri->`Identifier(i,b)|`Locali->`Local(i,b))|`Dot(path',x)->`Dot(module_pathident_mappath',x)|`Apply(p1,p2)->`Apply(module_pathident_mapp1,module_pathident_mapp2)|`Forwardstr->`Forwardstr|`Rootstr->`Rootstrandmodule_type_path:_->Odoc_model.Paths.Path.ModuleType.t->Cpath.module_type=funident_mapp->matchpwith|`Resolvedr->`Resolved(resolved_module_type_pathident_mapr)|`Identifier(i,b)->(matchidentifierMaps.ModuleType.findident_map.module_typesiwith|`Identifieri->`Identifier(i,b)|`Locali->`Local(i,b))|`Dot(path',x)->`Dot(module_pathident_mappath',x)andtype_path:_->Odoc_model.Paths.Path.Type.t->Cpath.type_=funident_mapp->matchpwith|`Resolvedr->`Resolved(resolved_type_pathident_mapr)|`Identifier(i,b)->(matchidentifierMaps.Path.Type.findident_map.path_typesiwith|`Identifieri->`Identifier(i,b)|`Locali->`Local(i,b))|`Dot(path',x)->`Dot(module_pathident_mappath',x)andvalue_path:_->Odoc_model.Paths.Path.Value.t->Cpath.value=funident_mapp->matchpwith|`Resolvedr->`Resolved(resolved_value_pathident_mapr)|`Dot(path',x)->`Dot(module_pathident_mappath',x)anddatatype:_->Odoc_model.Paths.Path.DataType.t->Cpath.datatype=funident_mapp->matchpwith|`Resolvedr->`Resolved(resolved_datatype_pathident_mapr)|`Identifier(i,b)->(matchidentifierMaps.Type.findident_map.typesiwith|`Identifieri->`Identifier(i,b)|`Locali->`Local(i,b))|`Dot(path',x)->`Dot(module_pathident_mappath',x)andconstructor_path:_->Odoc_model.Paths.Path.Constructor.t->Cpath.constructor=funident_mapp->matchpwith|`Resolvedr->`Resolved(resolved_constructor_pathident_mapr)|`Dot(path',x)->`Dot(datatypeident_mappath',x)andclass_type_path:_->Odoc_model.Paths.Path.ClassType.t->Cpath.class_type=funident_mapp->matchpwith|`Resolvedr->`Resolved(resolved_class_type_pathident_mapr)|`Identifier(i,b)->(matchidentifierMaps.Path.ClassType.findident_map.path_class_typesiwith|`Identifieri->`Identifier(i,b)|`Locali->`Local(i,b))|`Dot(path',x)->`Dot(module_pathident_mappath',x)letrecresolved_signature_fragment:map->Odoc_model.Paths.Fragment.Resolved.Signature.t->Cfrag.resolved_signature=funident_mapty->matchtywith|`Root(`ModuleTypepath)->`Root(`ModuleType(resolved_module_type_pathident_mappath))|`Root(`Modulepath)->`Root(`Module(resolved_module_pathident_mappath))|(`Alias_|`Subst_|`Module_|`OpaqueModule_)asx->(resolved_module_fragmentident_mapx:>Cfrag.resolved_signature)andresolved_module_fragment:_->Odoc_model.Paths.Fragment.Resolved.Module.t->Cfrag.resolved_module=funident_mapty->matchtywith|`Subst(p,m)->`Subst(resolved_module_type_pathident_mapp,resolved_module_fragmentident_mapm)|`Alias(p,m)->`Alias(resolved_module_pathident_mapp,resolved_module_fragmentident_mapm)|`Module(p,m)->`Module(resolved_signature_fragmentident_mapp,m)|`OpaqueModulem->`OpaqueModule(resolved_module_fragmentident_mapm)andresolved_module_type_fragment:_->Odoc_model.Paths.Fragment.Resolved.ModuleType.t->Cfrag.resolved_module_type=funident_mapty->matchtywith|`Module_type(p,m)->`ModuleType(resolved_signature_fragmentident_mapp,m)andresolved_type_fragment:_->Odoc_model.Paths.Fragment.Resolved.Type.t->Cfrag.resolved_type=funident_mapty->matchtywith|`Type(p,n)->`Type(resolved_signature_fragmentident_mapp,n)|`Class(p,n)->`Class(resolved_signature_fragmentident_mapp,n)|`ClassType(p,n)->`ClassType(resolved_signature_fragmentident_mapp,n)letrecsignature_fragment:_->Odoc_model.Paths.Fragment.Signature.t->Cfrag.signature=funident_mapty->matchtywith|`Resolvedr->`Resolved(resolved_signature_fragmentident_mapr)|`Dot(p,n)->`Dot(signature_fragmentident_mapp,n)|`Root->`Rootletmodule_fragment:_->Odoc_model.Paths.Fragment.Module.t->Cfrag.module_=funident_mapty->matchtywith|`Resolvedr->`Resolved(resolved_module_fragmentident_mapr)|`Dot(p,n)->`Dot(signature_fragmentident_mapp,n)letmodule_type_fragment:_->Odoc_model.Paths.Fragment.ModuleType.t->Cfrag.module_type=funident_mapty->matchtywith|`Resolvedr->`Resolved(resolved_module_type_fragmentident_mapr)|`Dot(p,n)->`Dot(signature_fragmentident_mapp,n)lettype_fragment:_->Odoc_model.Paths.Fragment.Type.t->Cfrag.type_=funident_mapty->matchtywith|`Resolvedr->`Resolved(resolved_type_fragmentident_mapr)|`Dot(p,n)->`Dot(signature_fragmentident_mapp,n)letrectype_declident_mapty=letopenOdoc_model.Lang.TypeDeclin{TypeDecl.locs=ty.locs;doc=docsident_mapty.doc;canonical=ty.canonical;equation=type_equationident_mapty.equation;representation=Opt.map(type_decl_representationident_map)ty.representation;}andtype_decl_representationident_mapr=letopenOdoc_model.Lang.TypeDecl.Representationinmatchrwith|Variantcs->TypeDecl.Representation.Variant(List.map(type_decl_constructorident_map)cs)|Recordfs->Record(List.map(type_decl_fieldident_map)fs)|Extensible->Extensibleandtype_decl_constructorident_mapt=letopenOdoc_model.Lang.TypeDecl.Constructorinletargs=type_decl_constructor_argumentident_mapt.argsinletres=Opt.map(type_expressionident_map)t.resin{TypeDecl.Constructor.name=Paths.Identifier.namet.id;doc=docsident_mapt.doc;args;res;}andtype_decl_constructor_argumentident_mapa=letopenOdoc_model.Lang.TypeDecl.Constructorinmatchawith|Tuplets->TypeDecl.Constructor.Tuple(List.map(type_expressionident_map)ts)|Recordfs->Record(List.map(type_decl_fieldident_map)fs)andtype_decl_fieldident_mapf=letopenOdoc_model.Lang.TypeDecl.Fieldinlettype_=type_expressionident_mapf.type_in{TypeDecl.Field.name=Paths.Identifier.namef.id;doc=docsident_mapf.doc;mutable_=f.mutable_;type_;}andtype_equationident_mapteq=letopenOdoc_model.Lang.TypeDecl.Equationin{TypeDecl.Equation.params=teq.params;private_=teq.private_;manifest=optiontype_expressionident_mapteq.manifest;constraints=List.map(fun(x,y)->(type_expressionident_mapx,type_expressionident_mapy))teq.constraints;}andtype_expr_polyvarident_mapv=letopenOdoc_model.Lang.TypeExpr.Polymorphic_variantinletmap_element=function|Typeexpr->TypeExpr.Polymorphic_variant.Type(type_expressionident_mapexpr)|Constructorc->ConstructorTypeExpr.Polymorphic_variant.Constructor.{name=c.name;constant=c.constant;arguments=List.map(type_expressionident_map)c.arguments;doc=docsident_mapc.doc;}in{TypeExpr.Polymorphic_variant.kind=v.kind;elements=List.mapmap_elementv.elements;}andtype_objectident_mapo=letopenOdoc_model.Lang.TypeExpr.Objectinletmap_field=function|Methodm->TypeExpr.(Object.Method{Object.name=m.name;type_=type_expressionident_mapm.type_;})|Inheriti->Inherit(type_expressionident_mapi)in{TypeExpr.Object.open_=o.open_;fields=List.mapmap_fieldo.fields}andtype_packageident_mappkg=letopenOdoc_model.Lang.TypeExpr.Packagein{TypeExpr.Package.path=module_type_pathident_mappkg.path;substitutions=List.map(fun(x,y)->letf=type_fragmentident_mapxin(f,type_expressionident_mapy))pkg.substitutions;}andtype_expressionident_mapexpr=letopenOdoc_model.Lang.TypeExprinmatchexprwith|Vars->TypeExpr.Vars|Any->Any|Constr(p,xs)->Constr(type_pathident_mapp,List.map(type_expressionident_map)xs)|Arrow(lbl,t1,t2)->Arrow(lbl,type_expressionident_mapt1,type_expressionident_mapt2)|Tuplets->Tuple(List.map(type_expressionident_map)ts)|Polymorphic_variantv->Polymorphic_variant(type_expr_polyvarident_mapv)|Poly(s,ts)->Poly(s,type_expressionident_mapts)|Alias(t,s)->Alias(type_expressionident_mapt,s)|Class(p,ts)->Class(class_type_pathident_mapp,List.map(type_expressionident_map)ts)|Objecto->Object(type_objectident_mapo)|Packagep->Package(type_packageident_mapp)andmodule_declident_mapm=matchmwith|Lang.Module.Alias(p,e)->Module.Alias(module_pathident_mapp,optionsimple_expansionident_mape)|Lang.Module.ModuleTypes->Module.ModuleType(module_type_exprident_maps)andinclude_declident_mapm=matchmwith|Odoc_model.Lang.Include.Aliasp->Include.Alias(module_pathident_mapp)|ModuleTypes->ModuleType(u_module_type_exprident_maps)andsimple_expansionident_map(f:Odoc_model.Lang.ModuleType.simple_expansion):ModuleType.simple_expansion=letopenOdoc_model.Lang.ModuleTypeinletopenOdoc_model.Lang.FunctorParameterinmatchfwith|Signaturet->Signature(signatureident_mapt)|Functor(arg,sg)->(matchargwith|Namedarg->letidentifier=arg.Odoc_model.Lang.FunctorParameter.idinletid=Ident.Of_Identifier.functor_parameteridentifierinletident_map'={ident_mapwithfunctor_parameters=Maps.FunctorParameter.addidentifieridident_map.functor_parameters;}inletarg'=functor_parameterident_map'idarginFunctor(FunctorParameter.Namedarg',simple_expansionident_map'sg)|Unit->Functor(FunctorParameter.Unit,simple_expansionident_mapsg))andmodule_ident_mapm=lettype_=module_declident_mapm.Odoc_model.Lang.Module.type_inletcanonical=m.Odoc_model.Lang.Module.canonicalin{Module.locs=m.locs;doc=docsident_mapm.doc;type_;canonical;hidden=m.hidden;}andwith_module_type_substitutionident_mapm=letopenOdoc_model.Lang.ModuleTypeinmatchmwith|ModuleEq(frag,decl)->ModuleType.ModuleEq(module_fragmentident_mapfrag,module_declident_mapdecl)|ModuleSubst(frag,p)->ModuleType.ModuleSubst(module_fragmentident_mapfrag,module_pathident_mapp)|ModuleTypeEq(frag,mty)->ModuleType.ModuleTypeEq(module_type_fragmentident_mapfrag,module_type_exprident_mapmty)|ModuleTypeSubst(frag,mty)->ModuleType.ModuleTypeSubst(module_type_fragmentident_mapfrag,module_type_exprident_mapmty)|TypeEq(frag,eqn)->ModuleType.TypeEq(type_fragmentident_mapfrag,type_equationident_mapeqn)|TypeSubst(frag,eqn)->ModuleType.TypeSubst(type_fragmentident_mapfrag,type_equationident_mapeqn)andfunctor_parameterident_mapida=letexpr'=module_type_exprident_mapa.Odoc_model.Lang.FunctorParameter.exprin{FunctorParameter.id;expr=expr'}andextensionident_mape=letopenOdoc_model.Lang.Extensioninlettype_path=type_pathident_mape.type_pathinletconstructors=List.map(extension_constructorident_map)e.constructorsin{Extension.type_path;doc=docsident_mape.doc;type_params=e.type_params;private_=e.private_;constructors;}andextension_constructorident_mapc=letopenOdoc_model.Lang.Extension.Constructorinletargs=type_decl_constructor_argumentident_mapc.argsinletres=Opt.map(type_expressionident_map)c.resin{Extension.Constructor.name=Paths.Identifier.namec.id;locs=c.locs;doc=docsident_mapc.doc;args;res;}andexception_ident_mape=letopenOdoc_model.Lang.Exceptioninletargs=type_decl_constructor_argumentident_mape.argsinletres=Opt.map(type_expressionident_map)e.resin{Exception.locs=e.locs;doc=docsident_mape.doc;args;res}andu_module_type_exprident_mapm=letopenOdoc_modelinmatchmwith|Lang.ModuleType.U.Signatures->lets=signatureident_mapsinModuleType.U.Signatures|Pathp->letp'=module_type_pathident_mappinPathp'|With(w,e)->letw'=List.map(with_module_type_substitutionident_map)winWith(w',u_module_type_exprident_mape)|TypeOf{t_desc;t_expansion}->lett_desc=matcht_descwith|ModPathp->ModuleType.ModPath(module_pathident_mapp)|StructIncludep->StructInclude(module_pathident_mapp)inlett_expansion=Opt.map(simple_expansionident_map)t_expansioninTypeOf{t_desc;t_expansion}andmodule_type_exprident_mapm=letopenOdoc_modelinletopenPathsinmatchmwith|Lang.ModuleType.Signatures->lets=signatureident_mapsinModuleType.Signatures|Lang.ModuleType.Pathp->letp'=ModuleType.{p_path=module_type_pathident_mapp.p_path;p_expansion=optionsimple_expansionident_mapp.p_expansion;}inModuleType.Pathp'|Lang.ModuleType.Withw->letw'=ModuleType.{w_substitutions=List.map(with_module_type_substitutionident_map)w.w_substitutions;w_expansion=optionsimple_expansionident_mapw.w_expansion;w_expr=u_module_type_exprident_mapw.w_expr;}inModuleType.Withw'|Lang.ModuleType.Functor(Namedarg,expr)->letidentifier=arg.Lang.FunctorParameter.idinletid=Ident.Of_Identifier.functor_parameteridentifierinletident_map'={ident_mapwithfunctor_parameters=Identifier.Maps.FunctorParameter.addidentifieridident_map.functor_parameters;}inletarg'=functor_parameterident_map'idarginletexpr'=module_type_exprident_map'exprinModuleType.Functor(Namedarg',expr')|Lang.ModuleType.Functor(Unit,expr)->letexpr'=module_type_exprident_mapexprinModuleType.Functor(Unit,expr')|Lang.ModuleType.TypeOf{t_desc;t_expansion}->lett_desc=matcht_descwith|ModPathp->ModuleType.ModPath(module_pathident_mapp)|StructIncludep->StructInclude(module_pathident_mapp)inlett_expansion=optionsimple_expansionident_mapt_expansioninModuleType.(TypeOf{t_desc;t_expansion})andmodule_typeident_mapm=letexpr=Opt.map(module_type_exprident_map)m.Odoc_model.Lang.ModuleType.exprin{ModuleType.locs=m.locs;doc=docsident_mapm.doc;canonical=m.canonical;expr;}andvalueident_mapv=lettype_=type_expressionident_mapv.Lang.Value.type_in{Value.type_;doc=docsident_mapv.doc;value=v.value;locs=v.locs}andinclude_ident_mapi=letopenOdoc_model.Lang.Includeinletdecl=include_declident_mapi.declin{Include.parent=i.parent;doc=docsident_mapi.doc;shadowed=i.expansion.shadowed;expansion_=apply_sig_mapident_mapi.expansion.content;status=i.status;strengthened=optionmodule_pathident_mapi.strengthened;decl;loc=i.loc;}andclass_ident_mapc=letopenOdoc_model.Lang.Classinletexpansion=Opt.map(class_signatureident_map)c.expansionin{Class.locs=c.locs;doc=docsident_mapc.doc;virtual_=c.virtual_;params=c.params;type_=class_declident_mapc.type_;expansion;}andclass_declident_mapc=letopenOdoc_model.Lang.Classinmatchcwith|ClassTypee->Class.ClassType(class_type_exprident_mape)|Arrow(lbl,e,d)->Arrow(lbl,type_expressionident_mape,class_declident_mapd)andclass_type_exprident_mape=letopenOdoc_model.Lang.ClassTypeinmatchewith|Constr(p,ts)->ClassType.Constr(class_type_pathident_mapp,List.map(type_expressionident_map)ts)|Signatures->Signature(class_signatureident_maps)andclass_typeident_mapt=letopenOdoc_model.Lang.ClassTypeinletexpansion=Opt.map(class_signatureident_map)t.expansionin{ClassType.locs=t.locs;doc=docsident_mapt.doc;virtual_=t.virtual_;params=t.params;expr=class_type_exprident_mapt.expr;expansion;}andclass_signatureident_mapsg=letopenOdoc_model.Lang.ClassSignatureinletitems=List.map(function|Methodm->letid=Ident.Of_Identifier.method_m.idinletm'=method_ident_mapminClassSignature.Method(id,m')|InstanceVariablei->letid=Ident.Of_Identifier.instance_variablei.idinleti'=instance_variableident_mapiinClassSignature.InstanceVariable(id,i')|Constraintcst->Constraint(class_constraintident_mapcst)|Inherite->Inherit(inherit_ident_mape)|Commentc->Comment(docs_or_stopident_mapc))sg.itemsin{ClassSignature.self=Opt.map(type_expressionident_map)sg.self;items;doc=docsident_mapsg.doc;}andmethod_ident_mapm=letopenOdoc_model.Lang.Methodin{Method.doc=docsident_mapm.doc;private_=m.private_;virtual_=m.virtual_;type_=type_expressionident_mapm.type_;}andinstance_variableident_mapi={InstanceVariable.doc=docsident_mapi.doc;mutable_=i.mutable_;virtual_=i.virtual_;type_=type_expressionident_mapi.type_;}andclass_constraintident_mapcst={ClassSignature.Constraint.doc=docsident_mapcst.doc;left=type_expressionident_mapcst.left;right=type_expressionident_mapcst.right;}andinherit_ident_mapih={ClassSignature.Inherit.doc=docsident_mapih.doc;expr=class_type_exprident_mapih.expr;}andmodule_substitutionident_map(t:Odoc_model.Lang.ModuleSubstitution.t)={ModuleSubstitution.doc=docsident_mapt.doc;manifest=module_pathident_mapt.manifest;}andmodule_type_substitutionident_map(t:Odoc_model.Lang.ModuleTypeSubstitution.t)={ModuleTypeSubstitution.doc=docsident_mapt.doc;manifest=module_type_exprident_mapt.manifest;}andmodule_of_module_substitutionident_map(t:Odoc_model.Lang.ModuleSubstitution.t)=letmanifest=module_pathident_mapt.manifestin{Module.locs=None;doc=docsident_mapt.doc;type_=Alias(manifest,None);canonical=None;hidden=false;}andsignature:_->Odoc_model.Lang.Signature.t->Signature.t=funident_mapitems->(* First we construct a list of brand new [Ident.t]s
for each item in the signature *)letident_map=map_of_idents(LocalIdents.signatureitemsLocalIdents.empty)ident_mapin(* Now we construct the Components for each item,
converting all paths containing Identifiers pointing at
our elements to local paths *)apply_sig_mapident_mapitemsandopen_ident_mapo=Open.{expansion=apply_sig_mapident_mapo.Odoc_model.Lang.Open.expansion;doc=docsident_mapo.Odoc_model.Lang.Open.doc;}andapply_sig_mapident_mapsg=letitems=List.rev_map(letopenOdoc_model.Lang.SignatureinletopenOdoc_model.Pathsinfunction|Type(r,t)->letid=Identifier.Maps.Type.findt.idident_map.typesinlett'=Delayed.put(fun()->type_declident_mapt)inSignature.Type(id,r,t')|TypeSubstitutiont->letid=Identifier.Maps.Type.findt.idident_map.typesinlett'=type_declident_maptinSignature.TypeSubstitution(id,t')|Module(r,m)->letid=Identifier.Maps.Module.find(m.id:>Identifier.Module.t)ident_map.modulesinletm'=Delayed.put(fun()->module_ident_mapm)inSignature.Module(id,r,m')|ModuleSubstitutionm->letid=Identifier.Maps.Module.findm.idident_map.modulesinletm'=module_substitutionident_mapminSignature.ModuleSubstitution(id,m')|ModuleTypeSubstitutionm->letid=Identifier.Maps.ModuleType.findm.idident_map.module_typesinletm'=module_type_substitutionident_mapminSignature.ModuleTypeSubstitution(id,m')|ModuleTypem->letid=Identifier.Maps.ModuleType.findm.idident_map.module_typesinletm'=Delayed.put(fun()->module_typeident_mapm)inSignature.ModuleType(id,m')|Valuev->letid=Ident.Of_Identifier.valuev.idinletv'=Delayed.put(fun()->valueident_mapv)inSignature.Value(id,v')|Commentc->Comment(docs_or_stopident_mapc)|TypExte->TypExt(extensionident_mape)|Exceptione->letid=Ident.Of_Identifier.exception_e.idinException(id,exception_ident_mape)|Class(r,c)->letid=Identifier.Maps.Class.findc.idident_map.classesinClass(id,r,class_ident_mapc)|ClassType(r,c)->letid=Identifier.Maps.ClassType.findc.idident_map.class_typesinClassType(id,r,class_typeident_mapc)|Openo->Open(open_ident_mapo)|Includei->Include(include_ident_mapi))sg.items|>List.revin{items;removed=[];compiled=sg.compiled;doc=docsident_mapsg.doc}andblock_element_b:CComment.block_elementOdoc_model.Comment.with_location=matchbwith|{Odoc_model.Location_.value=`Heading(attrs,label,text);location}->letlabel=Ident.Of_Identifier.labellabelinOdoc_model.Location_.sameb(`Heading{Label.attrs;label;text;location})|{value=`Tag_;_}ast->t|{value=#Odoc_model.Comment.nestable_block_element;_}asn->nanddocsident_mapd=List.map(block_elementident_map)danddocs_or_stopident_map=function|`Docsd->`Docs(docsident_mapd)|`Stop->`Stopendletmodule_of_functor_argument(arg:FunctorParameter.parameter)={Module.locs=None;doc=[];type_=ModuleTypearg.expr;canonical=None;hidden=false;}(** This is equivalent to {!Lang.extract_signature_doc}. *)letextract_signature_doc(s:Signature.t)=match(s.doc,s.items)with|[],Include{expansion_;status=`Inline;_}::_->expansion_.doc|doc,_->doc