diff options
| -rw-r--r-- | pretyping/unification.ml | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/pretyping/unification.ml b/pretyping/unification.ml index 6f7e2ba6f1..87025b4d22 100644 --- a/pretyping/unification.ml +++ b/pretyping/unification.ml @@ -827,6 +827,14 @@ let order_metas metas = meta :: order latemetas metas in order [] metas +(* Give priority to the less-dependent evars so that instances found + by matching are preferred over instances found by unification of + types of other instances; this gives instances more faithful to + what the user sees *) + +let order_evars evars = + Sort.list (fun (env1,(evk1,_),rhs1) (env2,(evk2,_),rhs2) -> evk1 < evk2) evars + (* Solve an equation ?n[x1=u1..xn=un] = t where ?n is an evar *) let solve_simple_evar_eqn ts env evd ev rhs = @@ -935,7 +943,7 @@ let w_merge env with_types flags (evd,metas,evars) = else Evd.define sp (Evarutil.nf_evar evd''' c) evd''' in (* merge constraints *) - w_merge_rec evd (order_metas metas) evars [] + w_merge_rec evd (order_metas metas) (order_evars evars) [] let w_unify_meta_types env ?(flags=default_unify_flags) evd = let metas,evd = retract_coercible_metas evd in |
