aboutsummaryrefslogtreecommitdiffhomepage
path: root/pretyping
diff options
context:
space:
mode:
authorGravatar herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7>2008-03-10 23:17:57 +0000
committerGravatar herbelin <herbelin@85f007b7-540e-0410-9357-904b9bb8a0f7>2008-03-10 23:17:57 +0000
commit77091f657e7393fc9d83a414542d2e2e2dd1e735 (patch)
treea5fa8defd64e58a4370a6f6e847b4245ed5f632d /pretyping
parent6b01f89b083bf8acc666264222131d6ce2bb06bf (diff)
Pas très propre de reposer sur la capture des anomalies (et cela
complique le débogage...). Réécriture de 2 morceaux de code qui utilisaient les anomalies à des fins détournées de leur intention. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@10653 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'pretyping')
-rw-r--r--pretyping/evd.ml7
-rw-r--r--pretyping/evd.mli1
-rw-r--r--pretyping/reductionops.ml5
3 files changed, 10 insertions, 3 deletions
diff --git a/pretyping/evd.ml b/pretyping/evd.ml
index c583a0b22..e044c17a9 100644
--- a/pretyping/evd.ml
+++ b/pretyping/evd.ml
@@ -512,11 +512,16 @@ let metas_of evd =
| (n,Cltyp (_,typ)) -> (n,typ.rebus))
(meta_list evd)
+let meta_opt_fvalue evd mv =
+ match Metamap.find mv evd.metas with
+ | Clval(_,b,_) -> Some b
+ | Cltyp _ -> None
+
let meta_defined evd mv =
match Metamap.find mv evd.metas with
| Clval _ -> true
| Cltyp _ -> false
-
+
let meta_fvalue evd mv =
match Metamap.find mv evd.metas with
| Clval(_,b,_) -> b
diff --git a/pretyping/evd.mli b/pretyping/evd.mli
index d74d21446..7f5a4060b 100644
--- a/pretyping/evd.mli
+++ b/pretyping/evd.mli
@@ -183,6 +183,7 @@ val meta_defined : evar_defs -> metavariable -> bool
(* [meta_fvalue] raises [Not_found] if meta not in map or [Anomaly] if
meta has no value *)
val meta_fvalue : evar_defs -> metavariable -> constr freelisted * instance_status
+val meta_opt_fvalue : evar_defs -> metavariable -> (constr freelisted * instance_status) option
val meta_ftype : evar_defs -> metavariable -> constr freelisted
val meta_name : evar_defs -> metavariable -> name
val meta_with_name : evar_defs -> identifier -> metavariable
diff --git a/pretyping/reductionops.ml b/pretyping/reductionops.ml
index 617bd7717..c7af265ce 100644
--- a/pretyping/reductionops.ml
+++ b/pretyping/reductionops.ml
@@ -929,8 +929,9 @@ let meta_value evd mv =
let meta_reducible_instance evd b =
let fm = Metaset.elements b.freemetas in
let metas = List.fold_left (fun l mv ->
- try let g,(_,s) = meta_fvalue evd mv in (mv,(g.rebus,s))::l
- with Anomaly _ | Not_found -> l) [] fm in
+ match (try meta_opt_fvalue evd mv with Not_found -> None) with
+ | Some (g,(_,s)) -> (mv,(g.rebus,s))::l
+ | None -> l) [] in
let rec irec u =
let u = whd_betaiota u in
match kind_of_term u with