Module Mlsem_lang.Error

Typing errors of the language.

They extend the errors of Mlsem_system.Error by recognizing the failures that occur on the encodings introduced by MAst.to_system_ast, so that they can be reported in terms of the original constructs.

type kind =
  1. | UnboundVar of Mlsem_common.Variable.t
  2. | UntypeableApp of {
    1. fn : Mlsem_types.Ty.t;
    2. arg : Mlsem_types.Ty.t;
    }
  3. | UntypeableConstructor of {
    1. expected : Mlsem_types.GTy.t list list;
    2. given : Mlsem_types.GTy.t list;
    }
  4. | UntypeableRec of {
    1. funs : Mlsem_common.Variable.t list;
    2. expected : Mlsem_types.Ty.t list;
    3. given : Mlsem_types.Ty.t list;
    }
  5. | UntypeableEncoding
  6. | UntypeableProjection of {
    1. arg : Mlsem_types.Ty.t;
    2. domain : Mlsem_types.Ty.t;
    }
  7. | UntypeableCast of {
    1. check : Mlsem_system.Ast.check;
    2. expected : Mlsem_types.GTy.t;
    3. given : Mlsem_types.GTy.t;
    }
  8. | UntypeableCoercion of {
    1. check : Mlsem_system.Ast.check;
    2. expected : Mlsem_types.GTy.t;
    3. given : Mlsem_types.GTy.t;
    }
  9. | InvalidAnnot of string
    (*

    The constructors above are those of Mlsem_system.Error.kind.

    *)
  10. | UntypeableAssignment of {
    1. var : Mlsem_common.Variable.t;
    2. expected : Mlsem_types.Ty.t option;
    3. given : Mlsem_types.Ty.t;
    }
    (*

    The value assigned to the mutable variable var has type given, which is not a subtype of the type expected of the variable (None if the latter could not be determined).

    *)
type t = {
  1. eid : Mlsem_common.Eid.t;
    (*

    The identifier of the expression on which the error occurred

    *)
  2. expr : Mlsem_system.Ast.e;
    (*

    The expression on which the error occurred

    *)
  3. kind : kind;
  4. env : Mlsem_common.Env.t;
    (*

    The typing environment at that expression

    *)
  5. ann : Mlsem_system.Annot.IAnnot.a;
    (*

    The (partial) annotation of that expression

    *)
}
exception Untypeable of t
val of_system : Mlsem_system.Error.t -> t

Converts an error of Mlsem_system.Error, recognizing the failures that occur on the encoding of an assignment.

Default printers

Same as those of Mlsem_system.Error.

type style = Mlsem_system.Error.style =
  1. | Types
  2. | Witnesses
  3. | Both
val title : t -> string
val pp_descr : ?style:style -> Stdlib.Format.formatter -> t -> unit
val descr : ?style:style -> t -> string option
val pp : ?style:style -> Stdlib.Format.formatter -> t -> unit