@@ -1034,13 +1034,39 @@ module Fmt = struct
10341034 Format. fprintf ppf " %a.%s" resolved_parent_path p
10351035 (Odoc_model.Names.TypeName. to_string t)
10361036
1037+ and resolved_datatype_path :
1038+ Format. formatter -> Cpath.Resolved. datatype -> unit =
1039+ fun ppf p ->
1040+ match p with
1041+ | `Local id -> Format. fprintf ppf " %a" Ident. fmt id
1042+ | `Gpath p ->
1043+ Format. fprintf ppf " %a" model_resolved_path
1044+ (p :> Odoc_model.Paths.Path.Resolved.t )
1045+ | `Substituted x ->
1046+ Format. fprintf ppf " substituted(%a)" resolved_datatype_path x
1047+ | `CanonicalDataType (t1 , t2 ) ->
1048+ Format. fprintf ppf " canonicalty(%a,%a)" resolved_datatype_path t1
1049+ model_path
1050+ (t2 :> Odoc_model.Paths.Path.t )
1051+ | `Type (p , t ) ->
1052+ Format. fprintf ppf " %a.%s" resolved_parent_path p
1053+ (Odoc_model.Names.TypeName. to_string t)
1054+
10371055 and resolved_value_path : Format.formatter -> Cpath.Resolved.value -> unit =
10381056 fun ppf p ->
10391057 match p with
10401058 | `Value (p , t ) ->
10411059 Format. fprintf ppf " %a.%s" resolved_parent_path p
10421060 (Odoc_model.Names.ValueName. to_string t)
10431061
1062+ and resolved_constructor_path :
1063+ Format. formatter -> Cpath.Resolved. constructor -> unit =
1064+ fun ppf p ->
1065+ match p with
1066+ | `Constructor (p , t ) ->
1067+ Format. fprintf ppf " %a.%s" resolved_datatype_path p
1068+ (Odoc_model.Names.ConstructorName. to_string t)
1069+
10441070 and resolved_parent_path : Format.formatter -> Cpath.Resolved.parent -> unit =
10451071 fun ppf p ->
10461072 match p with
@@ -1069,6 +1095,21 @@ module Fmt = struct
10691095 Format. fprintf ppf " %a.%s" resolved_parent_path p
10701096 (Odoc_model.Names.TypeName. to_string t)
10711097
1098+ and datatype_path : Format.formatter -> Cpath.datatype -> unit =
1099+ fun ppf p ->
1100+ match p with
1101+ | `Resolved r -> Format. fprintf ppf " r(%a)" resolved_datatype_path r
1102+ | `Identifier (id , b ) ->
1103+ Format. fprintf ppf " identifier(%a, %b)" model_identifier
1104+ (id :> Odoc_model.Paths.Identifier.t )
1105+ b
1106+ | `Local (id , b ) -> Format. fprintf ppf " local(%a,%b)" Ident. fmt id b
1107+ | `Substituted s -> Format. fprintf ppf " substituted(%a)" datatype_path s
1108+ | `Dot (m , s ) -> Format. fprintf ppf " %a.%s" module_path m s
1109+ | `Type (p , t ) ->
1110+ Format. fprintf ppf " %a.%s" resolved_parent_path p
1111+ (Odoc_model.Names.TypeName. to_string t)
1112+
10721113 and value_path : Format.formatter -> Cpath.value -> unit =
10731114 fun ppf p ->
10741115 match p with
@@ -1078,6 +1119,15 @@ module Fmt = struct
10781119 Format. fprintf ppf " %a.%s" resolved_parent_path p
10791120 (Odoc_model.Names.ValueName. to_string t)
10801121
1122+ and constructor_path : Format.formatter -> Cpath.constructor -> unit =
1123+ fun ppf p ->
1124+ match p with
1125+ | `Resolved r -> Format. fprintf ppf " r(%a)" resolved_constructor_path r
1126+ | `Dot (m , s ) -> Format. fprintf ppf " %a.%s" datatype_path m s
1127+ | `Constructor (p , t ) ->
1128+ Format. fprintf ppf " %a.%s" resolved_datatype_path p
1129+ (Odoc_model.Names.ConstructorName. to_string t)
1130+
10811131 and resolved_class_type_path :
10821132 Format. formatter -> Cpath.Resolved. class_type -> unit =
10831133 fun ppf p ->
@@ -1151,6 +1201,10 @@ module Fmt = struct
11511201 Format. fprintf ppf " %a.%s" model_resolved_path
11521202 (parent :> t )
11531203 (Odoc_model.Names.TypeName. to_string name)
1204+ | `Constructor (parent , name ) ->
1205+ Format. fprintf ppf " %a.%s" model_resolved_path
1206+ (parent :> t )
1207+ (Odoc_model.Names.ConstructorName. to_string name)
11541208 | `Value (parent , name ) ->
11551209 Format. fprintf ppf " %a.%s" model_resolved_path
11561210 (parent :> t )
@@ -1185,6 +1239,11 @@ module Fmt = struct
11851239 (t1 :> t )
11861240 model_path
11871241 (t2 :> Odoc_model.Paths.Path.t )
1242+ | `CanonicalDataType (t1 , t2 ) ->
1243+ Format. fprintf ppf " canonicaldaty(%a,%a)" model_resolved_path
1244+ (t1 :> t )
1245+ model_path
1246+ (t2 :> Odoc_model.Paths.Path.t )
11881247 | `Apply (funct , arg ) ->
11891248 Format. fprintf ppf " %a(%a)" model_resolved_path
11901249 (funct :> t )
@@ -1796,11 +1855,31 @@ module Of_Lang = struct
17961855 | `ClassType (p , name ) ->
17971856 `ClassType (`Module (resolved_module_path ident_map p), name)
17981857
1858+ and resolved_datatype_path :
1859+ _ -> Odoc_model.Paths.Path.Resolved.DataType. t -> Cpath.Resolved. datatype
1860+ =
1861+ fun ident_map p ->
1862+ match p with
1863+ | `Identifier i -> (
1864+ match identifier Maps.Type. find ident_map.types i with
1865+ | `Local l -> `Local l
1866+ | `Identifier _ -> `Gpath p)
1867+ | `CanonicalDataType (p1 , p2 ) ->
1868+ `CanonicalDataType (resolved_datatype_path ident_map p1, p2)
1869+ | `Type (p , name ) -> `Type (`Module (resolved_module_path ident_map p), name)
1870+
17991871 and resolved_value_path :
18001872 _ -> Odoc_model.Paths.Path.Resolved.Value. t -> Cpath.Resolved. value =
18011873 fun ident_map (`Value (p , name )) ->
18021874 `Value (`Module (resolved_module_path ident_map p), name)
18031875
1876+ and resolved_constructor_path :
1877+ _ ->
1878+ Odoc_model.Paths.Path.Resolved.Constructor. t ->
1879+ Cpath.Resolved. constructor =
1880+ fun ident_map (`Constructor (p , name )) ->
1881+ `Constructor (resolved_datatype_path ident_map p, name)
1882+
18041883 and resolved_class_type_path :
18051884 _ ->
18061885 Odoc_model.Paths.Path.Resolved.ClassType. t ->
@@ -1859,6 +1938,23 @@ module Of_Lang = struct
18591938 | `Resolved r -> `Resolved (resolved_value_path ident_map r)
18601939 | `Dot (path' , x ) -> `Dot (module_path ident_map path', x)
18611940
1941+ and datatype : _ -> Odoc_model.Paths.Path.DataType.t -> Cpath.datatype =
1942+ fun ident_map p ->
1943+ match p with
1944+ | `Resolved r -> `Resolved (resolved_datatype_path ident_map r)
1945+ | `Identifier (i , b ) -> (
1946+ match identifier Maps.Type. find ident_map.types i with
1947+ | `Identifier i -> `Identifier (i, b)
1948+ | `Local i -> `Local (i, b))
1949+ | `Dot (path' , x ) -> `Dot (module_path ident_map path', x)
1950+
1951+ and constructor_path :
1952+ _ -> Odoc_model.Paths.Path.Constructor. t -> Cpath. constructor =
1953+ fun ident_map p ->
1954+ match p with
1955+ | `Resolved r -> `Resolved (resolved_constructor_path ident_map r)
1956+ | `Dot (path' , x ) -> `Dot (datatype ident_map path', x)
1957+
18621958 and class_type_path :
18631959 _ -> Odoc_model.Paths.Path.ClassType. t -> Cpath. class_type =
18641960 fun ident_map p ->
0 commit comments