aboutsummaryrefslogtreecommitdiffhomepage
path: root/kernel/type_errors.mli
blob: 670a9f5dea6434185098449d4d52e2703a537131 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119

(*i $Id$ i*)

(*i*)
open Pp
open Names
open Term
open Sign
open Environ
(*i*)

(* Type errors. \label{typeerrors} *)

(*i Rem: NotEnoughAbstractionInFixBody should only occur with "/i" Fix
    notation i*)
type guard_error =
  (* Fixpoints *)
  | NotEnoughAbstractionInFixBody
  | RecursionNotOnInductiveType
  | RecursionOnIllegalTerm
  | NotEnoughArgumentsForFixCall
  (* CoFixpoints *)
  | CodomainNotInductiveType of constr
  | NestedRecursiveOccurrences
  | UnguardedRecursiveCall of constr
  | RecCallInTypeOfAbstraction of constr
  | RecCallInNonRecArgOfConstructor of constr
  | RecCallInTypeOfDef of constr
  | RecCallInCaseFun of constr
  | RecCallInCaseArg of constr
  | RecCallInCasePred of constr
  | NotGuardedForm

type type_error =
  | UnboundRel of int
  | NotAType of unsafe_judgment
  | BadAssumption of constr
  | ReferenceVariables of identifier
  | ElimArity of inductive * constr list * constr * constr * constr
      * (constr * constr * string) option
  | CaseNotInductive of constr * constr
  | NumberBranches of constr * constr * int
  | IllFormedBranch of constr * int * constr * constr
  | Generalization of (name * types) * unsafe_judgment
  | ActualType of constr * constr * constr
  | CantApplyBadType of (int * constr * constr)
      * unsafe_judgment * unsafe_judgment list
  | CantApplyNonFunctional of unsafe_judgment * unsafe_judgment list
  | IllFormedRecBody of guard_error * name list * int * constr array
  | IllTypedRecBody of int * name list * unsafe_judgment array 
      * types array
  | NotInductive of constr
  | MLCase of string * constr * constr * constr * constr
  | CantFindCaseType of constr
  | OccurCheck of int * constr
  | NotClean of int * constr
  | VarNotFound of identifier
  | UnexpectedType of constr * constr
  | NotProduct of constr
  (* Pattern-matching errors *)
  | BadPattern of constructor * constr
  | BadConstructor of constructor * inductive
  | WrongNumargConstructor of constructor_path * int
  | WrongPredicateArity of constr * int * int
  | NeedsInversion of constr * constr
  (* Relocation error *)
  | QualidNotFound of qualid

exception TypeError of path_kind * env * type_error

val error_unbound_rel : path_kind -> env -> 'a Evd.evar_map -> int -> 'b

val error_not_type : path_kind -> env -> unsafe_judgment -> 'b

val error_assumption : path_kind -> env -> constr -> 'b
 
val error_reference_variables : path_kind -> env -> identifier -> 'b

val error_elim_arity : 
  path_kind -> env -> inductive -> constr list -> constr 
    -> constr -> constr -> (constr * constr * string) option -> 'b

val error_case_not_inductive : 
  path_kind -> env -> constr -> constr -> 'b

val error_number_branches : 
  path_kind -> env -> constr -> constr -> int -> 'b

val error_ill_formed_branch :
  path_kind -> env -> constr -> int -> constr -> constr -> 'b

val error_generalization :
  path_kind -> env -> 'a Evd.evar_map -> name * types -> unsafe_judgment -> 'b

val error_actual_type :
  path_kind -> env -> constr -> constr -> constr -> 'b

val error_cant_apply_not_functional : 
  path_kind -> env -> unsafe_judgment -> unsafe_judgment list -> 'b

val error_cant_apply_bad_type : 
  path_kind -> env -> 'a Evd.evar_map -> int * constr * constr -> 
      unsafe_judgment -> unsafe_judgment list -> 'b

val error_ill_formed_rec_body :
  path_kind -> env -> guard_error -> name list -> int -> constr array -> 'b

val error_ill_typed_rec_body  :
  path_kind -> env -> int -> name list -> unsafe_judgment array 
    -> types array -> 'b

val error_not_inductive : path_kind -> env -> constr -> 'a

val error_ml_case : path_kind -> env -> 
  string -> constr -> constr -> constr -> constr -> 'a

val error_unexpected_type : env -> actual:constr -> expected:constr -> 'a

val error_not_product : env -> constr -> 'a