Skip to content

Commit 2d20578

Browse files
cknittclaude
andcommitted
Print module paths with Printtyp in analysis and tools
createInterface and rescript-tools each printed an out_ident with their own copy of Printtyp.string_of_out_ident; they use Printtyp's now, which the interface exports for this. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kbf3gKyiYMf54wPRxFdUWe Signed-off-by: Christoph Knittel <ck@cca.io>
1 parent abc9755 commit 2d20578

3 files changed

Lines changed: 3 additions & 15 deletions

File tree

‎analysis/src/create_interface.ml‎

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -427,14 +427,7 @@ let print_signature ~path ~source ~extractor ~signature =
427427
Buffer.add_string buf (") =>\n" ^ indent);
428428
process_module_type ~scope ~indent ret_mt
429429
| Mty_ident path | Mty_alias (_, path) ->
430-
let rec out_ident_to_string (ident : Outcometree.out_ident) =
431-
match ident with
432-
| Oide_ident s -> s
433-
| Oide_dot (ident, s) -> out_ident_to_string ident ^ "." ^ s
434-
| Oide_apply (call, arg) ->
435-
out_ident_to_string call ^ "(" ^ out_ident_to_string arg ^ ")"
436-
in
437-
Buffer.add_string buf (out_ident_to_string (Printtyp.tree_of_path path))
430+
Buffer.add_string buf (Printtyp.string_of_path path)
438431
in
439432

440433
process_signature ~scope:None ~indent:"" signature;

‎compiler/ml/printtyp.mli‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ val ident : formatter -> Ident.t -> unit
2828
val tree_of_path : Path.t -> out_ident
2929
val path : formatter -> Path.t -> unit
3030
val string_of_path : Path.t -> string
31+
val string_of_out_ident : Outcometree.out_ident -> string
3132
val raw_type_expr : formatter -> type_expr -> unit
3233
val string_of_label : Asttypes.arg_label -> string
3334

‎tools/src/tools.ml‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -341,12 +341,6 @@ let type_detail typ ~env ~full ~state =
341341
})
342342
| _ -> None
343343

344-
let rec string_of_out_ident = function
345-
| Outcometree.Oide_ident name -> name
346-
| Oide_dot (path, name) -> string_of_out_ident path ^ "." ^ name
347-
| Oide_apply (functor_, argument) ->
348-
string_of_out_ident functor_ ^ "(" ^ string_of_out_ident argument ^ ")"
349-
350344
let render_out_type typ =
351345
Res_doc.to_string ~width:80 (Res_outcome_printer.print_out_type_doc typ)
352346

@@ -355,7 +349,7 @@ let rec type_doc_of_out_type (typ : Outcometree.out_type) =
355349
| Otyp_constr (path, generic_parameters) ->
356350
Constructor
357351
{
358-
path = string_of_out_ident path;
352+
path = Printtyp.string_of_out_ident path;
359353
generic_parameters = List.map type_doc_of_out_type generic_parameters;
360354
}
361355
| Otyp_var (weak, name) -> Variable {name; weak}

0 commit comments

Comments
 (0)