diff options
author | Pierre-Marie Pédrot <pierre-marie.pedrot@inria.fr> | 2015-12-15 10:30:31 +0100 |
---|---|---|
committer | Pierre-Marie Pédrot <pierre-marie.pedrot@inria.fr> | 2015-12-15 10:38:52 +0100 |
commit | db282f831cbf619e417593c602de24960c3ca69c (patch) | |
tree | 6f4bcc1830e37713c571e58084214571c8920ff1 /pretyping | |
parent | f439001caa24671d03d8816964ceb8e483660e70 (diff) | |
parent | ce395ca02311bbe6ecc1b2782e74312272dd15ec (diff) |
Merge branch 'v8.5'
Diffstat (limited to 'pretyping')
-rw-r--r-- | pretyping/evarsolve.ml | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/pretyping/evarsolve.ml b/pretyping/evarsolve.ml index aeb2445d1..fe26dcd28 100644 --- a/pretyping/evarsolve.ml +++ b/pretyping/evarsolve.ml @@ -1286,10 +1286,16 @@ let solve_candidates conv_algo env evd (evk,argsv) rhs = | l -> evd let occur_evar_upto_types sigma n c = + let seen = ref Evar.Set.empty in let rec occur_rec c = match kind_of_term c with | Evar (sp,_) when Evar.equal sp n -> raise Occur - | Evar e -> Option.iter occur_rec (existential_opt_value sigma e); - occur_rec (existential_type sigma e) + | Evar (sp,args as e) -> + if Evar.Set.mem sp !seen then + Array.iter occur_rec args + else ( + seen := Evar.Set.add sp !seen; + Option.iter occur_rec (existential_opt_value sigma e); + occur_rec (existential_type sigma e)) | _ -> iter_constr occur_rec c in try occur_rec c; false with Occur -> true |