aboutsummaryrefslogtreecommitdiffhomepage
path: root/kernel
diff options
context:
space:
mode:
authorGravatar herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7>2001-11-21 21:30:04 +0000
committerGravatar herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7>2001-11-21 21:30:04 +0000
commiteb5afe3bf970bcd1e0c907774a49a352df3e91f3 (patch)
treedf76074fe7d7e42802f61fba5d7d3ceb9ceaed23 /kernel
parentc136d946314f44ab5da5f7ed229dc36b84effb66 (diff)
Amélioration messages d'erreur arité incorrecte (notamment record)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@2236 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'kernel')
-rw-r--r--kernel/inductive.ml9
-rw-r--r--kernel/inductive.mli2
-rw-r--r--kernel/type_errors.ml7
-rw-r--r--kernel/type_errors.mli9
4 files changed, 18 insertions, 9 deletions
diff --git a/kernel/inductive.ml b/kernel/inductive.ml
index d7181299e..c9399925b 100644
--- a/kernel/inductive.ml
+++ b/kernel/inductive.ml
@@ -222,14 +222,13 @@ let is_info_arity env c =
let error_elim_expln env kp ki =
if is_info_arity env kp && not (is_info_arity env ki) then
- "non-informative objects may not construct informative ones."
+ NonInformativeToInformative
else
match (kind_of_term kp,kind_of_term ki) with
- | Sort (Type _), Sort (Prop _) ->
- "strong elimination on non-small inductive types leads to paradoxes."
- | _ -> "wrong arity"
+ | Sort (Type _), Sort (Prop _) -> StrongEliminationOnNonSmallType
+ | _ -> WrongArity
-exception Arity of (constr * constr * string) option
+exception Arity of (constr * constr * arity_error) option
let is_correct_arity env kelim (c,pj) indf t =
diff --git a/kernel/inductive.mli b/kernel/inductive.mli
index 7e08a31c0..720ae3e4a 100644
--- a/kernel/inductive.mli
+++ b/kernel/inductive.mli
@@ -46,7 +46,7 @@ val type_of_constructor : env -> constructor -> types
val arities_of_constructors : env -> inductive -> types array
-exception Arity of (constr * constr * string) option
+exception Arity of (constr * constr * Type_errors.arity_error) option
(* [type_case_branches env (I,args) (p:A) c] computes useful types
about the following Cases expression:
diff --git a/kernel/type_errors.ml b/kernel/type_errors.ml
index f1eb32b5b..fc98a2ef1 100644
--- a/kernel/type_errors.ml
+++ b/kernel/type_errors.ml
@@ -34,6 +34,11 @@ type guard_error =
| RecCallInCasePred of constr
| NotGuardedForm
+type arity_error =
+ | NonInformativeToInformative
+ | StrongEliminationOnNonSmallType
+ | WrongArity
+
type type_error =
| UnboundRel of int
| UnboundVar of variable
@@ -41,7 +46,7 @@ type type_error =
| BadAssumption of unsafe_judgment
| ReferenceVariables of constr
| ElimArity of inductive * types list * constr * unsafe_judgment
- * (constr * constr * string) option
+ * (constr * constr * arity_error) option
| CaseNotInductive of unsafe_judgment
| WrongCaseInfo of inductive * case_info
| NumberBranches of unsafe_judgment * int
diff --git a/kernel/type_errors.mli b/kernel/type_errors.mli
index 99b46877a..a18ffd7e5 100644
--- a/kernel/type_errors.mli
+++ b/kernel/type_errors.mli
@@ -36,6 +36,11 @@ type guard_error =
| RecCallInCasePred of constr
| NotGuardedForm
+type arity_error =
+ | NonInformativeToInformative
+ | StrongEliminationOnNonSmallType
+ | WrongArity
+
type type_error =
| UnboundRel of int
| UnboundVar of variable
@@ -43,7 +48,7 @@ type type_error =
| BadAssumption of unsafe_judgment
| ReferenceVariables of constr
| ElimArity of inductive * types list * constr * unsafe_judgment
- * (constr * constr * string) option
+ * (constr * constr * arity_error) option
| CaseNotInductive of unsafe_judgment
| WrongCaseInfo of inductive * case_info
| NumberBranches of unsafe_judgment * int
@@ -71,7 +76,7 @@ val error_reference_variables : env -> constr -> 'a
val error_elim_arity :
env -> inductive -> types list -> constr
- -> unsafe_judgment -> (constr * constr * string) option -> 'a
+ -> unsafe_judgment -> (constr * constr * arity_error) option -> 'a
val error_case_not_inductive : env -> unsafe_judgment -> 'a