aboutsummaryrefslogtreecommitdiff
path: root/pretyping
diff options
context:
space:
mode:
authorMatthieu Sozeau2015-03-03 09:41:51 +0100
committerMatthieu Sozeau2015-03-03 09:41:51 +0100
commitac62cda8a4f488b94033b108c37556877232137a (patch)
treeea494a0816ca67c5cc00ba75712fb650ffeb380b /pretyping
parente77f178e60918f14eacd1ec0364a491d4cfd0f3f (diff)
Fix bug #4101, noccur_evar's expand_projection can legitimately fail
when called from w_unify, so we protect it.
Diffstat (limited to 'pretyping')
-rw-r--r--pretyping/evarsolve.ml8
1 files changed, 7 insertions, 1 deletions
diff --git a/pretyping/evarsolve.ml b/pretyping/evarsolve.ml
index 99d83a0e88..bfd19c6c7d 100644
--- a/pretyping/evarsolve.ml
+++ b/pretyping/evarsolve.ml
@@ -192,7 +192,13 @@ let noccur_evar env evd evk c =
(match pi2 (Environ.lookup_rel i env) with
| None -> ()
| Some b -> cache := Int.Set.add (i-k) !cache; occur_rec acc (lift i b))
- | Proj (p,c) -> occur_rec acc (Retyping.expand_projection env evd p c [])
+ | Proj (p,c) ->
+ let c =
+ try Retyping.expand_projection env evd p c []
+ with Retyping.RetypeError _ ->
+ (* Can happen when called from w_unify which doesn't assign evars/metas
+ eagerly enough *) c
+ in occur_rec acc c
| _ -> iter_constr_with_full_binders (fun rd (k,env) -> (succ k, push_rel rd env))
occur_rec acc c
in