Module Melange_compiler_libs.Printtyp

let longident: Stdlib.Format.formatter => Longident.t => unit;
let ident: Stdlib.Format.formatter => Ident.t => unit;
let namespaced_ident: Shape.Sig_component_kind.t => Ident.t => string;
let tree_of_path: Path.t => Outcometree.out_ident;
let path: Stdlib.Format.formatter => Path.t => unit;
let string_of_path: Path.t => string;
let type_path: Stdlib.Format.formatter => Path.t => unit;

Print a type path taking account of -short-paths. Calls should be within wrap_printing_env.

module Out_name: { ... };
type namespace := option(Shape.Sig_component_kind.t);
let strings_of_paths: namespace => list(Path.t) => list(string);

Print a list of paths, using the same naming context to avoid name collisions

let raw_type_expr: Stdlib.Format.formatter => Types.type_expr => unit;
let string_of_label: Asttypes.arg_label => string;
let wrap_printing_env: error:bool => Env.t => (unit => 'a) => 'a;
module Naming_context: { ... };
module Conflicts: { ... };

The Conflicts module keeps track of conflicts arising when attributing names to identifiers and provides functions that can print explanations for these conflict in error messages

let reset: unit => unit;
let type_expr: Stdlib.Format.formatter => Types.type_expr => unit;

Print out a type. This will pick names for type variables, and will not reuse names for common type variables shared across multiple type expressions. (It will also reset the printing state, which matters for other type formatters such as prepared_type_expr.) If you want multiple types to use common names for type variables, see prepare_for_printing and prepared_type_expr.

let prepare_for_printing: list(Types.type_expr) => unit;

prepare_for_printing resets the global printing environment, a la reset, and prepares the types for printing by reserving names and marking loops. Any type variables that are shared between multiple types in the input list will be given the same name when printed with prepared_type_expr.

let add_type_to_preparation: Types.type_expr => unit;

add_type_to_preparation ty extend a previous type expression preparation to the type expression ty

let prepared_type_expr: Stdlib.Format.formatter => Types.type_expr => unit;

The function prepared_type_expr is a less-safe but more-flexible version of type_expr that should only be called on type_exprs that have been passed to prepare_for_printing. Unlike type_expr, this function does no extra work before printing a type; in particular, this means that any loops in the type expression may cause a stack overflow (see #8860) since this function does not mark any loops. The benefit of this is that if multiple type expressions are prepared simultaneously and then printed with prepared_type_expr, they will use the same names for the same type variables.

let constructor_arguments: Stdlib.Format.formatter => Types.constructor_arguments => unit;
let tree_of_type_scheme: Types.type_expr => Outcometree.out_type;
let type_scheme: Stdlib.Format.formatter => Types.type_expr => unit;
let prepared_type_scheme: Stdlib.Format.formatter => Types.type_expr => unit;
let shared_type_scheme: Stdlib.Format.formatter => Types.type_expr => unit;

shared_type_scheme is very similar to type_scheme, but does not reset the printing context first. This is intended to be used in cases where the printing should have a particularly wide context, such as documentation generators; most use cases, such as error messages, have narrower contexts for which type_scheme is better suited.

let tree_of_value_description: Ident.t => Types.value_description => Outcometree.out_sig_item;
let value_description: Ident.t => Stdlib.Format.formatter => Types.value_description => unit;
let label: Stdlib.Format.formatter => Types.label_declaration => unit;
let add_constructor_to_preparation: Types.constructor_declaration => unit;
let prepared_constructor: Stdlib.Format.formatter => Types.constructor_declaration => unit;
let constructor: Stdlib.Format.formatter => Types.constructor_declaration => unit;
let tree_of_type_declaration: Ident.t => Types.type_declaration => Types.rec_status => Outcometree.out_sig_item;
let add_type_declaration_to_preparation: Ident.t => Types.type_declaration => unit;
let prepared_type_declaration: Ident.t => Stdlib.Format.formatter => Types.type_declaration => unit;
let type_declaration: Ident.t => Stdlib.Format.formatter => Types.type_declaration => unit;
let tree_of_extension_constructor: Ident.t => Types.extension_constructor => Types.ext_status => Outcometree.out_sig_item;
let add_extension_constructor_to_preparation: Types.extension_constructor => unit;
let prepared_extension_constructor: Ident.t => Stdlib.Format.formatter => Types.extension_constructor => unit;
let extension_constructor: Ident.t => Stdlib.Format.formatter => Types.extension_constructor => unit;
let extension_only_constructor: Ident.t => Stdlib.Format.formatter => Types.extension_constructor => unit;
let tree_of_module: Ident.t => ?ellipsis:bool => Types.module_type => Types.rec_status => Outcometree.out_sig_item;
let modtype: Stdlib.Format.formatter => Types.module_type => unit;
let signature: Stdlib.Format.formatter => Types.signature => unit;
let tree_of_modtype_declaration: Ident.t => Types.modtype_declaration => Outcometree.out_sig_item;
let functor_parameters: sep:(Stdlib.Format.formatter => unit => unit) => ('b => Stdlib.Format.formatter => unit) => list((option(Ident.t), 'b)) => Stdlib.Format.formatter => unit;

Print a list of functor parameters while adjusting the printing environment for each functor argument.

Currently, we are disabling disambiguation for functor argument name to avoid the need to track the moving association between identifiers and syntactic names in situation like:

got: (X: sig module type T end) (Y:X.T) (X:sig module type T end) (Z:X.T) expect: (_: sig end) (Y:X.T) (_:sig end) (Z:X.T)

type type_or_scheme =
  1. | Type
  2. | Type_scheme
;
let tree_of_signature: Types.signature => list(Outcometree.out_sig_item);
let modtype_declaration: Ident.t => Stdlib.Format.formatter => Types.modtype_declaration => unit;
let class_type: Stdlib.Format.formatter => Types.class_type => unit;
let tree_of_class_declaration: Ident.t => Types.class_declaration => Types.rec_status => Outcometree.out_sig_item;
let class_declaration: Ident.t => Stdlib.Format.formatter => Types.class_declaration => unit;
let tree_of_cltype_declaration: Ident.t => Types.class_type_declaration => Types.rec_status => Outcometree.out_sig_item;
let cltype_declaration: Ident.t => Stdlib.Format.formatter => Types.class_type_declaration => unit;
let type_expansion: type_or_scheme => Stdlib.Format.formatter => Errortrace.expanded_type => unit;
let report_ambiguous_type_error: Stdlib.Format.formatter => Env.t => (Path.t, Path.t) => list((Path.t, Path.t)) => (Stdlib.Format.formatter => unit) => (Stdlib.Format.formatter => unit) => (Stdlib.Format.formatter => unit) => unit;
let report_unification_error: Stdlib.Format.formatter => Env.t => Errortrace.unification_error => ?type_expected_explanation:(Stdlib.Format.formatter => unit) => (Stdlib.Format.formatter => unit) => (Stdlib.Format.formatter => unit) => unit;
let report_equality_error: Stdlib.Format.formatter => type_or_scheme => Env.t => Errortrace.equality_error => (Stdlib.Format.formatter => unit) => (Stdlib.Format.formatter => unit) => unit;
let report_moregen_error: Stdlib.Format.formatter => type_or_scheme => Env.t => Errortrace.moregen_error => (Stdlib.Format.formatter => unit) => (Stdlib.Format.formatter => unit) => unit;
let report_comparison_error: Stdlib.Format.formatter => type_or_scheme => Env.t => Errortrace.comparison_error => (Stdlib.Format.formatter => unit) => (Stdlib.Format.formatter => unit) => unit;
module Subtype: { ... };
let print_items: (Env.t => Types.signature_item => option('a)) => Env.t => list(Types.signature_item) => list((Outcometree.out_sig_item, option('a)));
let rewrite_double_underscore_paths: Env.t => Path.t => Path.t;
let printed_signature: string => Stdlib.Format.formatter => Types.signature => unit;

printed_signature sourcefile ppf sg print the signature sg of sourcefile with potential warnings for name collisions