(**************************************************************************) (* *) (* OCaml *) (* *) (* Gabriel Scherer, projet Picube, INRIA Paris *) (* *) (* Copyright 2024 Institut National de Recherche en Informatique et *) (* en Automatique. *) (* *) (* All rights reserved. This file is distributed under the terms of *) (* the GNU Lesser General Public License version 2.1, with the *) (* special exception on linking described in the file LICENSE. *) (* *) (**************************************************************************) open Asttypes open Types (* Constructor and record label descriptions inserted held in typing environments *) type constructor_description = { cstr_name: string; (* Constructor name *) cstr_res: type_expr; (* Type of the result *) cstr_existentials: type_expr list; (* list of existentials *) cstr_args: type_expr list; (* Type of the arguments *) cstr_arity: int; (* Number of arguments *) cstr_tag: constructor_tag; (* Tag for heap blocks *) cstr_consts: int; (* Number of constant constructors *) cstr_nonconsts: int; (* Number of non-const constructors *) cstr_generalized: bool; (* Constrained return type? *) cstr_private: private_flag; (* Read-only constructor? *) cstr_loc: Location.t; cstr_attributes: Parsetree.attributes; cstr_inlined: type_declaration option; cstr_uid: Uid.t; } and constructor_tag = Cstr_constant of int (* Constant constructor (an int) *) | Cstr_block of int (* Regular constructor (a block) *) | Cstr_unboxed (* Constructor of an unboxed type *) | Cstr_extension of Path.t * bool (* Extension constructor true if a constant false if a block*) (* Constructors are the same: they return (structurally)-equal values when applied to equal arguments. *) val equal_constr : constructor_description -> constructor_description -> bool (* Constructors may be the same, given potential rebinding. *) val may_equal_constr : constructor_description -> constructor_description -> bool (* Type constructor of the constructor's result type. *) val cstr_res_type_path : constructor_description -> Path.t type label_description = { lbl_name: string; (* Short name *) lbl_res: type_expr; (* Type of the result (the record) *) lbl_arg: type_expr; (* Type of the argument (the field value) *) lbl_mut: mutable_flag; (* Is this a mutable field? *) lbl_pos: int; (* Position in block *) lbl_all: label_description array; (* All the labels in this type *) lbl_repres: record_representation; (* Representation for this record *) lbl_private: private_flag; (* Read-only field? *) lbl_loc: Location.t; lbl_attributes: Parsetree.attributes; lbl_uid: Uid.t; } (* Type constructor of the label record type. *) val lbl_res_type_path : label_description -> Path.t