Skip to content

Commit e87e2f7

Browse files
committed
check candidates in miller_pfenning
1 parent 8e6284f commit e87e2f7

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

pretyping/evarconv.ml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -737,13 +737,19 @@ and evar_eqappr_x ?(rhs_is_already_stuck = false) flags env evd pbty
737737
UnifFailure (i, NotSameHead)
738738
in
739739
let miller_pfenning l2r fallback ev lF tM evd =
740-
match is_unification_pattern_evar env evd ev lF tM with
741-
| None -> fallback ()
742-
| Some l1' -> (* Miller-Pfenning's patterns unification *)
743-
let t2 = tM in
744-
let t2 = solve_pattern_eqn env evd l1' t2 in
745-
solve_simple_eqn (conv_fun evar_conv_x) flags env evd
746-
(position_problem l2r pbty,ev,t2)
740+
try
741+
if lF = [] then Success (Evarsolve.solve_candidates (conv_fun evar_conv_x) flags env evd ev tM)
742+
else raise NoCandidates
743+
with NoCandidates ->
744+
(match is_unification_pattern_evar env evd ev lF tM with
745+
| None -> fallback ()
746+
| Some l1' -> (* Miller-Pfenning's patterns unification *)
747+
let t2 = tM in
748+
let t2 = solve_pattern_eqn env evd l1' t2 in
749+
solve_simple_eqn (conv_fun evar_conv_x) flags env evd
750+
(position_problem l2r pbty,ev,t2))
751+
| IncompatibleCandidates t ->
752+
UnifFailure (evd,IncompatibleInstances (env,ev,t,tM))
747753
in
748754
let consume_stack l2r (termF,skF) (termO,skO) evd =
749755
let switch f a b = if l2r then f a b else f b a in

pretyping/evarsolve.mli

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ val refresh_universes :
123123
bool option (* direction: true for levels lower than the existing levels *) ->
124124
env -> evar_map -> types -> evar_map * types
125125

126+
exception NoCandidates
127+
exception IncompatibleCandidates of constr
128+
129+
val solve_candidates : unifier -> unify_flags -> env -> evar_map -> existential -> constr -> evar_map
130+
126131
val solve_refl : ?can_drop:bool -> conversion_check -> unify_flags -> env -> evar_map ->
127132
bool option -> Evar.t -> constr SList.t -> constr SList.t -> evar_map
128133

0 commit comments

Comments
 (0)