Module Checker.ComputeConstraint
the module holding constraint generation primitives of the borrow checker. It contains the first phase of the borrow checker, as well as several utilities used by later phases.
module L = Locationtype block_info={param_typ : Type.typ;overwrites : Type.typ IR.VarMap.t;flow_constrs : L.ConstrSet.t;scope : IR.variable list;}overwritesstores change in type of variables due to assignment. When a variable is not present inoverwrites, its type default to that ofvariablesofconstraint_infoflow_constrsstores the flow-sensitive constraints at the beginning of a block. For loop blocks, the stored constraint set is the fixed point of looping for zero or more times.scopeis the set of variables that are in-scope in the body of the block. Only those variables that corresponds to source variables (i.e. whoseIR.var_kindisIR.SrcVar) are counted
type constraint_info={functions : (string, Type.function_typ) Stdlib.Hashtbl.t;variables : (IR.variable, Type.typ) Stdlib.Hashtbl.t;blocks : (IR.label, block_info) Stdlib.Hashtbl.t;mutable constrs : L.ConstrSet.t;}constraintsstore the global set of flow-insensitive constraints during the checking of a complete program.
val make_constraint_info : unit -> constraint_infoval merge_block_info : constraint_info -> block_info -> block_info -> block_infoval merge_info_into_block : constraint_info -> IR.label -> block_info -> unitval find_var : constraint_info -> Type.typ IR.VarMap.t -> IR.VarMap.key -> Type.typval typ_of_lvalue : constraint_info -> Type.typ IR.VarMap.t -> IR.lvalue -> Syntax.permission * Type.typ * Type.typval typ_of_value : constraint_info -> Type.typ IR.VarMap.t -> IR.value -> Type.typval typ_of_expr : constraint_info -> Type.typ IR.VarMap.t -> IR.expr -> Type.typval process_expr : constraint_info -> IR.variable list -> Type.typ IR.VarMap.t -> Type.L.ConstrSet.t -> IR.expr -> IR.variable list * Type.typ IR.VarMap.t * Type.L.ConstrSet.tval process_program : Typecheck.type_info -> constraint_info -> IR.variable list -> Type.typ IR.VarMap.t -> L.ConstrSet.t -> IR.program -> unitval process_function : Typecheck.type_info -> constraint_info -> IR.function_def -> unit