package libsail

  1. Overview
  2. Docs

Type error utilities

This file wraps the functions in Type_check, so they return Fatal_error exceptions from the Reporting module rather than Type_errors.

val opt_explain_all_variables : bool Stdlib.ref

If false (default), we'll only explain generated variables, not variables written explicitly by the user in the source.

val opt_explain_constraints : bool Stdlib.ref

If false (default), we'll list relevant constraints, but not go into detail about how they were derived

type constraint_reason = (Ast.l * string) option
type type_error =
  1. | Err_no_casts of Ast_util.uannot Ast.exp * Ast.typ * Ast.typ * type_error * type_error list
  2. | Err_no_overloading of Ast.id * (Ast.id * type_error) list
  3. | Err_unresolved_quants of Ast.id * Ast.quant_item list * (Ast_util.mut * Ast.typ) Ast_util.Bindings.t * Type_env.type_variables * Ast.n_constraint list
  4. | Err_failed_constraint of Ast.n_constraint * (Ast_util.mut * Ast.typ) Ast_util.Bindings.t * Type_env.type_variables * Ast.n_constraint list
  5. | Err_subtype of Ast.typ * Ast.typ * Ast.n_constraint option * (constraint_reason * Ast.n_constraint) list * Type_env.type_variables
  6. | Err_no_num_ident of Ast.id
  7. | Err_other of string
  8. | Err_inner of type_error * Parse_ast.l * string * string option * type_error
exception Type_error of Parse_ast.l * type_error
type suggestion =
  1. | Suggest_add_constraint of Ast.n_constraint
  2. | Suggest_none
val analyze_unresolved_quant : (Ast_util.mut * Ast.typ) Ast_util.Bindings.t -> Ast.n_constraint list -> Ast.quant_item -> suggestion

Analyze an unresolved quantifier type error

val collapse_errors : type_error -> type_error
val string_of_type_error : type_error -> string