aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Hugo Herbelin <Hugo.Herbelin@inria.fr>2014-06-13 10:33:40 +0200
committerGravatar Hugo Herbelin <Hugo.Herbelin@inria.fr>2014-06-13 12:08:34 +0200
commit176f40f976741c8fb6e020c0eaeac4df59a474bc (patch)
tree75111a6ff55f049bc01181f7dd60e6c7f7e951ab
parentc06fa8b4c16c35fe48039d5b13e181cca9ebbb51 (diff)
Improved error message when a meta posed as an evar remains unsolved
in case prefix 'e' of "apply" and co is not given.
-rw-r--r--intf/evar_kinds.mli1
-rw-r--r--pretyping/evd.ml1
-rw-r--r--pretyping/unification.ml8
-rw-r--r--toplevel/himsg.ml2
4 files changed, 11 insertions, 1 deletions
diff --git a/intf/evar_kinds.mli b/intf/evar_kinds.mli
index 1541d4e46..e8281e07b 100644
--- a/intf/evar_kinds.mli
+++ b/intf/evar_kinds.mli
@@ -27,3 +27,4 @@ type t =
| GoalEvar
| ImpossibleCase
| MatchingVar of bool * Id.t
+ | VarInstance of Id.t
diff --git a/pretyping/evd.ml b/pretyping/evd.ml
index 2041f35bf..e36e16c05 100644
--- a/pretyping/evd.ml
+++ b/pretyping/evd.ml
@@ -1560,6 +1560,7 @@ let pr_evar_source = function
| Evar_kinds.GoalEvar -> str "goal evar"
| Evar_kinds.ImpossibleCase -> str "type of impossible pattern-matching clause"
| Evar_kinds.MatchingVar _ -> str "matching variable"
+ | Evar_kinds.VarInstance id -> str "instance of " ++ pr_id id
let pr_evar_info evi =
let phyps =
diff --git a/pretyping/unification.ml b/pretyping/unification.ml
index 71b054cd6..236dc9876 100644
--- a/pretyping/unification.ml
+++ b/pretyping/unification.ml
@@ -124,6 +124,11 @@ let rec subst_meta_instances bl c =
(** [env] should be the context in which the metas live *)
+let evar_source_of_meta mv evd =
+ match Evd.meta_name evd mv with
+ | Anonymous -> assert false (* only dependent metas posed as evars (?) *)
+ | Name id -> (Loc.ghost,Evar_kinds.VarInstance id)
+
let pose_all_metas_as_evars env evd t =
let evdref = ref evd in
let rec aux t = match kind_of_term t with
@@ -133,7 +138,8 @@ let pose_all_metas_as_evars env evd t =
| None ->
let {rebus=ty;freemetas=mvs} = Evd.meta_ftype evd mv in
let ty = if Evd.Metaset.is_empty mvs then ty else aux ty in
- let ev = Evarutil.e_new_evar evdref env ~src:(Loc.ghost,Evar_kinds.GoalEvar) ty in
+ let src = evar_source_of_meta mv !evdref in
+ let ev = Evarutil.e_new_evar evdref env ~src ty in
evdref := meta_assign mv (ev,(Conv,TypeNotProcessed)) !evdref;
ev)
| _ ->
diff --git a/toplevel/himsg.ml b/toplevel/himsg.ml
index db74e5aa1..41ce6f1da 100644
--- a/toplevel/himsg.ml
+++ b/toplevel/himsg.ml
@@ -498,6 +498,8 @@ let explain_evar_kind env evi = function
str "the type of an impossible pattern-matching clause"
| Evar_kinds.MatchingVar _ ->
assert false
+ | Evar_kinds.VarInstance id ->
+ str "an instance for the variable " ++ pr_id id
let explain_unsolvability = function
| None -> mt()