Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jonludlam committed Mar 12, 2024
1 parent 9546508 commit 9d7c8e7
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/model/lang.ml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ and ModuleType : sig

module U : sig
(* Unexpanded (aside from Signature, obviously) *)

type expr =
| Path of Path.ModuleType.t
| Signature of Signature.t
Expand Down
3 changes: 1 addition & 2 deletions src/model/names.ml
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,7 @@ end

module ModuleName = struct
include Name
let is_hidden s =
is_hidden s || contains_double_underscore (to_string s)
let is_hidden s = is_hidden s || contains_double_underscore (to_string s)
end

module ModuleTypeName = Name
Expand Down
6 changes: 4 additions & 2 deletions src/xref2/component.ml
Original file line number Diff line number Diff line change
Expand Up @@ -909,8 +909,10 @@ module Fmt = struct
and module_decl c ppf d =
let open Module in
match d with
| Alias (p, Some e) -> Format.fprintf ppf "=@ %a@ %a" (module_path c) p (simple_expansion c false) e
| Alias (p, None) -> Format.fprintf ppf "=@ %a" (module_path c) p
| Alias (p, Some e) ->
Format.fprintf ppf "=@ %a@ %a" (module_path c) p
(simple_expansion c false) e
| Alias (p, None) -> Format.fprintf ppf "=@ %a" (module_path c) p
| ModuleType mt ->
Format.fprintf ppf ": %a%a" (module_type_expr c) mt
(module_type_expansion c) mt
Expand Down
24 changes: 11 additions & 13 deletions src/xref2/subst.ml
Original file line number Diff line number Diff line change
Expand Up @@ -617,10 +617,8 @@ and functor_parameter s t =
and module_type_type_of_desc s t =
let open Component.ModuleType in
match t with
| ModPath p ->
ModPath (module_path s p)
| StructInclude p ->
StructInclude (module_path s p)
| ModPath p -> ModPath (module_path s p)
| StructInclude p -> StructInclude (module_path s p)

and u_module_type_expr s t =
let open Component.ModuleType.U in
Expand All @@ -641,10 +639,8 @@ and u_module_type_expr s t =
| With (subs, e) ->
With
(List.map (with_module_type_substitution s) subs, u_module_type_expr s e)
| TypeOf (t_desc, t_original_path ) ->
TypeOf
( module_type_type_of_desc s t_desc,
t_original_path )
| TypeOf (t_desc, t_original_path) ->
TypeOf (module_type_type_of_desc s t_desc, t_original_path)

and module_type_expr s t =
let open Component.ModuleType in
Expand All @@ -666,8 +662,12 @@ and module_type_expr s t =
w_expr = u_module_type_expr s w_expr;
}
| TypeOf t ->
TypeOf
{ t with t_desc = module_type_type_of_desc s t.t_desc; t_expansion=option_ simple_expansion s t.t_expansion }
TypeOf
{
t with
t_desc = module_type_type_of_desc s t.t_desc;
t_expansion = option_ simple_expansion s t.t_expansion;
}

and with_module_type_substitution s sub =
let open Component.ModuleType in
Expand Down Expand Up @@ -1000,7 +1000,5 @@ and apply_sig_map_items s items =
List.rev_map (apply_sig_map_item s) items |> List.rev

and apply_sig_map s items removed =
let dont_recompile =
List.length s.path_invalidating_modules = 0
in
let dont_recompile = List.length s.path_invalidating_modules = 0 in
(apply_sig_map_items s items, removed_items s removed, dont_recompile)
18 changes: 8 additions & 10 deletions src/xref2/tools.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1430,12 +1430,9 @@ and handle_canonical_type env p2 =
in

let rec strip : Cpath.Resolved.type_ -> Cpath.Resolved.type_ =
fun x ->
match x with
| `CanonicalType (x, _) -> strip x
| _ -> x
in

fun x -> match x with `CanonicalType (x, _) -> strip x | _ -> x
in

let resolve env p =
match resolve_type env p with
| Ok (_, `FType_removed _) -> Error `Find_failure
Expand Down Expand Up @@ -2003,8 +2000,7 @@ and fragmap :
test for an example of why this is necessary *)
let sub_of_substituted x sub =
let x = (x :> Ident.path_module) in
Subst.add_module_substitution x sub
|> Subst.path_invalidate_module x
Subst.add_module_substitution x sub |> Subst.path_invalidate_module x
in

let substituted_sub =
Expand Down Expand Up @@ -2234,7 +2230,8 @@ and resolve_module_type_fragment :
| Ok (_m : expansion) -> f'
| Error
( `UnresolvedForwardPath | `UnresolvedPath _ | `OpaqueModule
| `UnresolvedOriginalPath _ ) -> f'
| `UnresolvedOriginalPath _ ) ->
f'
in
Some (fixup_module_type_cfrag f'')

Expand Down Expand Up @@ -2336,7 +2333,8 @@ let resolve_module_type_path env p =
| Ok _ -> Ok p
| Error `OpaqueModule -> Ok (`OpaqueModuleType p)
| Error
(`UnresolvedForwardPath | `UnresolvedPath _ | `UnresolvedOriginalPath _) ->
(`UnresolvedForwardPath | `UnresolvedPath _ | `UnresolvedOriginalPath _)
->
Ok p

let resolve_type_path env p = resolve_type env p >>= fun (p, _) -> Ok p
Expand Down

0 comments on commit 9d7c8e7

Please sign in to comment.