Module Ocaml_typing.PrinttypSource
Print a type path taking account of -short-paths. Calls should be within wrap_printing_env.
type namespace := Shape.Sig_component_kind.t optionPrint a list of paths, using the same naming context to avoid name collisions
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
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.
val modality :
?id:(Ocaml_utils.Format_doc.formatter -> unit) ->
'a Mode.Modality.Axis.t ->
Ocaml_utils.Format_doc.formatter ->
'a ->
unitPrints a modality. If it is the identity modality, prints id, which defaults to nothing.
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.
add_type_to_preparation ty extend a previous type expression preparation to the type expression ty
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.
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.
val type_declaration_for_merlin :
print_non_value_inferred_jkind:bool ->
Ident.t ->
Ocaml_utils.Format_doc.formatter ->
Types.type_declaration ->
unitLike type_declaration.
print_non_value_inferred_jkind is a setting controlled by merlin verbosity levels. When it's true, merlin will print the inferred layout annotations on type declarations, except if the layout is value. If the layout is value, a layout is printed in exactly the cases that type_declaration prints a layout.
E.g. When this flag is true, type t = A is printed as type t : immediate = A.
val type_scheme_for_merlin :
print_non_value_jkind_on_type_variables:bool ->
Ocaml_utils.Format_doc.formatter ->
Types.type_expr ->
unitLike type_scheme.
print_non_value_jkind_on_type_variables is a setting controlled by merlin verbosity levels. When it's true, merlin will print layout annotations for type variables when the layout isn't merely value. The annotations are printed as a comment following the type.
E.g. When this flag is true, 'a -> 'b is printed as:
'a -> 'b (* 'a : float64 *)if 'a has layout float64 and 'b has layout value.
val tree_of_value_description :
Ident.t ->
Types.value_description ->
Outcometree.out_sig_itemval tree_of_type_declaration :
Ident.t ->
Types.type_declaration ->
Types.rec_status ->
Outcometree.out_sig_itemval prepared_type_declaration :
Ident.t ->
Types.type_declaration Ocaml_utils.Format_doc.printerval tree_of_extension_constructor :
Ident.t ->
Types.extension_constructor ->
Types.ext_status ->
Outcometree.out_sig_itemval prepared_extension_constructor :
Ident.t ->
Types.extension_constructor Ocaml_utils.Format_doc.printerval extension_constructor :
Ident.t ->
Types.extension_constructor Ocaml_utils.Format_doc.printerval extension_only_constructor :
Ident.t ->
Types.extension_constructor Ocaml_utils.Format_doc.printerval tree_of_jkind_declaration :
Ident.t ->
Types.jkind_declaration ->
Outcometree.out_sig_itemval tree_of_module :
Ident.t ->
?ellipsis:bool ->
Types.module_declaration ->
Types.rec_status ->
Outcometree.out_sig_itemval tree_of_modtype_declaration :
?abbrev:bool ->
Ident.t ->
Types.modtype_declaration ->
Outcometree.out_sig_itemval functor_parameters :
sep:unit Ocaml_utils.Format_doc.printer ->
('b -> Ocaml_utils.Format_doc.formatter -> unit) ->
(Ident.t option * 'b) list ->
Ocaml_utils.Format_doc.formatter ->
unitPrint 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)
val tree_of_class_declaration :
Ident.t ->
Types.class_declaration ->
Types.rec_status ->
Outcometree.out_sig_itemval tree_of_cltype_declaration :
Ident.t ->
Types.class_type_declaration ->
Types.rec_status ->
Outcometree.out_sig_itemval cltype_declaration :
Ident.t ->
Types.class_type_declaration Ocaml_utils.Format_doc.printerval type_expansion :
type_or_scheme ->
Errortrace.expanded_type Ocaml_utils.Format_doc.printerval report_ambiguous_type_error :
Ocaml_utils.Format_doc.formatter ->
Env.t ->
(Path.t * Path.t) ->
(Path.t * Path.t) list ->
Ocaml_utils.Format_doc.t ->
Ocaml_utils.Format_doc.t ->
Ocaml_utils.Format_doc.t ->
unitval report_unification_error :
?type_expected_explanation:Ocaml_utils.Format_doc.t ->
Ocaml_utils.Format_doc.formatter ->
Env.t ->
Errortrace.unification_error ->
Ocaml_utils.Format_doc.t ->
Ocaml_utils.Format_doc.t ->
unitval report_equality_error :
Ocaml_utils.Format_doc.formatter ->
type_or_scheme ->
Env.t ->
Errortrace.equality_error ->
Ocaml_utils.Format_doc.t ->
Ocaml_utils.Format_doc.t ->
unitval report_moregen_error :
Ocaml_utils.Format_doc.formatter ->
type_or_scheme ->
Env.t ->
Errortrace.moregen_error ->
Ocaml_utils.Format_doc.t ->
Ocaml_utils.Format_doc.t ->
unitval report_comparison_error :
Ocaml_utils.Format_doc.formatter ->
type_or_scheme ->
Env.t ->
Errortrace.comparison_error ->
Ocaml_utils.Format_doc.t ->
Ocaml_utils.Format_doc.t ->
unitval print_items :
(Env.t -> Types.signature_item -> 'a option) ->
Env.t ->
Types.signature_item list ->
(Outcometree.out_sig_item * 'a option) listtype typvariant_repr = {fields : (string * bool * Types.type_expr list) list;name : (Path.t * Types.type_expr list) option;closed : bool;present : (string * Types.row_field) list;all_present : bool;
}val rewrite_double_underscore_longidents :
Env.t ->
Ocaml_parsing.Longident.t ->
Ocaml_parsing.Longident.tprinted_signature sourcefile ppf sg print the signature sg of sourcefile with potential warnings for name collisions
val tree_of_modalities :
Types.mutability ->
Mode.Modality.Const.t ->
Outcometree.out_modality list