123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823(*
* Copyright (c) 2014 Leo White <lpw25@cl.cam.ac.uk>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*)openNamesmoduleReversed=structtypeelt=|RootofUnitName.t|ModuleofModuleName.t|ModuleTypeofModuleTypeName.t|Argumentofint*ArgumentName.ttypet=eltlistletrecremove_prefixprefix~of_=matchprefix,of_with|x1::xs1,x2::xs2whenx1=x2->remove_prefixxs1~of_:xs2|_,_->of_endmoduleIdentifier=structtypet=Paths_types.Identifier.anyletname:[<t]->string=function|`Root(_,name)->UnitName.to_stringname|`Page(_,name)->PageName.to_stringname|`Module(_,name)->ModuleName.to_stringname|`Argument(_,_,name)->ArgumentName.to_stringname|`ModuleType(_,name)->ModuleTypeName.to_stringname|`Type(_,name)->TypeName.to_stringname|`CoreTypename->TypeName.to_stringname|`Constructor(_,name)->ConstructorName.to_stringname|`Field(_,name)->FieldName.to_stringname|`Extension(_,name)->ExtensionName.to_stringname|`Exception(_,name)->ExceptionName.to_stringname|`CoreExceptionname->ExceptionName.to_stringname|`Value(_,name)->ValueName.to_stringname|`Class(_,name)->ClassName.to_stringname|`ClassType(_,name)->ClassTypeName.to_stringname|`Method(_,name)->MethodName.to_stringname|`InstanceVariable(_,name)->InstanceVariableName.to_stringname|`Label(_,name)->LabelName.to_stringnameletrecequal:t->t->bool=letopenPaths_types.Identifierinfunp1p2->matchp1,p2with|`Root(r1,n1),`Root(r2,n2)->UnitName.equaln1n2&&Root.equalr1r2|`Module(s1,n1),`Module(s2,n2)->ModuleName.equaln1n2&&equal(s1:signature:>any)(s2:signature:>any)|`Argument(s1,i1,n1),`Argument(s2,i2,n2)->i1=i2&&ArgumentName.equaln1n2&&equal(s1:signature:>any)(s2:signature:>any)|`ModuleType(s1,n1),`ModuleType(s2,n2)->ModuleTypeName.equaln1n2&&equal(s1:signature:>any)(s2:signature:>any)|`Type(s1,n1),`Type(s2,n2)->TypeName.equaln1n2&&equal(s1:signature:>any)(s2:signature:>any)|`CoreTypen1,`CoreTypen2->TypeName.equaln1n2|`Class(s1,n1),`Class(s2,n2)->ClassName.equaln1n2&&equal(s1:signature:>any)(s2:signature:>any)|`ClassType(s1,n1),`ClassType(s2,n2)->ClassTypeName.equaln1n2&&equal(s1:signature:>any)(s2:signature:>any)|`Page(r1,n1),`Page(r2,n2)->PageName.equaln1n2&&Root.equalr1r2|`Constructor(t1,n1),`Constructor(t2,n2)->ConstructorName.equaln1n2&&equal(t1:type_:>any)(t2:type_:>any)|`Field(s1,n1),`Field(s2,n2)->FieldName.equaln1n2&&equal(s1:parent:>any)(s2:parent:>any)|`Extension(s1,n1),`Extension(s2,n2)->ExtensionName.equaln1n2&&equal(s1:signature:>any)(s2:signature:>any)|`Exception(s1,n1),`Exception(s2,n2)->ExceptionName.equaln1n2&&equal(s1:signature:>any)(s2:signature:>any)|`CoreExceptionn1,`CoreExceptionn2->ExceptionName.equaln1n2|`Value(s1,n1),`Value(s2,n2)->ValueName.equaln1n2&&equal(s1:signature:>any)(s2:signature:>any)|`Method(s1,n1),`Method(s2,n2)->MethodName.equaln1n2&&equal(s1:class_signature:>any)(s2:class_signature:>any)|`InstanceVariable(s1,n1),`InstanceVariable(s2,n2)->InstanceVariableName.equaln1n2&&equal(s1:class_signature:>any)(s2:class_signature:>any)|`Label(s1,n1),`Label(s2,n2)->LabelName.equaln1n2&&equal(s1:label_parent:>any)(s2:label_parent:>any)|_,_->falseletrechash(id:Paths_types.Identifier.any)=letopenPaths_types.Identifierinmatchidwith|`Root(r,s)->Hashtbl.hash(1,Root.hashr,s)|`Page(r,s)->Hashtbl.hash(2,Root.hashr,s)|`Module(id,s)->Hashtbl.hash(3,hash(id:signature:>any),s)|`Argument(id,n,s)->Hashtbl.hash(4,hash(id:signature:>any),n,s)|`ModuleType(id,s)->Hashtbl.hash(5,hash(id:signature:>any),s)|`Type(id,s)->Hashtbl.hash(6,hash(id:signature:>any),s)|`CoreTypes->Hashtbl.hash(7,s)|`Constructor(id,s)->Hashtbl.hash(8,hash(id:type_:>any),s)|`Field(id,s)->Hashtbl.hash(9,hash(id:parent:>any),s)|`Extension(id,s)->Hashtbl.hash(10,hash(id:signature:>any),s)|`Exception(id,s)->Hashtbl.hash(11,hash(id:signature:>any),s)|`CoreExceptions->Hashtbl.hash(12,s)|`Value(id,s)->Hashtbl.hash(13,hash(id:signature:>any),s)|`Class(id,s)->Hashtbl.hash(14,hash(id:signature:>any),s)|`ClassType(id,s)->Hashtbl.hash(15,hash(id:signature:>any),s)|`Method(id,s)->Hashtbl.hash(16,hash(id:class_signature:>any),s)|`InstanceVariable(id,s)->Hashtbl.hash(17,hash(id:class_signature:>any),s)|`Label(id,s)->Hashtbl.hash(18,hash(id:label_parent:>any),s)moduleSignature=structtypet=Paths_types.Identifier.signatureletequal:t->t->bool=funt1t2->equal(t1:t:>Paths_types.Identifier.any)(t2:t:>Paths_types.Identifier.any)lethash:t->int=funt->hash(t:t:>Paths_types.Identifier.any)letrecroot=function|`Root(r,_)->r|`Module(id,_)|`Argument(id,_,_)|`ModuleType(id,_)->rootidendmoduleClassSignature=structtypet=Paths_types.Identifier.class_signatureletequal:t->t->bool=funt1t2->equal(t1:t:>Paths_types.Identifier.any)(t2:t:>Paths_types.Identifier.any)lethash:t->int=funt->hash(t:t:>Paths_types.Identifier.any)letroot=function|`Class(s,_)->Signature.roots|`ClassType(s,_)->Signature.rootsendmoduleDataType=structtypet=Paths_types.Identifier.datatypeletequal:t->t->bool=funt1t2->equal(t1:t:>Paths_types.Identifier.any)(t2:t:>Paths_types.Identifier.any)lethash:t->int=funt->hash(t:t:>Paths_types.Identifier.any)endmoduleParent=structtypet=Paths_types.Identifier.parentletequal:t->t->bool=funt1t2->equal(t1:t:>Paths_types.Identifier.any)(t2:t:>Paths_types.Identifier.any)lethash:t->int=funt->hash(t:t:>Paths_types.Identifier.any)endmoduleLabelParent=structtypet=Paths_types.Identifier.label_parentletequal:t->t->bool=funt1t2->equal(t1:t:>Paths_types.Identifier.any)(t2:t:>Paths_types.Identifier.any)lethash:t->int=funt->hash(t:t:>Paths_types.Identifier.any)letroot:t->Root.t=function|`Root(r,_)->r|`Module(id,_)|`Argument(id,_,_)|`ModuleType(id,_)->Signature.rootid|`Type(id,_)->Signature.rootid|`CoreType_->assertfalse|`Class(s,_)->Signature.roots|`ClassType(s,_)->Signature.roots|`Page(r,_)->rendmoduleModule=structtypet=Paths_types.Identifier.module_letequal:t->t->bool=funt1t2->equal(t1:t:>Paths_types.Identifier.any)(t2:t:>Paths_types.Identifier.any)lethash:t->int=funt->hash(t:t:>Paths_types.Identifier.any)letroot=function|`Root(r,_)->r|`Module(id,_)|`Argument(id,_,_)->Signature.rootidendmoduleModuleType=structtypet=Paths_types.Identifier.module_typeletequal:t->t->bool=funt1t2->equal(t1:t:>Paths_types.Identifier.any)(t2:t:>Paths_types.Identifier.any)lethash:t->int=funt->hash(t:t:>Paths_types.Identifier.any)letroot:t->Root.t=function|`ModuleType(id,_)->Signature.rootidendmoduleType=structtypet=Paths_types.Identifier.type_letequal:t->t->bool=funt1t2->equal(t1:t:>Paths_types.Identifier.any)(t2:t:>Paths_types.Identifier.any)lethash:t->int=funt->hash(t:t:>Paths_types.Identifier.any)endmoduleConstructor=structtypet=Paths_types.Identifier.constructorletequal:t->t->bool=funt1t2->equal(t1:t:>Paths_types.Identifier.any)(t2:t:>Paths_types.Identifier.any)lethash:t->int=funt->hash(t:t:>Paths_types.Identifier.any)endmoduleField=structtypet=Paths_types.Identifier.fieldletequal:t->t->bool=funt1t2->equal(t1:t:>Paths_types.Identifier.any)(t2:t:>Paths_types.Identifier.any)lethash:t->int=funt->hash(t:t:>Paths_types.Identifier.any)endmoduleExtension=structtypet=Paths_types.Identifier.extensionletequal:t->t->bool=funt1t2->equal(t1:t:>Paths_types.Identifier.any)(t2:t:>Paths_types.Identifier.any)lethash:t->int=funt->hash(t:t:>Paths_types.Identifier.any)endmoduleException=structtypet=Paths_types.Identifier.exception_letequal:t->t->bool=funt1t2->equal(t1:t:>Paths_types.Identifier.any)(t2:t:>Paths_types.Identifier.any)lethash:t->int=funt->hash(t:t:>Paths_types.Identifier.any)endmoduleValue=structtypet=Paths_types.Identifier.valueletequal:t->t->bool=funt1t2->equal(t1:t:>Paths_types.Identifier.any)(t2:t:>Paths_types.Identifier.any)lethash:t->int=funt->hash(t:t:>Paths_types.Identifier.any)endmoduleClass=structtypet=Paths_types.Identifier.class_letequal:t->t->bool=funt1t2->equal(t1:t:>Paths_types.Identifier.any)(t2:t:>Paths_types.Identifier.any)lethash:t->int=funt->hash(t:t:>Paths_types.Identifier.any)endmoduleClassType=structtypet=Paths_types.Identifier.class_typeletequal:t->t->bool=funt1t2->equal(t1:t:>Paths_types.Identifier.any)(t2:t:>Paths_types.Identifier.any)lethash:t->int=funt->hash(t:t:>Paths_types.Identifier.any)endmoduleMethod=structtypet=Paths_types.Identifier.method_letequal:t->t->bool=funt1t2->equal(t1:t:>Paths_types.Identifier.any)(t2:t:>Paths_types.Identifier.any)lethash:t->int=funt->hash(t:t:>Paths_types.Identifier.any)endmoduleInstanceVariable=structtypet=Paths_types.Identifier.instance_variableletequal:t->t->bool=funt1t2->equal(t1:t:>Paths_types.Identifier.any)(t2:t:>Paths_types.Identifier.any)lethash:t->int=funt->hash(t:t:>Paths_types.Identifier.any)endmoduleLabel=structtypet=Paths_types.Identifier.labelletequal:t->t->bool=funt1t2->equal(t1:t:>Paths_types.Identifier.any)(t2:t:>Paths_types.Identifier.any)lethash:t->int=funt->hash(t:t:>Paths_types.Identifier.any)endmodulePage=structtypet=Paths_types.Identifier.pageletequal:t->t->bool=funt1t2->equal(t1:t:>Paths_types.Identifier.any)(t2:t:>Paths_types.Identifier.any)lethash:t->int=funt->hash(t:t:>Paths_types.Identifier.any)endmodulePath=structmoduleModule=structtypet=Paths_types.Identifier.path_moduleletequal:t->t->bool=funt1t2->equal(t1:t:>Paths_types.Identifier.any)(t2:t:>Paths_types.Identifier.any)lethash:t->int=funt->hash(t:t:>Paths_types.Identifier.any)endmoduleModuleType=structtypet=Paths_types.Identifier.path_module_typeletequal:t->t->bool=funt1t2->equal(t1:t:>Paths_types.Identifier.any)(t2:t:>Paths_types.Identifier.any)lethash:t->int=funt->hash(t:t:>Paths_types.Identifier.any)endmoduleType=structtypet=Paths_types.Identifier.path_typeletequal:t->t->bool=funt1t2->equal(t1:t:>Paths_types.Identifier.any)(t2:t:>Paths_types.Identifier.any)lethash:t->int=funt->hash(t:t:>Paths_types.Identifier.any)endmoduleClassType=structtypet=Paths_types.Identifier.path_class_typeletequal:t->t->bool=funt1t2->equal(t1:t:>Paths_types.Identifier.any)(t2:t:>Paths_types.Identifier.any)lethash:t->int=funt->hash(t:t:>Paths_types.Identifier.any)endtypet=Paths_types.Identifier.path_anyendletto_reversedi=letrecloopacc:Signature.t->Reversed.t=function|`Root(_,s)->Reversed.Roots::acc|`Module(i,s)->loop(Reversed.Modules::acc)i|`ModuleType(i,s)->loop(Reversed.ModuleTypes::acc)i|`Argument(i,d,s)->loop(Reversed.Argument(d,s)::acc)iinloop[]iletsignature_of_modulem=(m:Module.t:>Signature.t)(* It would be much nicer not to have to have these functions *)letpage_of_t:t->Page.t=function|#Page.tasresult->result|_->assertfalseletsignature_of_t:t->Signature.t=function|#Signature.tasresult->result|_->assertfalseletclass_signature_of_t:t->ClassSignature.t=function|#ClassSignature.tasresult->result|_->assertfalseletdatatype_of_t:t->DataType.t=function|#DataType.tasresult->result|_->assertfalseletmodule_of_t:t->Module.t=function|#Module.tasresult->result|_->assertfalseletmodule_type_of_t:t->ModuleType.t=function|#ModuleType.tasresult->result|_->assertfalselettype_of_t:t->Type.t=function|#Type.tasresult->result|_->assertfalseletconstructor_of_t:t->Constructor.t=function|#Constructor.tasresult->result|_->assertfalseletfield_of_t:t->Field.t=function|#Field.tasresult->result|_->assertfalseletextension_of_t:t->Extension.t=function|#Extension.tasresult->result|_->assertfalseletexception_of_t:t->Exception.t=function|#Exception.tasresult->result|_->assertfalseletvalue_of_t:t->Value.t=function|#Value.tasresult->result|_->assertfalseletclass_of_t:t->Class.t=function|#Class.tasresult->result|_->assertfalseletclass_type_of_t:t->ClassType.t=function|#ClassType.tasresult->result|_->assertfalseletmethod_of_t:t->Method.t=function|#Method.tasresult->result|_->assertfalseletinstance_variable_of_t:t->InstanceVariable.t=function|#InstanceVariable.tasresult->result|_->assertfalseletlabel_of_t:t->Label.t=function|#Label.tasresult->result|_->assertfalseletparent_of_t:t->Parent.t=function|#Parent.tasresult->result|_->assertfalseendmodulePath=structtypet=Paths_types.Path.anyletrecequal_resolved_path:Paths_types.Resolved_path.any->Paths_types.Resolved_path.any->bool=letopenPaths_types.Resolved_pathinfunp1p2->matchp1,p2with|`Identifierid1,`Identifierid2->Identifier.equalid1id2|`Subst(sub1,p1),`Subst(sub2,p2)->equal_resolved_path(p1:module_:>any)(p2:module_:>any)&&equal_resolved_path(sub1:module_type:>any)(sub2:module_type:>any)|`SubstAlias(sub1,p1),`SubstAlias(sub2,p2)->equal_resolved_path(p1:module_:>any)(p2:module_:>any)&&equal_resolved_path(sub1:module_:>any)(sub2:module_:>any)|`Module(p1,s1),`Module(p2,s2)->s1=s2&&equal_resolved_path(p1:module_:>any)(p2:module_:>any)|`Apply(p1,arg1),`Apply(p2,arg2)->equal_path(arg1:Paths_types.Path.module_:>Paths_types.Path.any)(arg2:Paths_types.Path.module_:>Paths_types.Path.any)&&equal_resolved_path(p1:module_:>any)(p2:module_:>any)|`ModuleType(p1,s1),`ModuleType(p2,s2)->s1=s2&&equal_resolved_path(p1:module_:>any)(p2:module_:>any)|`Type(p1,s1),`Type(p2,s2)->s1=s2&&equal_resolved_path(p1:module_:>any)(p2:module_:>any)|`Class(p1,s1),`Class(p2,s2)->s1=s2&&equal_resolved_path(p1:module_:>any)(p2:module_:>any)|`ClassType(p1,s1),`ClassType(p2,s2)->s1=s2&&equal_resolved_path(p1:module_:>any)(p2:module_:>any)|_,_->falseandequal_path:Paths_types.Path.any->Paths_types.Path.any->bool=letopenPaths_types.Pathinfunp1p2->matchp1,p2with|`Resolvedp1,`Resolvedp2->equal_resolved_pathp1p2|`Roots1,`Roots2->s1=s2|`Dot(p1,s1),`Dot(p2,s2)->s1=s2&&equal_path(p1:module_:>any)(p2:module_:>any)|`Apply(p1,arg1),`Apply(p2,arg2)->equal_path(arg1:module_:>any)(arg2:module_:>any)&&equal_path(p1:module_:>any)(p2:module_:>any)|_,_->falseletrechash_resolved_path:Paths_types.Resolved_path.any->int=funp->letopenPaths_types.Resolved_pathinmatchpwith|`Identifierid->Identifier.hashid|`Subst(sub,p)->Hashtbl.hash(19,hash_resolved_path(sub:module_type:>any),hash_resolved_path(p:module_:>any))|`SubstAlias(sub,p)->Hashtbl.hash(20,hash_resolved_path(sub:module_:>any),hash_resolved_path(p:module_:>any))|`Hiddenp->Hashtbl.hash(21,hash_resolved_path(p:module_:>any))|`Module(p,s)->Hashtbl.hash(22,hash_resolved_path(p:module_:>any),s)|`Canonical(p,canonical)->Hashtbl.hash(23,hash_resolved_path(p:module_:>any),hash_path(canonical:Paths_types.Path.module_:>Paths_types.Path.any))|`Apply(p,arg)->Hashtbl.hash(24,hash_resolved_path(p:module_:>any),hash_path(arg:Paths_types.Path.module_:>Paths_types.Path.any))|`ModuleType(p,s)->Hashtbl.hash(25,hash_resolved_path(p:module_:>any),s)|`Type(p,s)->Hashtbl.hash(26,hash_resolved_path(p:module_:>any),s)|`Class(p,s)->Hashtbl.hash(27,hash_resolved_path(p:module_:>any),s)|`ClassType(p,s)->Hashtbl.hash(28,hash_resolved_path(p:module_:>any),s)andhash_path:Paths_types.Path.any->int=funp->letopenPaths_types.Pathinmatchpwith|`Resolvedp->hash_resolved_pathp|`Roots->Hashtbl.hash(29,s)|`Forwards->Hashtbl.hash(30,s)|`Dot(p,s)->Hashtbl.hash(31,hash_path(p:module_:>any),s)|`Apply(p,arg)->Hashtbl.hash(32,hash_path(p:module_:>any),hash_path(arg:module_:>any))letrecis_resolved_hidden:Paths_types.Resolved_path.any->bool=letopenPaths_types.Resolved_pathinfunction|`Identifier_->false|`Canonical(_,_)->false|`Hidden_->true|`Subst(p1,p2)->is_resolved_hidden(p1:module_type:>any)||is_resolved_hidden(p2:module_:>any)|`SubstAlias(p1,p2)->is_resolved_hidden(p1:module_:>any)||is_resolved_hidden(p2:module_:>any)|`Module(p,_)->is_resolved_hidden(p:module_:>any)|`Apply(p,_)->is_resolved_hidden(p:module_:>any)|`ModuleType(p,_)->is_resolved_hidden(p:module_:>any)|`Type(p,_)->is_resolved_hidden(p:module_:>any)|`Class(p,_)->is_resolved_hidden(p:module_:>any)|`ClassType(p,_)->is_resolved_hidden(p:module_:>any)andis_path_hidden:Paths_types.Path.any->bool=letopenPaths_types.Pathinfunction|`Resolvedr->is_resolved_hiddenr|`Root_->false|`Forward_->false|`Dot(p,_)->is_path_hidden(p:module_:>any)|`Apply(p1,p2)->is_path_hidden(p1:module_:>any)||is_path_hidden(p2:module_:>any)moduleResolved=structtypet=Paths_types.Resolved_path.anyletrecparent_module_type_identifier:Paths_types.Resolved_path.module_type->Identifier.Signature.t=function|`Identifierid->(id:Identifier.ModuleType.t:>Identifier.Signature.t)|`ModuleType(m,n)->`ModuleType(parent_module_identifierm,n)andparent_module_identifier:Paths_types.Resolved_path.module_->Identifier.Signature.t=function|`Identifierid->(id:Identifier.Module.t:>Identifier.Signature.t)|`Subst(sub,_)->parent_module_type_identifiersub|`SubstAlias(sub,_)->parent_module_identifiersub|`Hiddenp->parent_module_identifierp|`Module(m,n)->`Module(parent_module_identifierm,n)|`Canonical(_,`Resolvedp)->parent_module_identifierp|`Canonical(p,_)->parent_module_identifierp|`Apply(m,_)->parent_module_identifiermletequalp1p2=equal_resolved_pathp1p2lethashp=hash_resolved_pathptyperebase_result=|StopofPaths_types.Resolved_path.module_|ContinueofPaths_types.Identifier.path_module*Reversed.tletrecrebase_module_path:Reversed.t->Paths_types.Resolved_path.module_->rebase_result=funnew_baset->matchtwith|`Identifierid->letrev=Identifier.(to_reversed@@signature_of_moduleid)inletnew_base'=Reversed.remove_prefixrev~of_:new_baseinifnew_base==new_base'thenStoptelseContinue(id,new_base')|`Subst(_,p)|`SubstAlias(_,p)|`Hiddenp->beginmatchrebase_module_pathnew_basepwith|Stopp'whenp==p'->Stopt|otherwise->otherwiseend|`Module(m,s)->beginmatchrebase_module_pathnew_basemwith|Stopm'->ifm==m'thenStoptelseStop(`Module(m',s))|Continue(id,new_base)->letid=`Module(Identifier.signature_of_moduleid,s)inmatchnew_basewith|Reversed.Modules'::restwhens=s'->Continue(id,rest)|_->Stop(`Identifierid)end|`Canonical(_,`Resolvedp)->(* We only care about printing at this point, so let's drop the lhs. *)rebase_module_pathnew_basep|`Canonical(rp,p)->beginmatchrebase_module_pathnew_baserpwith|Stoprp'->Stop(`Canonical(rp',p))|_->(* We might come back at some point with a resolved rhs? So we don't want to
drop it. *)Stoptend|`Apply_->Stopt(* TODO: rewrite which side? *)letrecequal_identifier:Identifier.t->t->bool=funidp->matchid,pwith|_,`Identifierid'->Identifier.equalidid'|`Module(id,s1),`Module(p,s2)whens1=s2->equal_identifier(id:Paths_types.Identifier.signature:>Paths_types.Identifier.any)(p:Paths_types.Resolved_path.module_:>Paths_types.Resolved_path.any)|`ModuleType(id,s1),`ModuleType(p,s2)whens1=s2->equal_identifier(id:Paths_types.Identifier.signature:>Paths_types.Identifier.any)(p:Paths_types.Resolved_path.module_:>Paths_types.Resolved_path.any)|_,_->falsemoduleModule=structtypet=Paths_types.Resolved_path.module_letof_identid=`Identifieridletequalm1m2=equal_resolved_path(m1:t:>Paths_types.Resolved_path.any)(m2:t:>Paths_types.Resolved_path.any)lethashm=hash(m:t:>Paths_types.Resolved_path.any)letis_hiddenm=is_resolved_hidden(m:t:>Paths_types.Resolved_path.any)letrecidentifier=function|`Identifierid->id|`Subst(_,p)->identifierp|`SubstAlias(_,p)->identifierp|`Hiddenp->identifierp|`Module(m,n)->`Module(parent_module_identifierm,n)|`Canonical(_,`Resolvedp)->identifierp|`Canonical(p,_)->identifierp|`Apply(m,_)->identifiermletrebase:Reversed.t->t->t=funnew_baset->matchtwith|`Identifier_->t|`Subst_->t(* TODO: rewrite which side? *)|`SubstAlias_->t(* TODO: rewrite which side? *)|`Hiddenp->beginmatchrebase_module_pathnew_basepwith|Stopp'->ifp==p'thentelsep'|Continue(id,_)->`Identifieridend|`Module(mp,s)->beginmatchrebase_module_pathnew_basempwith|Continue(id,_)->`Identifier(`Module(Identifier.signature_of_moduleid,s))|Stopmp'->`Module(mp',s)end|`Canonical(p,`Resolvedrp)->beginmatchrebase_module_pathnew_baserpwith|Continue(id,_)->`Identifierid|Stoprp->(* Easier to reexport a canonical than get the type for rp right... *)`Canonical(p,`Resolvedrp)end|`Canonical(rp,p)->beginmatchrebase_module_pathnew_baserpwith|Stoprp'->`Canonical(rp',p)|_->(* We might come back at some point with a resolved rhs? So we don't want to
drop it. *)tend|`Apply(mp,arg)->beginmatchrebase_module_pathnew_basempwith|Continue(id,_)->`Apply(`Identifierid,arg)|Stopmp'->`Apply(mp',arg)endletrebaseidt=letrev=Identifier.to_reversedidinrebaserevtletequal_identifier:Identifier.Path.Module.t->t->bool=funidt->equal_identifier(id:Identifier.Path.Module.t:>Identifier.t)(t:t:>Paths_types.Resolved_path.any)endmoduleModuleType=structtypet=Paths_types.Resolved_path.module_typeletof_identid=`Identifieridletequalm1m2=equal_resolved_path(m1:t:>Paths_types.Resolved_path.any)(m2:t:>Paths_types.Resolved_path.any)lethashm=hash(m:t:>Paths_types.Resolved_path.any)letis_hiddenm=is_resolved_hidden(m:t:>Paths_types.Resolved_path.any)letidentifier=function|`Identifierid->id|`ModuleType(m,n)->`ModuleType(parent_module_identifierm,n)letrebase:Reversed.t->t->t=funnew_baset->matchtwith|`Identifier_->t|`ModuleType(mp,s)->beginmatchrebase_module_pathnew_basempwith|Continue(id,_)->`Identifier(`ModuleType(Identifier.signature_of_moduleid,s))|Stopmp'->`ModuleType(mp',s)endletrebaseidt=letrev=Identifier.to_reversedidinrebaserevtletequal_identifier:Identifier.Path.ModuleType.t->t->bool=funidt->equal_identifier(id:Identifier.Path.ModuleType.t:>Identifier.t)(t:t:>Paths_types.Resolved_path.any)endmoduleType=structtypet=Paths_types.Resolved_path.type_letof_identid=`Identifieridletequalm1m2=equal_resolved_path(m1:t:>Paths_types.Resolved_path.any)(m2:t:>Paths_types.Resolved_path.any)lethashm=hash(m:t:>Paths_types.Resolved_path.any)letis_hiddenm=is_resolved_hidden(m:t:>Paths_types.Resolved_path.any)letidentifier=function|`Identifierid->id|`Type(m,n)->`Type(parent_module_identifierm,n)|`Class(m,n)->`Class(parent_module_identifierm,n)|`ClassType(m,n)->`ClassType(parent_module_identifierm,n)letrebase:Reversed.t->t->t=funnew_baset->matchtwith|`Identifier_->t|`Type(mp,s)->beginmatchrebase_module_pathnew_basempwith|Continue(id,_)->`Identifier(`Type(Identifier.signature_of_moduleid,s))|Stopmp'->`Type(mp',s)end|`Class(mp,s)->beginmatchrebase_module_pathnew_basempwith|Continue(id,_)->`Identifier(`Class(Identifier.signature_of_moduleid,s))|Stopmp'->`Class(mp',s)end|`ClassType(mp,s)->beginmatchrebase_module_pathnew_basempwith|Continue(id,_)->`Identifier(`ClassType(Identifier.signature_of_moduleid,s))|Stopmp'->`ClassType(mp',s)endletrebaseidt=letrev=Identifier.to_reversedidinrebaserevtletequal_identifier:Identifier.Path.Type.t->t->bool=funidt->equal_identifier(id:Identifier.Path.Type.t:>Identifier.t)(t:t:>Paths_types.Resolved_path.any)endmoduleClassType=structtypet=Paths_types.Resolved_path.class_typeletof_identid=`Identifieridletequalm1m2=equal_resolved_path(m1:t:>Paths_types.Resolved_path.any)(m2:t:>Paths_types.Resolved_path.any)lethashm=hash(m:t:>Paths_types.Resolved_path.any)letis_hiddenm=is_resolved_hidden(m:t:>Paths_types.Resolved_path.any)letidentifier=function|`Identifierid->id|`Class(m,n)->`Class(parent_module_identifierm,n)|`ClassType(m,n)->`ClassType(parent_module_identifierm,n)letrebase:Reversed.t->t->t=funnew_baset->matchtwith|`Identifier_->t|`Class(mp,s)->beginmatchrebase_module_pathnew_basempwith|Continue(id,_)->`Identifier(`Class(Identifier.signature_of_moduleid,s))|Stopmp'->`Class(mp',s)end|`ClassType(mp,s)->beginmatchrebase_module_pathnew_basempwith|Continue(id,_)->`Identifier(`ClassType(Identifier.signature_of_moduleid,s))|Stopmp'->`ClassType(mp',s)endletrebaseidt=letrev=Identifier.to_reversedidinrebaserevtletequal_identifier:Identifier.Path.ClassType.t->t->bool=funidt->equal_identifier(id:Identifier.Path.ClassType.t:>Identifier.t)(t:t:>Paths_types.Resolved_path.any)endletmodule_of_t:t->Module.t=function|`Identifier(#Identifier.Path.Module.t)|#Paths_types.Resolved_path.module_no_idasx->x|_->assertfalseletmodule_type_of_t:t->ModuleType.t=function|`Identifier(#Identifier.Path.ModuleType.t)|#Paths_types.Resolved_path.module_type_no_idasx->x|_->assertfalselettype_of_t:t->Type.t=function|`Identifier(#Identifier.Path.Type.t)|#Paths_types.Resolved_path.type_no_idasx->x|_->assertfalseletclass_type_of_t:t->ClassType.t=function|`Identifier(#Identifier.Path.ClassType.t)|#Paths_types.Resolved_path.class_type_no_idasx->x|_->assertfalseletrecidentifier:t->Identifier.t=function|`Identifierid->id|`Subst(_,p)->identifier(p:>t)|`SubstAlias(_,p)->identifier(p:>t)|`Hiddenp->identifier(p:>t)|`Module(m,n)->`Module(parent_module_identifierm,n)|`Canonical(_,`Resolvedp)->identifier(p:>t)|`Canonical(p,_)->identifier(p:>t)|`Apply(m,_)->identifier(m:>t)|`Type(m,n)->`Type(parent_module_identifierm,n)|`ModuleType(m,n)->`ModuleType(parent_module_identifierm,n)|`Class(m,n)->`Class(parent_module_identifierm,n)|`ClassType(m,n)->`ClassType(parent_module_identifierm,n)endmoduleModule=structtypet=Paths_types.Path.module_letequal:t->t->bool=funp1p2->equal_path(p1:t:>Paths_types.Path.any)(p2:t:>Paths_types.Path.any)lethash:t->int=funt->hash_path(t:t:>Paths_types.Path.any)letis_hidden:t->bool=funt->is_path_hidden(t:t:>Paths_types.Path.any)endmoduleModuleType=structtypet=Paths_types.Path.module_typeletequal:t->t->bool=funp1p2->equal_path(p1:t:>Paths_types.Path.any)(p2:t:>Paths_types.Path.any)lethash:t->int=funt->hash_path(t:t:>Paths_types.Path.any)letis_hidden:t->bool=funt->is_path_hidden(t:t:>Paths_types.Path.any)endmoduleType=structtypet=Paths_types.Path.type_letequal:t->t->bool=funp1p2->equal_path(p1:t:>Paths_types.Path.any)(p2:t:>Paths_types.Path.any)lethash:t->int=funt->hash_path(t:t:>Paths_types.Path.any)letis_hidden:t->bool=funt->is_path_hidden(t:t:>Paths_types.Path.any)endmoduleClassType=structtypet=Paths_types.Path.class_typeletequal:t->t->bool=funp1p2->equal_path(p1:t:>Paths_types.Path.any)(p2:t:>Paths_types.Path.any)lethash:t->int=funt->hash_path(t:t:>Paths_types.Path.any)letis_hidden:t->bool=funt->is_path_hidden(t:t:>Paths_types.Path.any)endletmodule_of_t:t->Module.t=function|`Resolved(`Identifier(#Paths_types.Identifier.path_module))|`Resolved(#Paths_types.Resolved_path.module_no_id)|`Root_|`Forward_|`Dot(_,_)|`Apply(_,_)asx->x|_->assertfalseletmodule_type_of_t:t->ModuleType.t=function|`Resolved(`Identifier(#Paths_types.Identifier.path_module_type))|`Resolved(#Paths_types.Resolved_path.module_type_no_id)|`Dot(_,_)asx->x|_->assertfalselettype_of_t:t->Type.t=function|`Resolved(`Identifier(#Paths_types.Identifier.path_type))|`Resolved(#Paths_types.Resolved_path.type_no_id)|`Dot(_,_)asx->x|_->assertfalseletclass_type_of_t:t->ClassType.t=function|`Resolved(`Identifier(#Paths_types.Identifier.path_class_type))|`Resolved(#Paths_types.Resolved_path.class_type_no_id)|`Dot(_,_)asx->x|_->assertfalseletmodule_:Module.t->ModuleName.t->Module.t=funpname->matchpwith|`Resolvedp->`Resolved(`Module(p,name))|p->`Dot(p,ModuleName.to_stringname)letapplyparg=matchpwith|`Resolvedp->`Resolved(`Apply(p,arg))|p->`Apply(p,arg)letmodule_typepname=matchpwith|`Resolvedp->`Resolved(`ModuleType(p,name))|p->`Dot(p,ModuleTypeName.to_stringname)letis_hidden=is_path_hiddenletequal=equal_pathlethash=hash_pathendmoduleFragment=structmoduleResolved=structtypet=Paths_types.Resolved_fragment.anylett_of_modulem=(m:Paths_types.Resolved_fragment.module_:>t)lett_of_signatures=(s:Paths_types.Resolved_fragment.signature:>t)letequalp1p2=letrecloop:t->t->bool=funp1p2->matchp1,p2with|`Root,`Root->true|`Subst(sub1,p1),`Subst(sub2,p2)->Path.Resolved.ModuleType.equalsub1sub2&&loop(t_of_modulep1)(t_of_modulep2)|`SubstAlias(sub1,p1),`SubstAlias(sub2,p2)->Path.Resolved.Module.equalsub1sub2&&loop(t_of_modulep1)(t_of_modulep2)|`Module(p1,s1),`Module(p2,s2)->s1=s2&&loop(t_of_signaturep1)(t_of_signaturep2)|`Type(p1,s1),`Type(p2,s2)->s1=s2&&loop(t_of_signaturep1)(t_of_signaturep2)|`Class(p1,s1),`Class(p2,s2)->s1=s2&&loop(t_of_signaturep1)(t_of_signaturep2)|`ClassType(p1,s1),`ClassType(p2,s2)->s1=s2&&loop(t_of_signaturep1)(t_of_signaturep2)|_,_->falseinloopp1p2lethashp=letrecloop:t->int=funp->matchpwith|`Root->Hashtbl.hash32|`Subst(sub,p)->Hashtbl.hash(34,Path.Resolved.ModuleType.hashsub,loop(t_of_modulep))|`SubstAlias(sub,p)->Hashtbl.hash(35,Path.Resolved.Module.hashsub,loop(t_of_modulep))|`Module(p,s)->Hashtbl.hash(36,loop(t_of_signaturep),s)|`Type(p,s)->Hashtbl.hash(37,loop(t_of_signaturep),s)|`Class(p,s)->Hashtbl.hash(38,loop(t_of_signaturep),s)|`ClassType(p,s)->Hashtbl.hash(39,loop(t_of_signaturep),s)inlooppletsig_of_modm=letopenPaths_types.Resolved_fragmentin(m:module_:>signature)letrecparent_resolved_path:Path.Resolved.Module.t->Paths_types.Resolved_fragment.signature->Path.Resolved.Module.t=funroot->function|`Root->root|`Subst(sub,p)->`Subst(sub,parent_resolved_pathroot(sig_of_modp))|`SubstAlias(sub,p)->`SubstAlias(sub,parent_resolved_pathroot(sig_of_modp))|`Module(m,n)->`Module(parent_resolved_pathrootm,n)letrecparent_unresolved_path:Path.Module.t->Paths_types.Resolved_fragment.signature->Path.Module.t=funroot->function|`Root->root|`Subst(_,p)->parent_unresolved_pathroot(sig_of_modp)|`SubstAlias(_,p)->parent_unresolved_pathroot(sig_of_modp)|`Module(m,n)->`Dot(parent_unresolved_pathrootm,(ModuleName.to_stringn))letparent_pathrootfrag=matchrootwith|`Resolvedroot->`Resolved(parent_resolved_pathrootfrag)|_->parent_unresolved_pathrootfragtypebase_name=|Base|BranchofModuleName.t*Paths_types.Resolved_fragment.signatureletrecsplit_parent:Paths_types.Resolved_fragment.signature->base_name=function|`Root->Base|`Subst(_,p)->split_parent(sig_of_modp)|`SubstAlias(_,p)->split_parent(sig_of_modp)|`Module(p,name)->matchsplit_parentpwith|Base->Branch(name,`Root)|Branch(base,m)->Branch(base,`Module(m,name))moduleSignature=structtypet=Paths_types.Resolved_fragment.signatureletequals1s2=equal(s1:t:>Paths_types.Resolved_fragment.any)(s2:t:>Paths_types.Resolved_fragment.any)lethashs=hash(s:t:>Paths_types.Resolved_fragment.any)letrecresolved_path:Path.Resolved.Module.t->t->Path.Resolved.Module.t=funrootfrag->matchfragwith|`Root->root|`Subst(sub,p)->`Subst(sub,resolved_pathroot(sig_of_modp))|`SubstAlias(sub,p)->`SubstAlias(sub,resolved_pathroot(sig_of_modp))|`Module(m,n)->`Module(parent_resolved_pathrootm,n)letrecunresolved_path:Path.Module.t->t->Path.Module.t=funrootfrag->matchfragwith|`Root->root|`Subst(_,p)->unresolved_pathroot(sig_of_modp)|`SubstAlias(_,p)->unresolved_pathroot(sig_of_modp)|`Module(m,n)->`Dot(parent_unresolved_pathrootm,ModuleName.to_stringn)letpath:Path.Module.t->t->Path.Module.t=funrootfrag->matchrootwith|`Resolvedroot->`Resolved(resolved_pathrootfrag)|_->unresolved_pathrootfragletrecsplit:t->string*toption=function|`Root->"",None|`Subst(_,p)->split(sig_of_modp)|`SubstAlias(_,p)->split(sig_of_modp)|`Module(m,name)->beginmatchsplit_parentmwith|Base->(ModuleName.to_stringname,None)|Branch(base,m)->ModuleName.to_stringbase,Some(`Module(m,name))endletrecidentifier:Identifier.Signature.t->t->Identifier.Signature.t=funroot->function|`Root->root|`Subst(_,p)->identifierroot(sig_of_modp)|`SubstAlias(_,p)->identifierroot(sig_of_modp)|`Module(m,n)->`Module(identifierrootm,n)endmoduleModule=structtypet=Paths_types.Resolved_fragment.module_letequals1s2=equal(s1:t:>Paths_types.Resolved_fragment.any)(s2:t:>Paths_types.Resolved_fragment.any)lethashs=hash(s:t:>Paths_types.Resolved_fragment.any)letresolved_path:Path.Resolved.Module.t->t->Path.Resolved.Module.t=funrootfrag->matchfragwith|`Subst(sub,p)->`Subst(sub,Signature.resolved_pathroot(sig_of_modp))|`SubstAlias(sub,p)->`SubstAlias(sub,Signature.resolved_pathroot(sig_of_modp))|`Module(m,n)->`Module(parent_resolved_pathrootm,n)letunresolved_path:Path.Module.t->t->Path.Module.t=funrootfrag->matchfragwith|`Subst(_,p)->Signature.unresolved_pathroot(sig_of_modp)|`SubstAlias(_,p)->Signature.unresolved_pathroot(sig_of_modp)|`Module(m,n)->`Dot(parent_unresolved_pathrootm,ModuleName.to_stringn)letpath:Path.Module.t->t->Path.Module.t=funrootfrag->matchrootwith|`Resolvedroot->`Resolved(resolved_pathrootfrag)|_->unresolved_pathrootfragletrecsplit:t->string*toption=function|`Subst(_,p)->splitp|`SubstAlias(_,p)->splitp|`Module(m,name)->beginmatchsplit_parentmwith|Base->(ModuleName.to_stringname,None)|Branch(base,m)->ModuleName.to_stringbase,Some(`Module(m,name))endletrecidentifier:Identifier.Signature.t->t->Identifier.Path.Module.t=funroot->function|`Subst(_,p)->identifierrootp|`SubstAlias(_,p)->identifierrootp|`Module(m,n)->`Module(Signature.identifierrootm,n)endmoduleType=structtypet=Paths_types.Resolved_fragment.type_letequals1s2=equal(s1:t:>Paths_types.Resolved_fragment.any)(s2:t:>Paths_types.Resolved_fragment.any)lethashs=hash(s:t:>Paths_types.Resolved_fragment.any)letresolved_path:Path.Resolved.Module.t->t->Path.Resolved.Type.t=funroot->function|`Type(m,n)->`Type(Signature.resolved_pathrootm,n)|`Class(m,n)->`Class(Signature.resolved_pathrootm,n)|`ClassType(m,n)->`ClassType(Signature.resolved_pathrootm,n)letunresolved_path:Path.Module.t->t->Path.Type.t=funroot->function|`Type(m,n)->`Dot(Signature.unresolved_pathrootm,TypeName.to_stringn)|`Class(m,n)->`Dot(Signature.unresolved_pathrootm,ClassName.to_stringn)|`ClassType(m,n)->`Dot(Signature.unresolved_pathrootm,ClassTypeName.to_stringn)letpath:Path.Module.t->t->Path.Type.t=funrootfrag->matchrootwith|`Resolvedroot->`Resolved(resolved_pathrootfrag)|_->unresolved_pathrootfragletsplit:t->string*toption=function|`Type(m,name)->beginmatchsplit_parentmwith|Base->TypeName.to_stringname,None|Branch(base,m)->ModuleName.to_stringbase,Some(`Type(m,name))end|`Class(m,name)->beginmatchsplit_parentmwith|Base->ClassName.to_stringname,None|Branch(base,m)->ModuleName.to_stringbase,Some(`Class(m,name))end|`ClassType(m,name)->beginmatchsplit_parentmwith|Base->ClassTypeName.to_stringname,None|Branch(base,m)->ModuleName.to_stringbase,Some(`ClassType(m,name))endletidentifier:Identifier.Signature.t->t->Identifier.Path.Type.t=funroot->function|`Type(m,n)->`Type(Signature.identifierrootm,n)|`Class(m,n)->`Class(Signature.identifierrootm,n)|`ClassType(m,n)->`ClassType(Signature.identifierrootm,n)endletsignature_of_t:t->Signature.t=function|#Signature.tasx->x|_->assertfalseletmodule_of_t:t->Module.t=function|#Module.tasx->x|_->assertfalselettype_of_t:t->Type.t=function|#Type.tasx->x|_->assertfalseletrecidentifier:Identifier.Signature.t->t->Identifier.t=funroot->function|`Root->(root:>Identifier.t)|`Subst(_,p)->identifierroot(p:>t)|`SubstAlias(_,p)->identifierroot(p:>t)|`Module(m,n)->`Module(Signature.identifierrootm,n)|`Type(m,n)->`Type(Signature.identifierrootm,n)|`Class(m,n)->`Class(Signature.identifierrootm,n)|`ClassType(m,n)->`ClassType(Signature.identifierrootm,n)endtypet=Paths_types.Fragment.anyletrecparent_path:Path.Module.t->Paths_types.Fragment.signature->Path.Module.t=funroot->function|`Resolvedr->Resolved.parent_pathrootr|`Dot(m,n)->`Dot(parent_pathrootm,n)typebase_name=|Base|BranchofModuleName.t*Paths_types.Fragment.signatureletrecsplit_parent:Paths_types.Fragment.signature->base_name=function|`Resolvedr->beginmatchResolved.split_parentrwith|Resolved.Base->Base|Resolved.Branch(base,m)->Branch(base,`Resolvedm)end|`Dot(m,name)->beginmatchsplit_parentmwith|Base->Branch(ModuleName.of_stringname,`Resolved`Root)|Branch(base,m)->Branch(base,`Dot(m,name))endletequalp1p2=letrecloop:t->t->bool=funp1p2->matchp1,p2with|`Resolvedp1,`Resolvedp2->Resolved.equalp1p2|`Dot(p1,s1),`Dot(p2,s2)->s1=s2&&loop(p1:Paths_types.Fragment.signature:>t)(p2:Paths_types.Fragment.signature:>t)|_,_->falseinloopp1p2lethashp=letrecloop:t->int=funp->matchpwith|`Resolvedp->Resolved.hashp|`Dot(p,s)->Hashtbl.hash(40,loop(p:Paths_types.Fragment.signature:>t),s)inlooppmoduleSignature=structtypet=Paths_types.Fragment.signatureletequalt1t2=equal(t1:t:>Paths_types.Fragment.any)(t2:t:>Paths_types.Fragment.any)lethasht=hash(t:t:>Paths_types.Fragment.any)letsplit:t->string*toption=function|`Resolvedr->letbase,m=Resolved.Signature.splitrinletm=matchmwith|None->None|Somem->Some(`Resolvedm)inbase,m|`Dot(m,name)->matchsplit_parentmwith|Base->name,None|Branch(base,m)->ModuleName.to_stringbase,Some(`Dot(m,name))letpath:Path.Module.t->t->Path.Module.t=funroot->function|`Resolvedr->Resolved.Signature.pathrootr|`Dot(m,s)->`Dot(parent_pathrootm,s)endmoduleModule=structtypet=Paths_types.Fragment.module_letequalt1t2=equal(t1:t:>Paths_types.Fragment.any)(t2:t:>Paths_types.Fragment.any)lethasht=hash(t:t:>Paths_types.Fragment.any)letsplit:t->string*toption=function|`Resolvedr->letbase,m=Resolved.Module.splitrinletm=matchmwith|None->None|Somem->Some(`Resolvedm)inbase,m|`Dot(m,name)->matchsplit_parentmwith|Base->name,None|Branch(base,m)->ModuleName.to_stringbase,Some(`Dot(m,name))letpath:Path.Module.t->t->Path.Module.t=funroot->function|`Resolvedr->Resolved.Module.pathrootr|`Dot(m,s)->`Dot(parent_pathrootm,s)endmoduleType=structtypet=Paths_types.Fragment.type_letequalt1t2=equal(t1:t:>Paths_types.Fragment.any)(t2:t:>Paths_types.Fragment.any)lethasht=hash(t:t:>Paths_types.Fragment.any)letsplit:t->string*toption=function|`Resolvedr->letbase,m=Resolved.Type.splitrinletm=matchmwith|None->None|Somem->Some(`Resolvedm)inbase,m|`Dot(m,name)->matchsplit_parentmwith|Base->name,None|Branch(base,m)->ModuleName.to_stringbase,Some(`Dot(m,name))letpath:Path.Module.t->t->Path.Type.t=funroot->function|`Resolvedr->Resolved.Type.pathrootr|`Dot(m,s)->`Dot(parent_pathrootm,s)endletsignature_of_t:t->Signature.t=function|`Resolved(#Resolved.Signature.t)|`Dot(_,_)asx->x|_->assertfalseletmodule_of_t:t->Module.t=function|`Resolved(#Resolved.Module.t)|`Dot(_,_)asx->x|_->assertfalselettype_of_t:t->Type.t=function|`Resolved(#Resolved.Type.t)|`Dot(_,_)asx->x|_->assertfalseendmoduleReference=structletrechash_resolved:Paths_types.Resolved_reference.any->int=funp->letopenPaths_types.Resolved_referenceinmatchpwith|`Identifierid->Identifier.hashid|`SubstAlias(r1,r2)->Hashtbl.hash(41,Path.Resolved.Module.hashr1,hash_resolved(r2:module_:>any))|`Module(p,s)->Hashtbl.hash(42,hash_resolved(p:signature:>any),s)|`Canonical(rp,p)->Hashtbl.hash(43,hash_resolved(rp:module_:>any),hash_reference(p:Paths_types.Reference.module_:>Paths_types.Reference.any))|`ModuleType(p,s)->Hashtbl.hash(44,hash_resolved(p:signature:>any),s)|`Type(p,s)->Hashtbl.hash(45,hash_resolved(p:signature:>any),s)|`Constructor(p,s)->Hashtbl.hash(46,hash_resolved(p:datatype:>any),s)|`Field(p,s)->Hashtbl.hash(47,hash_resolved(p:parent:>any),s)|`Extension(p,s)->Hashtbl.hash(48,hash_resolved(p:signature:>any),s)|`Exception(p,s)->Hashtbl.hash(49,hash_resolved(p:signature:>any),s)|`Value(p,s)->Hashtbl.hash(50,hash_resolved(p:signature:>any),s)|`Class(p,s)->Hashtbl.hash(51,hash_resolved(p:signature:>any),s)|`ClassType(p,s)->Hashtbl.hash(52,hash_resolved(p:signature:>any),s)|`Method(p,s)->Hashtbl.hash(53,hash_resolved(p:class_signature:>any),s)|`InstanceVariable(p,s)->Hashtbl.hash(54,hash_resolved(p:class_signature:>any),s)|`Label(p,s)->Hashtbl.hash(55,hash_resolved(p:label_parent:>any),s)andhash_reference:Paths_types.Reference.any->int=funp->letopenPaths_types.Referenceinmatchpwith|`Resolvedp->hash_resolvedp|`Root(s,k)->Hashtbl.hash(56,s,k)|`Dot(p,s)->Hashtbl.hash(57,hash_reference(p:label_parent:>any),s)|`Module(p,s)->Hashtbl.hash(58,hash_reference(p:signature:>any),s)|`ModuleType(p,s)->Hashtbl.hash(59,hash_reference(p:signature:>any),s)|`Type(p,s)->Hashtbl.hash(60,hash_reference(p:signature:>any),s)|`Constructor(p,s)->Hashtbl.hash(61,hash_reference(p:datatype:>any),s)|`Field(p,s)->Hashtbl.hash(62,hash_reference(p:parent:>any),s)|`Extension(p,s)->Hashtbl.hash(63,hash_reference(p:signature:>any),s)|`Exception(p,s)->Hashtbl.hash(64,hash_reference(p:signature:>any),s)|`Value(p,s)->Hashtbl.hash(65,hash_reference(p:signature:>any),s)|`Class(p,s)->Hashtbl.hash(66,hash_reference(p:signature:>any),s)|`ClassType(p,s)->Hashtbl.hash(67,hash_reference(p:signature:>any),s)|`Method(p,s)->Hashtbl.hash(68,hash_reference(p:class_signature:>any),s)|`InstanceVariable(p,s)->Hashtbl.hash(69,hash_reference(p:class_signature:>any),s)|`Label(p,s)->Hashtbl.hash(70,hash_reference(p:label_parent:>any),s)letrecresolved_equal:Paths_types.Resolved_reference.any->Paths_types.Resolved_reference.any->bool=letopenPaths_types.Resolved_referenceinfunid1id2->matchid1,id2with|`Identifierid1,`Identifierid2->Identifier.equalid1id2|`SubstAlias(r1,m1),`SubstAlias(r2,m2)->Path.Resolved.equal(r1:Path.Resolved.Module.t:>Path.Resolved.t)(r2:Path.Resolved.Module.t:>Path.Resolved.t)&&resolved_equal(m1:module_:>any)(m2:module_:>any)|`Module(r1,s1),`Module(r2,s2)->s1=s2&&resolved_equal(r1:signature:>any)(r2:signature:>any)|`Canonical(m1,r1),`Canonical(m2,r2)->equal(r1:Paths_types.Reference.module_:>Paths_types.Reference.any)(r2:Paths_types.Reference.module_:>Paths_types.Reference.any)&&resolved_equal(m1:module_:>any)(m2:module_:>any)|`ModuleType(r1,s1),`ModuleType(r2,s2)->s1=s2&&resolved_equal(r1:signature:>any)(r2:signature:>any)|`Type(r1,s1),`Type(r2,s2)->s1=s2&&resolved_equal(r1:signature:>any)(r2:signature:>any)|`Constructor(r1,s1),`Constructor(r2,s2)->s1=s2&&resolved_equal(r1:datatype:>any)(r2:datatype:>any)|`Field(r1,s1),`Field(r2,s2)->s1=s2&&resolved_equal(r1:parent:>any)(r2:parent:>any)|`Extension(r1,s1),`Extension(r2,s2)->s1=s2&&resolved_equal(r1:signature:>any)(r2:signature:>any)|`Exception(r1,s1),`Exception(r2,s2)->s1=s2&&resolved_equal(r1:signature:>any)(r2:signature:>any)|`Value(r1,s1),`Value(r2,s2)->s1=s2&&resolved_equal(r1:signature:>any)(r2:signature:>any)|`Class(r1,s1),`Class(r2,s2)->s1=s2&&resolved_equal(r1:signature:>any)(r2:signature:>any)|`ClassType(r1,s1),`ClassType(r2,s2)->s1=s2&&resolved_equal(r1:signature:>any)(r2:signature:>any)|`Method(r1,s1),`Method(r2,s2)->s1=s2&&resolved_equal(r1:class_signature:>any)(r2:class_signature:>any)|`InstanceVariable(r1,s1),`InstanceVariable(r2,s2)->s1=s2&&resolved_equal(r1:class_signature:>any)(r2:class_signature:>any)|`Label(r1,s1),`Label(r2,s2)->s1=s2&&resolved_equal(r1:label_parent:>any)(r2:label_parent:>any)|_,_->falseandequal:Paths_types.Reference.any->Paths_types.Reference.any->bool=letopenPaths_types.Referenceinfunr1r2->matchr1,r2with|`Resolvedr1,`Resolvedr2->resolved_equalr1r2|`Root(s1,k1),`Root(s2,k2)->s1=s2&&k1=k2|`Dot(r1,s1),`Dot(r2,s2)->s1=s2&&equal(r1:label_parent:>any)(r2:label_parent:>any)|`Module(r1,s1),`Module(r2,s2)->s1=s2&&equal(r1:signature:>any)(r2:signature:>any)|`ModuleType(r1,s1),`ModuleType(r2,s2)->s1=s2&&equal(r1:signature:>any)(r2:signature:>any)|`Type(r1,s1),`Type(r2,s2)->s1=s2&&equal(r1:signature:>any)(r2:signature:>any)|`Constructor(r1,s1),`Constructor(r2,s2)->s1=s2&&equal(r1:datatype:>any)(r2:datatype:>any)|`Field(r1,s1),`Field(r2,s2)->s1=s2&&equal(r1:parent:>any)(r2:parent:>any)|`Extension(r1,s1),`Extension(r2,s2)->s1=s2&&equal(r1:signature:>any)(r2:signature:>any)|`Exception(r1,s1),`Exception(r2,s2)->s1=s2&&equal(r1:signature:>any)(r2:signature:>any)|`Class(r1,s1),`Class(r2,s2)->s1=s2&&equal(r1:signature:>any)(r2:signature:>any)|`ClassType(r1,s1),`ClassType(r2,s2)->s1=s2&&equal(r1:signature:>any)(r2:signature:>any)|`Method(r1,s1),`Method(r2,s2)->s1=s2&&equal(r1:class_signature:>any)(r2:class_signature:>any)|`InstanceVariable(r1,s1),`InstanceVariable(r2,s2)->s1=s2&&equal(r1:class_signature:>any)(r2:class_signature:>any)|`Label(r1,s1),`Label(r2,s2)->s1=s2&&equal(r1:label_parent:>any)(r2:label_parent:>any)|_,_->falsemoduleResolved=structopenPaths_types.Resolved_referenceletrecparent_signature_identifier:Paths_types.Resolved_reference.signature->Identifier.Signature.t=function|`Identifierid->id|`SubstAlias(sub,_)->Path.Resolved.parent_module_identifiersub|`Module(m,n)->`Module(parent_signature_identifierm,n)|`Canonical(_,`Resolvedr)->parent_signature_identifier(r:module_:>signature)|`Canonical(r,_)->parent_signature_identifier(r:module_:>signature)|`ModuleType(m,s)->`ModuleType(parent_signature_identifierm,s)letparent_type_identifier:datatype->Identifier.DataType.t=function|`Identifierid->id|`Type(sg,s)->`Type(parent_signature_identifiersg,s)letparent_class_signature_identifier:class_signature->Identifier.ClassSignature.t=function|`Identifierid->id|`Class(sg,s)->`Class(parent_signature_identifiersg,s)|`ClassType(sg,s)->`ClassType(parent_signature_identifiersg,s)letrecparent_identifier:parent->Identifier.Parent.t=function|`Identifierid->id|`SubstAlias(sub,_)->letid=Path.Resolved.parent_module_identifiersubin(id:Identifier.Signature.t:>Identifier.Parent.t)|`Module(m,n)->`Module(parent_signature_identifierm,n)|`Canonical(_,`Resolvedr)->parent_identifier(r:module_:>parent)|`Canonical(r,_)->parent_identifier(r:module_:>parent)|`ModuleType(m,s)->`ModuleType(parent_signature_identifierm,s)|`Type(sg,s)->`Type(parent_signature_identifiersg,s)|`Class(sg,s)->`Class(parent_signature_identifiersg,s)|`ClassType(sg,s)->`ClassType(parent_signature_identifiersg,s)letreclabel_parent_identifier:label_parent->Identifier.LabelParent.t=function|`Identifierid->id|`SubstAlias(sub,_)->letid=Path.Resolved.parent_module_identifiersubin(id:Identifier.Signature.t:>Identifier.LabelParent.t)|`Module(m,n)->`Module(parent_signature_identifierm,n)|`Canonical(_,`Resolvedr)->label_parent_identifier(r:module_:>label_parent)|`Canonical(r,_)->label_parent_identifier(r:module_:>label_parent)|`ModuleType(m,s)->`ModuleType(parent_signature_identifierm,s)|`Type(sg,s)->`Type(parent_signature_identifiersg,s)|`Class(sg,s)->`Class(parent_signature_identifiersg,s)|`ClassType(sg,s)->`ClassType(parent_signature_identifiersg,s)typemod_rebase_result=|MStopofPaths_types.Resolved_reference.module_|MContinueofIdentifier.Module.t*Reversed.ttypesig_rebase_result=|SStopofPaths_types.Resolved_reference.signature|SContinueofIdentifier.Signature.t*Reversed.tletrecrebase_module_reference:Reversed.t->Paths_types.Resolved_reference.module_->mod_rebase_result=funnew_baset->matchtwith|`Identifierid->letrev=Identifier.(to_reversed@@signature_of_moduleid)inletnew_base=Reversed.remove_prefixrev~of_:new_baseinMContinue(id,new_base)|`SubstAlias_->MStopt(* FIXME? *)|`Module(m,s)->beginmatchrebase_signature_referencenew_basemwith|SStopm'->ifm==m'thenMStoptelseMStop(`Module(m',s))|SContinue(id,new_base)->letid=`Module(id,s)inmatchnew_basewith|Reversed.Modules'::restwhens=s'->MContinue(id,rest)|_->MStop(`Identifierid)end|`Canonical(_,`Resolvedp)->(* We only care about printing at this point, so let's drop the lhs. *)rebase_module_referencenew_basep|`Canonical(rp,p)->beginmatchrebase_module_referencenew_base(rp)with|MStoprp'->MStop(`Canonical(rp',p))|_->(* We might come back at some point with a resolved rhs? So we don't want to
drop it. *)MStoptendandrebase_signature_reference:Reversed.t->Paths_types.Resolved_reference.signature->sig_rebase_result=funnew_baset->matchtwith|`Identifierid->letrev=Identifier.(to_reversedid)inletnew_base=Reversed.remove_prefixrev~of_:new_baseinSContinue(id,new_base)|`ModuleType(m,s)->beginmatchrebase_signature_referencenew_basemwith|SStopm'->ifm==m'thenSStoptelseSStop(`ModuleType(m',s))|SContinue(id,new_base)->letid=`ModuleType(id,s)inmatchnew_basewith|Reversed.ModuleTypes'::restwhens=s'->SContinue(id,rest)|_->SStop(`Identifierid)end|`Module_|`Canonical_asx->beginmatchrebase_module_referencenew_basexwith|MStoprp->SStop(rp:module_:>signature)|MContinue(id,rev)->SContinue(Identifier.signature_of_moduleid,rev)end|`SubstAlias_->SStopt(* FIXME? *)letrebase_single_module=funnew_baset->matchtwith|`Module(mp,s)->beginmatchrebase_signature_referencenew_basempwith|SContinue(id,_)->`Identifier(`Module(id,s))|SStopmp'->`Module(mp',s)endtypemodule_id=[|`IdentifierofIdentifier.Module.t]letrebase_single_canonical:Reversed.t->s_canonical->[s_canonical|module_id]=funnew_baset->matchtwith|`Canonical(p,`Resolvedrp)->beginmatchrebase_module_referencenew_baserpwith|MContinue(id,_)->`Identifierid|MStoprp->(* Easier to reexport a canonical than get the type for rp right... *)`Canonical(p,`Resolvedrp)end|`Canonical(rp,p)->beginmatchrebase_module_referencenew_baserpwith|MStoprp'->`Canonical(rp',p)|_->(* We might come back at some point with a resolved rhs? So we don't want to
drop it. *)(t:>[s_canonical|module_id])endletrebase_single_module_type:Reversed.t->s_module_type->module_type=funnew_baset->matchtwith|`ModuleType(mp,s)->beginmatchrebase_signature_referencenew_basempwith|SContinue(id,_)->`Identifier(`ModuleType(id,s))|SStopmp'->`ModuleType(mp',s)endletrebase_single_module:Reversed.t->s_module->[s_module|`IdentifierofIdentifier.Module.t]=funnew_baset->matchtwith|`Module(x,y)->(rebase_single_modulenew_base(`Module(x,y)))letrebase_single_class:Reversed.t->s_class->class_=funnew_baset->matchtwith|`Class(mp,s)->beginmatchrebase_signature_referencenew_basempwith|SContinue(id,_)->`Identifier(`Class(id,s))|SStopmp'->`Class(mp',s)endletrebase_single_value:Reversed.t->s_value->[s_value|`IdentifierofIdentifier.Value.t]=funnew_baset->matchtwith|`Value(mp,s)->beginmatchrebase_signature_referencenew_basempwith|SContinue(id,_)->`Identifier(`Value(id,s))|SStopmp'->`Value(mp',s)endletrebase_single_class_type:Reversed.t->s_class_type->class_type=funnew_baset->matchtwith|`ClassType(mp,s)->beginmatchrebase_signature_referencenew_basempwith|SContinue(id,_)->`Identifier(`ClassType(id,s))|SStopmp'->`ClassType(mp',s)endletrebase_single_type:Reversed.t->s_type->[s_type|`IdentifierofPaths_types.Identifier.type_]=funnew_baset->matchtwith|`Type(mp,s)->beginmatchrebase_signature_referencenew_basempwith|SContinue(id,_)->`Identifier(`Type(id,s))|SStopmp'->`Type(mp',s)endletrebase_single_extension:Reversed.t->s_extension->[s_extension|`IdentifierofPaths_types.Identifier.reference_extension]=funnew_baset->matchtwith|`Extension(mp,s)->beginmatchrebase_signature_referencenew_basempwith|SContinue(id,_)->`Identifier(`Extension(id,s))|SStopmp'->`Extension(mp',s)endletrebase_single_exception:Reversed.t->s_exception->exception_=funnew_baset->matchtwith|`Exception(mp,s)->beginmatchrebase_signature_referencenew_basempwith|SContinue(id,_)->`Identifier(`Exception(id,s))|SStopmp'->`Exception(mp',s)endmoduleSignature=structtypet=Paths_types.Resolved_reference.signatureletequalt1t2=resolved_equal(t1:t:>any)(t2:t:>any)lethasht=hash_resolved(t:t:>any)letrecidentifier:t->Identifier.Signature.t=function|`Identifierid->id|`SubstAlias(_,p)->identifier(p:module_:>signature)|`Module(s,n)->`Module(parent_signature_identifiers,n)|`Canonical(_,`Resolvedp)->identifier(p:module_:>signature)|`Canonical(p,_)->identifier(p:module_:>signature)|`ModuleType(s,n)->`ModuleType(parent_signature_identifiers,n)letrebase:Reversed.t->t->t=funnew_baset->matchtwith|`Identifier_->t|`SubstAlias_->t(* TODO: rewrite necessary? *)|`Canonical(x,y)->(rebase_single_canonicalnew_base(`Canonical(x,y)):>t)|`Module(x,y)->(rebase_single_modulenew_base(`Module(x,y)):>t)|`ModuleType(x,y)->(rebase_single_module_typenew_base(`ModuleType(x,y)):>t)letrebaseidt=letrev=Identifier.to_reversedidinrebaserevtendmoduleClassSignature=structtypet=Paths_types.Resolved_reference.class_signatureletequalt1t2=resolved_equal(t1:t:>any)(t2:t:>any)lethasht=hash_resolved(t:t:>any)letidentifier:t->Identifier.ClassSignature.t=function|`Identifierid->id|`Class(s,n)->`Class(parent_signature_identifiers,n)|`ClassType(s,n)->`ClassType(parent_signature_identifiers,n)letrebase':Reversed.t->t->t=funnew_baset->matchtwith|`Identifier_->t|`Class(mp,s)->(rebase_single_classnew_base(`Class(mp,s)):>t)|`ClassType(x,y)->(rebase_single_class_typenew_base(`ClassType(x,y)):>t)letrebaseidt=letrev=Identifier.to_reversedidinrebase'revtendmoduleDataType=structtypet=Paths_types.Resolved_reference.datatypeletequalt1t2=resolved_equal(t1:t:>any)(t2:t:>any)lethasht=hash_resolved(t:t:>any)letidentifier:t->Identifier.DataType.t=function|`Identifierid->id|`Type(s,n)->`Type(parent_signature_identifiers,n)letrebase':Reversed.t->t->t=funnew_baset->matchtwith|`Identifier_->t|`Type(s,n)->(rebase_single_typenew_base(`Type(s,n)):>t)letrebaseidt=letrev=Identifier.to_reversedidinrebase'revtendletrebase_single_constructor:Reversed.t->s_constructor->s_constructor=funnew_baset->matchtwith|`Constructor(parent,s)->`Constructor(DataType.rebase'new_baseparent,s)moduleParent=structtypet=Paths_types.Resolved_reference.parentletequalt1t2=resolved_equal(t1:t:>any)(t2:t:>any)lethasht=hash_resolved(t:t:>any)letrecidentifier:t->Identifier.Parent.t=function|`Identifierid->id|`SubstAlias(_,p)->identifier(p:module_:>t)|`Module(s,n)->`Module(parent_signature_identifiers,n)|`Canonical(_,`Resolvedp)->identifier(p:module_:>t)|`Canonical(p,_)->identifier(p:module_:>t)|`ModuleType(s,n)->`ModuleType(parent_signature_identifiers,n)|`Class(s,n)->`Class(parent_signature_identifiers,n)|`ClassType(s,n)->`ClassType(parent_signature_identifiers,n)|`Type(s,n)->`Type(parent_signature_identifiers,n)letrebase':Reversed.t->t->t=funnew_baset->matchtwith|`Identifier_->t|`SubstAlias_->t(* TODO: rewrite necessary? *)|`Canonical(x,y)->(rebase_single_canonicalnew_base(`Canonical(x,y)):>t)|`Module(x,y)->(rebase_single_modulenew_base(`Module(x,y)):>t)|`ModuleType(x,y)->(rebase_single_module_typenew_base(`ModuleType(x,y)):>t)|`Type(mp,s)->(rebase_single_typenew_base(`Type(mp,s)):>t)|`Class(mp,s)->(rebase_single_classnew_base(`Class(mp,s)):>t)|`ClassType(x,y)->(rebase_single_class_typenew_base(`ClassType(x,y)):>t)letrebaseidt=letrev=Identifier.to_reversedidinrebase'revtendletrebase_single_field:Reversed.t->s_field->s_field=funnew_baset->matchtwith|`Field(parent,s)->`Field(Parent.rebase'new_baseparent,s)moduleLabelParent=structtypet=Paths_types.Resolved_reference.label_parentletequalt1t2=resolved_equal(t1:t:>any)(t2:t:>any)lethasht=hash_resolved(t:t:>any)letrecidentifier:t->Identifier.LabelParent.t=function|`Identifierid->id|`SubstAlias(_,p)->identifier(p:module_:>t)|`Module(s,n)->`Module(parent_signature_identifiers,n)|`Canonical(_,`Resolvedp)->identifier(p:module_:>t)|`Canonical(p,_)->identifier(p:module_:>t)|`ModuleType(s,n)->`ModuleType(parent_signature_identifiers,n)|`Class(s,n)->`Class(parent_signature_identifiers,n)|`ClassType(s,n)->`ClassType(parent_signature_identifiers,n)|`Type(s,n)->`Type(parent_signature_identifiers,n)letrebase':Reversed.t->t->t=funnew_baset->matchtwith|`Identifier_->t|`SubstAlias_->t(* TODO: rewrite necessary? *)|`Canonical(x,y)->(rebase_single_canonicalnew_base(`Canonical(x,y)):>t)|`Module(x,y)->(rebase_single_modulenew_base(`Module(x,y)):>t)|`ModuleType(x,y)->(rebase_single_module_typenew_base(`ModuleType(x,y)):>t)|`Type(mp,s)->(rebase_single_typenew_base(`Type(mp,s)):>t)|`Class(mp,s)->(rebase_single_classnew_base(`Class(mp,s)):>t)|`ClassType(x,y)->(rebase_single_class_typenew_base(`ClassType(x,y)):>t)letrebaseidt=letrev=Identifier.to_reversedidinrebase'revtendmoduleModule=structtypet=Paths_types.Resolved_reference.module_letequalt1t2=resolved_equal(t1:t:>any)(t2:t:>any)lethasht=hash_resolved(t:t:>any)letrecidentifier:t->Identifier.Module.t=function|`Identifierid->id|`SubstAlias(_,p)->identifier(p:module_:>t)|`Module(s,n)->`Module(parent_signature_identifiers,n)|`Canonical(_,`Resolvedp)->identifier(p:module_:>t)|`Canonical(p,_)->identifier(p:module_:>t)letrebase:Reversed.t->t->t=funnew_baset->matchtwith|`Identifier_->t|`SubstAlias_->t(* TODO: rewrite necessary? *)|`Canonical(x,y)->(rebase_single_canonicalnew_base(`Canonical(x,y)):>t)|`Module(x,y)->(rebase_single_modulenew_base(`Module(x,y)):>t)letrebaseidt=letrev=Identifier.to_reversedidinrebaserevtendmoduleModuleType=structtypet=Paths_types.Resolved_reference.module_typeletequalt1t2=resolved_equal(t1:t:>any)(t2:t:>any)lethasht=hash_resolved(t:t:>any)letidentifier:t->Identifier.ModuleType.t=function|`Identifierid->id|`ModuleType(s,n)->`ModuleType(parent_signature_identifiers,n)letrebase:Reversed.t->t->t=funnew_baset->matchtwith|`Identifier_->t|`ModuleType(x,y)->(rebase_single_module_typenew_base(`ModuleType(x,y)):>t)letrebaseidt=letrev=Identifier.to_reversedidinrebaserevtendmoduleType=structtypet=Paths_types.Resolved_reference.type_letequalt1t2=resolved_equal(t1:t:>any)(t2:t:>any)lethasht=hash_resolved(t:t:>any)letidentifier:t->Identifier.Path.Type.t=function|`Identifierid->id|`Type(s,n)->`Type(parent_signature_identifiers,n)|`Class(s,n)->`Class(parent_signature_identifiers,n)|`ClassType(s,n)->`ClassType(parent_signature_identifiers,n)letrebase:Reversed.t->t->t=funnew_baset->matchtwith|`Identifier_->t|`Type(mp,s)->(rebase_single_typenew_base(`Type(mp,s)):>t)|`Class(s,n)->(rebase_single_classnew_base(`Class(s,n)):>t)|`ClassType(s,n)->(rebase_single_class_typenew_base(`ClassType(s,n)):>t)letrebaseidt=letrev=Identifier.to_reversedidinrebaserevtendmoduleConstructor=structtypet=Paths_types.Resolved_reference.constructorletequalt1t2=resolved_equal(t1:t:>any)(t2:t:>any)lethasht=hash_resolved(t:t:>any)letidentifier:t->Paths_types.Identifier.reference_constructor=function|`Identifierid->id|`Constructor(s,n)->`Constructor(parent_type_identifiers,n)|`Extension(s,n)->`Extension(parent_signature_identifiers,n)|`Exception(s,n)->`Exception(parent_signature_identifiers,n)letrebase:Reversed.t->t->t=funnew_baset->matchtwith|`Identifier_->t|`Constructor(p,q)->(rebase_single_constructornew_base(`Constructor(p,q)):>t)|`Extension(p,q)->(rebase_single_extensionnew_base(`Extension(p,q)):>t)|`Exception(p,q)->(rebase_single_exceptionnew_base(`Exception(p,q)):>t)letrebaseidt=letrev=Identifier.to_reversedidinrebaserevtendmoduleField=structtypet=Paths_types.Resolved_reference.fieldletequalt1t2=resolved_equal(t1:>any)(t2:>any)lethasht=hash_resolved(t:t:>any)letidentifier:t->Identifier.Field.t=function|`Identifierid->id|`Field(p,n)->`Field(parent_identifierp,n)letrebase:Reversed.t->t->t=funnew_baset->matchtwith|`Identifier_->t|`Field(p,q)->(rebase_single_fieldnew_base(`Field(p,q)):>t)letrebaseidt=letrev=Identifier.to_reversedidinrebaserevtendmoduleExtension=structtypet=Paths_types.Resolved_reference.extensionletequalt1t2=resolved_equal(t1:>any)(t2:>any)lethasht=hash_resolved(t:t:>any)letidentifier:t->Paths_types.Identifier.reference_extension=function|`Identifierid->id|`Extension(p,q)->`Extension(parent_signature_identifierp,q)|`Exception(p,q)->`Exception(parent_signature_identifierp,q)letrebase:Reversed.t->t->t=funnew_baset->matchtwith|`Identifier_->t|`Extension(p,q)->(rebase_single_extensionnew_base(`Extension(p,q)):>t)|`Exception(p,q)->(rebase_single_exceptionnew_base(`Exception(p,q)):>t)letrebaseidt=letrev=Identifier.to_reversedidinrebaserevtendmoduleException=structtypet=Paths_types.Resolved_reference.exception_letequalt1t2=resolved_equal(t1:>any)(t2:>any)lethasht=hash_resolved(t:t:>any)letidentifier:t->Paths_types.Identifier.reference_exception=function|`Identifierid->id|`Exception(p,q)->`Exception(parent_signature_identifierp,q)letrebase:Reversed.t->t->t=funnew_baset->matchtwith|`Identifier_->t|`Exception(p,q)->(rebase_single_exceptionnew_base(`Exception(p,q)):>t)letrebaseidt=letrev=Identifier.to_reversedidinrebaserevtendmoduleValue=structtypet=Paths_types.Resolved_reference.valueletequalt1t2=resolved_equal(t1:>any)(t2:>any)lethasht=hash_resolved(t:t:>any)letidentifier:t->Paths_types.Identifier.reference_value=function|`Identifierid->id|`Value(p,q)->`Value(parent_signature_identifierp,q)letrebase:Reversed.t->t->t=funnew_baset->matchtwith|`Identifier_->t|`Value(p,q)->(rebase_single_valuenew_base(`Value(p,q)):>t)letrebaseidt=letrev=Identifier.to_reversedidinrebaserevtendmoduleClass=structtypet=Paths_types.Resolved_reference.class_letequalt1t2=resolved_equal(t1:>any)(t2:>any)lethasht=hash_resolved(t:t:>any)letidentifier:t->Paths_types.Identifier.reference_class=function|`Identifierid->id|`Class(p,q)->`Class(parent_signature_identifierp,q)letrebase:Reversed.t->t->t=funnew_baset->matchtwith|`Identifier_->t|`Class(p,q)->(rebase_single_classnew_base(`Class(p,q)):>t)letrebaseidt=letrev=Identifier.to_reversedidinrebaserevtendmoduleClassType=structtypet=Paths_types.Resolved_reference.class_typeletequalt1t2=resolved_equal(t1:>any)(t2:>any)lethasht=hash_resolved(t:t:>any)letidentifier:t->Paths_types.Identifier.reference_class_type=function|`Identifierid->id|`Class(p,q)->`Class(parent_signature_identifierp,q)|`ClassType(p,q)->`ClassType(parent_signature_identifierp,q)letrebase:Reversed.t->t->t=funnew_baset->matchtwith|`Identifier_->t|`Class(p,q)->(rebase_single_classnew_base(`Class(p,q)):>t)|`ClassType(p,q)->(rebase_single_class_typenew_base(`ClassType(p,q)):>t)letrebaseidt=letrev=Identifier.to_reversedidinrebaserevtendletrebase_single_method:Reversed.t->s_method->s_method=funnew_baset->matchtwith|`Method(parent,s)->`Method(ClassSignature.rebase'new_baseparent,s)letrebase_single_instance_variable:Reversed.t->s_instance_variable->s_instance_variable=funnew_baset->matchtwith|`InstanceVariable(parent,s)->`InstanceVariable(ClassSignature.rebase'new_baseparent,s)moduleMethod=structtypet=Paths_types.Resolved_reference.method_letequalt1t2=resolved_equal(t1:>any)(t2:>any)lethasht=hash_resolved(t:t:>any)letidentifier:t->Paths_types.Identifier.reference_method=function|`Identifierid->id|`Method(p,q)->`Method(parent_class_signature_identifierp,q)letrebase:Reversed.t->t->t=funnew_baset->matchtwith|`Identifier_->t|`Method(p,q)->(rebase_single_methodnew_base(`Method(p,q)):>t)letrebaseidt=letrev=Identifier.to_reversedidinrebaserevtendmoduleInstanceVariable=structtypet=Paths_types.Resolved_reference.instance_variableletequalt1t2=resolved_equal(t1:>any)(t2:>any)lethasht=hash_resolved(t:t:>any)letidentifier:t->Paths_types.Identifier.reference_instance_variable=function|`Identifierid->id|`InstanceVariable(p,q)->`InstanceVariable(parent_class_signature_identifierp,q)letrebase:Reversed.t->t->t=funnew_baset->matchtwith|`Identifier_->t|`InstanceVariable(p,q)->(rebase_single_instance_variablenew_base(`InstanceVariable(p,q)):>t)letrebaseidt=letrev=Identifier.to_reversedidinrebaserevtendletrebase_single_label:Reversed.t->s_label->s_label=funnew_baset->matchtwith|`Label(parent,s)->`Label(LabelParent.rebase'new_baseparent,s)moduleLabel=structtypet=Paths_types.Resolved_reference.labelletequalt1t2=resolved_equal(t1:>any)(t2:>any)lethasht=hash_resolved(t:t:>any)letidentifier:t->Paths_types.Identifier.reference_label=function|`Identifierid->id|`Label(p,q)->`Label(label_parent_identifierp,q)letrebase:Reversed.t->t->t=funnew_baset->matchtwith|`Identifier_->t|`Label(p,q)->(rebase_single_labelnew_base(`Label(p,q)):>t)letrebaseidt=letrev=Identifier.to_reversedidinrebaserevtendmodulePage=structtypet=Paths_types.Resolved_reference.pageletequalt1t2=resolved_equal(t1:>any)(t2:>any)lethasht=hash_resolved(t:t:>any)letidentifier:t->Paths_types.Identifier.reference_page=function|`Identifierid->idletrebase_idt=tendtypet=Paths_types.Resolved_reference.anyletrecidentifier:t->Identifier.t=function|`Identifierid->id|`SubstAlias(_,p)->identifier(p:>t)|`Module(s,n)->`Module(parent_signature_identifiers,n)|`Canonical(_,`Resolvedp)->identifier(p:>t)|`Canonical(p,_)->identifier(p:>t)|`ModuleType(s,n)->`ModuleType(parent_signature_identifiers,n)|`Field(p,n)->`Field(parent_identifierp,n)|`Type(s,n)->`Type(parent_signature_identifiers,n)|`Constructor(s,n)->`Constructor(parent_type_identifiers,n)|`Extension(p,q)->`Extension(parent_signature_identifierp,q)|`Exception(p,q)->`Exception(parent_signature_identifierp,q)|`Value(p,q)->`Value(parent_signature_identifierp,q)|`Class(p,q)->`Class(parent_signature_identifierp,q)|`ClassType(p,q)->`ClassType(parent_signature_identifierp,q)|`Method(p,q)->`Method(parent_class_signature_identifierp,q)|`InstanceVariable(p,q)->`InstanceVariable(parent_class_signature_identifierp,q)|`Label(p,q)->`Label(label_parent_identifierp,q)letmodule_of_t:t->Module.t=function|`Identifier(#Identifier.Module.t)|#Paths_types.Resolved_reference.module_no_idasx->x|_->assertfalseletmodule_type_of_t:t->ModuleType.t=function|`Identifier(#Identifier.ModuleType.t)|#Paths_types.Resolved_reference.s_module_typeasx->x|_->assertfalseletsignature_of_t:t->Signature.t=function|`Identifier(#Identifier.Signature.t)|#Paths_types.Resolved_reference.signature_no_idasx->x|_->assertfalseletclass_signature_of_t:t->ClassSignature.t=function|`Identifier(#Identifier.ClassSignature.t)|#Paths_types.Resolved_reference.class_signature_no_idasx->x|_->assertfalseletparent_of_t:t->Parent.t=function|`Identifier(#Identifier.Parent.t)|#Paths_types.Resolved_reference.parent_no_idasx->x|_->assertfalseletlabel_parent_of_t:t->LabelParent.t=function|`Identifier(#Identifier.LabelParent.t)|#Paths_types.Resolved_reference.parent_no_idasx->x|_->assertfalselettype_of_t:t->Type.t=function|`Identifier(#Identifier.Type.t)|#Paths_types.Resolved_reference.s_typeasx->x|_->assertfalseletdatatype_of_t:t->DataType.t=function|`Identifier(#Identifier.DataType.t)|#Paths_types.Resolved_reference.s_typeasx->x|_->assertfalseletconstructor_of_t:t->Constructor.t=function|`Identifier(#Identifier.Constructor.t)|#Paths_types.Resolved_reference.s_constructor|#Paths_types.Resolved_reference.s_extension|#Paths_types.Resolved_reference.s_exceptionasx->x|_->assertfalseletfield_of_t:t->Field.t=function|`Identifier(#Identifier.Field.t)|#Paths_types.Resolved_reference.s_fieldasx->x|_->assertfalseletextension_of_t:t->Extension.t=function|`Identifier(#Paths_types.Identifier.reference_extension)|#Paths_types.Resolved_reference.s_extension|#Paths_types.Resolved_reference.s_exceptionasx->x|_->assertfalseletexception_of_t:t->Exception.t=function|`Identifier(#Paths_types.Identifier.reference_exception)|#Paths_types.Resolved_reference.s_exceptionasx->x|_->assertfalseletvalue_of_t:t->Value.t=function|`Identifier(#Paths_types.Identifier.reference_value)|#Paths_types.Resolved_reference.s_valueasx->x|_->assertfalseletclass_of_t:t->Class.t=function|`Identifier(#Paths_types.Identifier.reference_class)|#Paths_types.Resolved_reference.s_classasx->x|_->assertfalseletclass_type_of_t:t->ClassType.t=function|`Identifier(#Paths_types.Identifier.reference_class_type)|#Paths_types.Resolved_reference.s_class_typeasx->x|_->assertfalseletmethod_of_t:t->Method.t=function|`Identifier(#Paths_types.Identifier.reference_method)|#Paths_types.Resolved_reference.s_methodasx->x|_->assertfalseletinstance_variable_of_t:t->InstanceVariable.t=function|`Identifier(#Paths_types.Identifier.reference_instance_variable)|#Paths_types.Resolved_reference.s_instance_variableasx->x|_->assertfalseletlabel_of_t:t->Label.t=function|`Identifier(#Paths_types.Identifier.reference_label)|#Paths_types.Resolved_reference.s_labelasx->x|_->assertfalseendtypet=Paths_types.Reference.anyletequal:t->t->bool=equallethashp=hash_referencepmoduleSignature=structtypet=Paths_types.Reference.signatureletequal:t->t->bool=funt1t2->equal(t1:>Paths_types.Reference.any)(t2:>Paths_types.Reference.any)lethash:t->int=funt->hash(t:>Paths_types.Reference.any)endmoduleClassSignature=structtypet=Paths_types.Reference.class_signatureletequal:t->t->bool=funt1t2->equal(t1:>Paths_types.Reference.any)(t2:>Paths_types.Reference.any)lethash:t->int=funt->hash(t:>Paths_types.Reference.any)endmoduleDataType=structtypet=Paths_types.Reference.datatypeletequal:t->t->bool=funt1t2->equal(t1:>Paths_types.Reference.any)(t2:>Paths_types.Reference.any)lethash:t->int=funt->hash(t:>Paths_types.Reference.any)endmoduleParent=structtypet=Paths_types.Reference.parentletequal:t->t->bool=funt1t2->equal(t1:>Paths_types.Reference.any)(t2:>Paths_types.Reference.any)lethash:t->int=funt->hash(t:>Paths_types.Reference.any)endmoduleLabelParent=structtypet=Paths_types.Reference.label_parentletequal:t->t->bool=funt1t2->equal(t1:>Paths_types.Reference.any)(t2:>Paths_types.Reference.any)lethash:t->int=funt->hash(t:>Paths_types.Reference.any)endmoduleModule=structtypet=Paths_types.Reference.module_letequal:t->t->bool=funt1t2->equal(t1:>Paths_types.Reference.any)(t2:>Paths_types.Reference.any)lethash:t->int=funt->hash(t:>Paths_types.Reference.any)endmoduleModuleType=structtypet=Paths_types.Reference.module_typeletequal:t->t->bool=funt1t2->equal(t1:>Paths_types.Reference.any)(t2:>Paths_types.Reference.any)lethash:t->int=funt->hash(t:>Paths_types.Reference.any)endmoduleType=structtypet=Paths_types.Reference.type_letequal:t->t->bool=funt1t2->equal(t1:>Paths_types.Reference.any)(t2:>Paths_types.Reference.any)lethash:t->int=funt->hash(t:>Paths_types.Reference.any)endmoduleConstructor=structtypet=Paths_types.Reference.constructorletequal:t->t->bool=funt1t2->equal(t1:>Paths_types.Reference.any)(t2:>Paths_types.Reference.any)lethash:t->int=funt->hash(t:>Paths_types.Reference.any)endmoduleField=structtypet=Paths_types.Reference.fieldletequal:t->t->bool=funt1t2->equal(t1:>Paths_types.Reference.any)(t2:>Paths_types.Reference.any)lethash:t->int=funt->hash(t:>Paths_types.Reference.any)endmoduleExtension=structtypet=Paths_types.Reference.extensionletequal:t->t->bool=funt1t2->equal(t1:>Paths_types.Reference.any)(t2:>Paths_types.Reference.any)lethash:t->int=funt->hash(t:>Paths_types.Reference.any)endmoduleException=structtypet=Paths_types.Reference.exception_letequal:t->t->bool=funt1t2->equal(t1:>Paths_types.Reference.any)(t2:>Paths_types.Reference.any)lethash:t->int=funt->hash(t:>Paths_types.Reference.any)endmoduleValue=structtypet=Paths_types.Reference.valueletequal:t->t->bool=funt1t2->equal(t1:>Paths_types.Reference.any)(t2:>Paths_types.Reference.any)lethash:t->int=funt->hash(t:>Paths_types.Reference.any)endmoduleClass=structtypet=Paths_types.Reference.class_letequal:t->t->bool=funt1t2->equal(t1:>Paths_types.Reference.any)(t2:>Paths_types.Reference.any)lethash:t->int=funt->hash(t:>Paths_types.Reference.any)endmoduleClassType=structtypet=Paths_types.Reference.class_typeletequal:t->t->bool=funt1t2->equal(t1:>Paths_types.Reference.any)(t2:>Paths_types.Reference.any)lethash:t->int=funt->hash(t:>Paths_types.Reference.any)endmoduleMethod=structtypet=Paths_types.Reference.method_letequal:t->t->bool=funt1t2->equal(t1:>Paths_types.Reference.any)(t2:>Paths_types.Reference.any)lethash:t->int=funt->hash(t:>Paths_types.Reference.any)endmoduleInstanceVariable=structtypet=Paths_types.Reference.instance_variableletequal:t->t->bool=funt1t2->equal(t1:>Paths_types.Reference.any)(t2:>Paths_types.Reference.any)lethash:t->int=funt->hash(t:>Paths_types.Reference.any)endmoduleLabel=structtypet=Paths_types.Reference.labelletequal:t->t->bool=funt1t2->equal(t1:>Paths_types.Reference.any)(t2:>Paths_types.Reference.any)lethash:t->int=funt->hash(t:>Paths_types.Reference.any)endmodulePage=structtypet=Paths_types.Reference.pageletequal:t->t->bool=funt1t2->equal(t1:>Paths_types.Reference.any)(t2:>Paths_types.Reference.any)lethash:t->int=funt->hash(t:>Paths_types.Reference.any)endletmodule_of_t:t->Module.t=function|`Resolved(`Identifier(#Paths_types.Identifier.module_))|`Resolved(#Paths_types.Resolved_reference.module_no_id)|`Root(_,#Paths_types.Reference.tag_module)|`Dot(_,_)|`Module(_,_)asx->x|_->assertfalseletmodule_type_of_t:t->ModuleType.t=function|`Resolved(`Identifier(#Paths_types.Identifier.module_type))|`Resolved(#Paths_types.Resolved_reference.s_module_type)|`Root(_,#Paths_types.Reference.tag_module_type)|`Dot(_,_)|`ModuleType(_,_)asx->x|_->assertfalseletsignature_of_t:t->Signature.t=function|`Resolved(`Identifier(#Paths_types.Identifier.signature))|`Resolved(#Paths_types.Resolved_reference.signature_no_id)|`Root(_,#Paths_types.Reference.tag_signature)|`Dot(_,_)|`ModuleType(_,_)|`Module(_,_)asx->x|_->assertfalseletclass_signature_of_t:t->ClassSignature.t=function|`Resolved(`Identifier(#Paths_types.Identifier.class_signature))|`Resolved(#Paths_types.Resolved_reference.class_signature_no_id)|`Root(_,#Paths_types.Reference.tag_class_signature)|`Dot(_,_)|`ClassType(_,_)|`Class(_,_)asx->x|_->assertfalseletparent_of_t:t->Parent.t=function|`Resolved(`Identifier(#Paths_types.Identifier.parent))|`Resolved(#Paths_types.Resolved_reference.parent_no_id)|`Root(_,#Paths_types.Reference.tag_parent)|`Dot(_,_)|`ClassType(_,_)|`ModuleType(_,_)|`Module(_,_)|`Type(_,_)|`Class(_,_)asx->x|_->assertfalseletlabel_parent_of_t:t->LabelParent.t=function|`Resolved(`Identifier(#Paths_types.Identifier.label_parent))|`Resolved(#Paths_types.Resolved_reference.parent_no_id)(* Nb, parent_no_id would be equal to label_parent_no_id if it existed! *)|`Root(_,#Paths_types.Reference.tag_label_parent)|`Dot(_,_)|`ClassType(_,_)|`ModuleType(_,_)|`Module(_,_)|`Type(_,_)|`Class(_,_)asx->x|_->assertfalselettype_of_t:t->Type.t=function|`Resolved(`Identifier(#Paths_types.Identifier.type_))|`Resolved(#Paths_types.Resolved_reference.s_type)|`Root(_,#Paths_types.Reference.tag_type)|`Dot(_,_)|`Type(_,_)asx->x|_->assertfalseletdatatype_of_t:t->DataType.t=function|`Resolved(`Identifier(#Paths_types.Identifier.datatype))|`Resolved(#Paths_types.Resolved_reference.s_type)|`Root(_,#Paths_types.Reference.tag_datatype)|`Dot(_,_)|`Type(_,_)asx->x|_->assertfalseletconstructor_of_t:t->Constructor.t=function|`Resolved(`Identifier(#Paths_types.Identifier.reference_constructor))|`Resolved(#Paths_types.Resolved_reference.constructor_no_id)|`Root(_,#Paths_types.Reference.tag_constructor)|`Dot(_,_)|`Constructor(_,_)|`Extension(_,_)|`Exception(_,_)asx->x|_->assertfalseletfield_of_t:t->Field.t=function|`Resolved(`Identifier(#Paths_types.Identifier.reference_field))|`Resolved(#Paths_types.Resolved_reference.s_field)|`Root(_,#Paths_types.Reference.tag_field)|`Dot(_,_)|`Field(_,_)asx->x|_->assertfalseletextension_of_t:t->Extension.t=function|`Resolved(`Identifier(#Paths_types.Identifier.reference_extension))|`Resolved(#Paths_types.Resolved_reference.extension_no_id)|`Root(_,#Paths_types.Reference.tag_extension)|`Dot(_,_)|`Extension(_,_)|`Exception(_,_)asx->x|_->assertfalseletexception_of_t:t->Exception.t=function|`Resolved(`Identifier(#Paths_types.Identifier.reference_exception))|`Resolved(#Paths_types.Resolved_reference.s_exception)|`Root(_,#Paths_types.Reference.tag_exception)|`Dot(_,_)|`Exception(_,_)asx->x|_->assertfalseletvalue_of_t:t->Value.t=function|`Resolved(`Identifier(#Paths_types.Identifier.reference_value))|`Resolved(#Paths_types.Resolved_reference.s_value)|`Root(_,#Paths_types.Reference.tag_value)|`Dot(_,_)|`Value(_,_)asx->x|_->assertfalseletclass_of_t:t->Class.t=function|`Resolved(`Identifier(#Paths_types.Identifier.reference_class))|`Resolved(#Paths_types.Resolved_reference.s_class)|`Root(_,#Paths_types.Reference.tag_class)|`Dot(_,_)|`Class(_,_)asx->x|_->assertfalseletclass_type_of_t:t->ClassType.t=function|`Resolved(`Identifier(#Paths_types.Identifier.reference_class_type))|`Resolved(#Paths_types.Resolved_reference.class_type_no_id)|`Root(_,#Paths_types.Reference.tag_class_type)|`Dot(_,_)|`Class(_,_)|`ClassType(_,_)asx->x|_->assertfalseletmethod_of_t:t->Method.t=function|`Resolved(`Identifier(#Paths_types.Identifier.reference_method))|`Resolved(#Paths_types.Resolved_reference.s_method)|`Root(_,#Paths_types.Reference.tag_method)|`Dot(_,_)|`Method(_,_)asx->x|_->assertfalseletinstance_variable_of_t:t->InstanceVariable.t=function|`Resolved(`Identifier(#Paths_types.Identifier.reference_instance_variable))|`Resolved(#Paths_types.Resolved_reference.s_instance_variable)|`Root(_,#Paths_types.Reference.tag_instance_variable)|`Dot(_,_)|`InstanceVariable(_,_)asx->x|_->assertfalseletlabel_of_t:t->Label.t=function|`Resolved(`Identifier(#Paths_types.Identifier.reference_label))|`Resolved(#Paths_types.Resolved_reference.s_label)|`Root(_,#Paths_types.Reference.tag_label)|`Dot(_,_)|`Label(_,_)asx->x|_->assertfalseend